automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] check: don't use multi-line coloring for the report


From: Stefano Lattarini
Subject: Re: [PATCH] check: don't use multi-line coloring for the report
Date: Mon, 20 Jun 2011 10:33:53 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

On Friday 17 June 2011, Stefano Lattarini wrote:
> Hi Bert, and thanks again for your patch.
> 
> I have some minor observations and objections below (please do not take
> them as a belittling of your work; they are either constructive criticism,
> or requests for cosmetic changes mandated by the GNU coding standards).
> I hope you have time and will to address them; if not, don't worry, I can
> do that for you.
> 
OK, I've amended the patch on Bert's behalf, as he can't do that himself
at the moment.  Attached is what I've pushed (to maint).

Regards,
  Stefano
From b8c2b69913b652bcfd4665b041f11d8b5316da2b Mon Sep 17 00:00:00 2001
Message-Id: <address@hidden>
From: Bert Wesarg <address@hidden>
Date: Fri, 17 Jun 2011 21:59:52 +0200
Subject: [PATCH] check: don't use multi-line coloring for the report

"less -R" can't handle multi-line coloring as it is done for the
check reports of the serial and parallel testsuite, because of
performance reasons.  Thus, color each line of the check report
by its own.

* lib/am/check.am (am__text_box): Accept colors for lines, and
color each line by its own.
[%?PARALLEL_TESTS%] $(TEST_SUITE_LOG): Let am__text_box handle
the line coloring.
[!%?PARALLEL_TESTS%] $(check-TESTS): Color each report line by
its own.
* THANKS: Update.
---
 ChangeLog                      |   15 +++++++++++++
 THANKS                         |    1 +
 lib/Automake/tests/Makefile.in |   31 +++++++++++++++-----------
 lib/am/check.am                |   46 +++++++++++++++++++++++----------------
 tests/Makefile.in              |   31 +++++++++++++++-----------
 5 files changed, 79 insertions(+), 45 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c5652da..d79a848 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2011-06-20  Bert Wesarg <address@hidden>  (tiny change)
+
+       check: don't use multi-line coloring for the report
+       "less -R" can't handle multi-line coloring as it is done for the
+       check reports of the serial and parallel testsuite, because of
+       performance reasons.  Thus, color each line of the check report
+       by its own.
+       * lib/am/check.am (am__text_box): Accept colors for lines, and
+       color each line by its own.
+       [%?PARALLEL_TESTS%] $(TEST_SUITE_LOG): Let am__text_box handle
+       the line coloring.
+       [!%?PARALLEL_TESTS%] $(check-TESTS): Color each report line by
+       its own.
+       * THANKS: Update.
+
 2011-06-18  Stefano Lattarini  <address@hidden>
 
        docs: AM_DISTCHECK_CONFIGURE_FLAGS is for corner cases
diff --git a/THANKS b/THANKS
index 16a1ef8..3d71419 100644
--- a/THANKS
+++ b/THANKS
@@ -37,6 +37,7 @@ Benoit Sigoure                address@hidden
 Bernard Giroud         address@hidden
 Bernard Urban          address@hidden
 Bernd Jendrissek       address@hidden
+Bert Wesarg            address@hidden
 Bill Currie            address@hidden
 Bill Davidson          address@hidden
 Bill Fenner            address@hidden
diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in
index 7ed17d6..2f553ed 100644
--- a/lib/Automake/tests/Makefile.in
+++ b/lib/Automake/tests/Makefile.in
@@ -105,15 +105,21 @@ am__base_list = \
 am__rst_title = sed 's/.*/   &   /;h;s/./=/g;p;x;p;g;p;s/.*//'
 am__rst_section = sed 'p;s/./=/g;p;g'
 # Put stdin (possibly several lines separated by ".  ") in a box.
