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.
---
 ChangeLog       |    9 +++++++++
 THANKS          |    1 +
 lib/am/check.am |   40 +++++++++++++++++++++-------------------
 3 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e468ef3..492afe5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-06-17  Bert Wesarg <bert.wes...@googlemail.com>
+
+       check: don't use multi-line coloring for the report
+       * lib/am/check.am (am__text_box): Accept colors for lines.
+       [%?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-13  Stefano Lattarini  <stefano.lattar...@gmail.com>
 
        tests: optimize tests on primary/prefix mismatch for speed
diff --git a/THANKS b/THANKS
index c3cc55c..4f8950a 100644
--- a/THANKS
+++ b/THANKS
@@ -37,6 +37,7 @@ Benoit Sigoure                ts...@lrde.epita.fr
 Bernard Giroud         bernard.gir...@creditlyonnais.ch
 Bernard Urban          bernard.ur...@meteo.fr
 Bernd Jendrissek       berndfoo...@users.sourceforge.net
+Bert Wesarg            bert.wes...@googlemail.com
 Bill Currie            bcur...@tssc.co.nz
 Bill Davidson          b...@kayhay.com
 Bill Fenner            fen...@parc.xerox.com
diff --git a/lib/am/check.am b/lib/am/check.am
index 97ecb68..1e9348c 100644
--- a/lib/am/check.am
+++ b/lib/am/check.am
@@ -75,15 +75,17 @@ 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.
+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,
@@ -216,12 +218,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)
@@ -401,14 +402,15 @@ 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"; \
+         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
 
-- 
1.7.5.517.g10515


Reply via email to