-am__text_box = $(AWK) '{                               \
-  n = split($$0, lines, "\\.  "); max = 0;             \
-  for (i = 1; i <= n; ++i)                             \
-    if (max < length(lines[i]))                                \
-      max = length(lines[i]);                          \
-  for (i = 0; i < max; ++i) line = line "=";           \
-  print line;                                          \
-  for (i = 1; i <= n; ++i) if (lines[i]) print lines[i];\
-  print line;                                          \
+# Prefix each line by 'col' and terminate each with 'std', for coloring.
+# Multi line coloring is problematic with "less -R", so we really need
+# to color each line individually.
+am__text_box = $(AWK) '{                       \
+  n = split($$0, lines, "\\.  "); max = 0;     \
+  for (i = 1; i <= n; ++i)                     \
+    if (max < length(lines[i]))                        \
+      max = length(lines[i]);                  \
+  for (i = 0; i < max; ++i)                    \
+    line = line "=";                           \
+  print col line std;                          \
+  for (i = 1; i <= n; ++i)                     \
+    if (lines[i])                              \
+      print col lines[i] std;                  \
+  print col line std;                          \
 }'
 # Solaris 10 'make', and several other traditional 'make' implementations,
 # pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
@@ -394,12 +400,11 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
        test x"$$VERBOSE" = x || $$exit || cat $(TEST_SUITE_LOG);       \
        $(am__tty_colors);                                              \
        if $$exit; then                                                 \
-         echo $(ECHO_N) "$$grn$(ECHO_C)";                              \
+         col="$$grn";                                                  \
         else                                                           \
-         echo $(ECHO_N) "$$red$(ECHO_C)";                              \
+         col="$$red";                                                  \
        fi;                                                             \
-       echo "$$msg" | $(am__text_box);                                 \
-       echo $(ECHO_N) "$$std$(ECHO_C)";                                \
+       echo "$$msg" | $(am__text_box) "col=$$col" "std=$$std";         \
        $$exit
 
 # Run all the tests.
diff --git a/lib/am/check.am b/lib/am/check.am
index 4d10ce9..0b54312 100644
--- a/lib/am/check.am
+++ b/lib/am/check.am
@@ -75,15 +75,21 @@ am__rst_title   = sed 's/.*/   &   
/;h;s/./=/g;p;x;p;g;p;s/.*//'
 am__rst_section = sed 'p;s/./=/g;p;g'
 
 # Put stdin (possibly several lines separated by ".  ") in a box.
-am__text_box = $(AWK) '{                               \
-  n = split($$0, lines, "\\.  "); max = 0;             \
-  for (i = 1; i <= n; ++i)                             \
-    if (max < length(lines[i]))                                \
-      max = length(lines[i]);                          \
-  for (i = 0; i < max; ++i) line = line "=";           \
-  print line;                                          \
-  for (i = 1; i <= n; ++i) if (lines[i]) print lines[i];\
-  print line;                                          \
+# Prefix each line by 'col' and terminate each with 'std', for coloring.
+# Multi line coloring is problematic with "less -R", so we really need
+# to color each line individually.
+am__text_box = $(AWK) '{                       \
+  n = split($$0, lines, "\\.  "); max = 0;     \
+  for (i = 1; i <= n; ++i)                     \
+    if (max < length(lines[i]))                        \
+      max = length(lines[i]);                  \
+  for (i = 0; i < max; ++i)                    \
+    line = line "=";                           \
+  print col line std;                          \
+  for (i = 1; i <= n; ++i)                     \
+    if (lines[i])                              \
+      print col lines[i] std;                  \
+  print col line std;                          \
 }'
 
 # Solaris 10 'make', and several other traditional 'make' implementations,
@@ -213,12 +219,11 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
        test x"$$VERBOSE" = x || $$exit || cat $(TEST_SUITE_LOG);       \
        $(am__tty_colors);                                              \
        if $$exit; then                                                 \
-         echo $(ECHO_N) "$$grn$(ECHO_C)";                              \
+         col="$$grn";                                                  \
         else                                                           \
-         echo $(ECHO_N) "$$red$(ECHO_C)";                              \
+         col="$$red";                                                  \
        fi;                                                             \
-       echo "$$msg" | $(am__text_box);                                 \
-       echo $(ECHO_N) "$$std$(ECHO_C)";                                \
+       echo "$$msg" | $(am__text_box) "col=$$col" "std=$$std";         \
        $$exit
 
 RECHECK_LOGS = $(TEST_LOGS)
@@ -398,14 +403,17 @@ check-TESTS: $(TESTS)
          fi; \
          dashes=`echo "$$dashes" | sed s/./=/g`; \
          if test "$$failed" -eq 0; then \
-           echo "$$grn$$dashes"; \
+           col="$$grn"; \
          else \
-           echo "$$red$$dashes"; \
+           col="$$red"; \
          fi; \
-         echo "$$banner"; \
-         test -z "$$skipped" || echo "$$skipped"; \
-         test -z "$$report" || echo "$$report"; \
-         echo "$$dashes$$std"; \
+## Multi line coloring is problematic with "less -R", so we really need
+## to color each line individually.
+         echo "$${col}$$dashes$${std}"; \
+         echo "$${col}$$banner$${std}"; \
+         test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+         test -z "$$report" || echo "$${col}$$report$${std}"; \
+         echo "$${col}$$dashes$${std}"; \
          test "$$failed" -eq 0; \
        else :; fi
 
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 5ca3f6a..ba57aa2 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -108,15 +108,21 @@ am__base_list = \
 am__rst_title = sed 's/.*/   &   /;h;s/./=/g;p;x;p;g;p;s/.*//'
 am__rst_section = sed 'p;s/./=/g;p;g'
 # Put stdin (possibly several lines separated by ".  ") in a box.
-am__text_box = $(AWK) '{                               \
-  n = split($$0, lines, "\\.  "); max = 0;             \
-  for (i = 1; i <= n; ++i)                             \
-    if (max < length(lines[i]))                                \
-      max = length(lines[i]);                          \
-  for (i = 0; i < max; ++i) line = line "=";           \
-  print line;                                          \
-  for (i = 1; i <= n; ++i) if (lines[i]) print lines[i];\
-  print line;                                          \
+# Prefix each line by 'col' and terminate each with 'std', for coloring.
+# Multi line coloring is problematic with "less -R", so we really need
+# to color each line individually.
+am__text_box = $(AWK) '{                       \
+  n = split($$0, lines, "\\.  "); max = 0;     \
+  for (i = 1; i <= n; ++i)                     \
+    if (max < length(lines[i]))                        \
+      max = length(lines[i]);                  \
+  for (i = 0; i < max; ++i)                    \
+    line = line "=";                           \
+  print col line std;                          \
+  for (i = 1; i <= n; ++i)                     \
+    if (lines[i])                              \
+      print col lines[i] std;                  \
+  print col line std;                          \
 }'
 # Solaris 10 'make', and several other traditional 'make' implementations,
 # pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
@@ -1252,12 +1258,11 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
        test x"$$VERBOSE" = x || $$exit || cat $(TEST_SUITE_LOG);       \
        $(am__tty_colors);                                              \
        if $$exit; then                                                 \
-         echo $(ECHO_N) "$$grn$(ECHO_C)";                              \
+         col="$$grn";                                                  \
         else                                                           \
-         echo $(ECHO_N) "$$red$(ECHO_C)";                              \
+         col="$$red";                                                  \
        fi;                                                             \
-       echo "$$msg" | $(am__text_box);                                 \
-       echo $(ECHO_N) "$$std$(ECHO_C)";                                \
+       echo "$$msg" | $(am__text_box) "col=$$col" "std=$$std";         \
        $$exit
 
 # Run all the tests.
-- 
1.7.2.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]