parallel-tests: save few forks when possible
[platform/upstream/automake.git] / lib / am / check.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 2001-2012 Free Software Foundation, Inc.
3
4 ## This program is free software; you can redistribute it and/or modify
5 ## it under the terms of the GNU General Public License as published by
6 ## the Free Software Foundation; either version 2, or (at your option)
7 ## any later version.
8
9 ## This program is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 ## GNU General Public License for more details.
13
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 am__tty_colors_dummy = \
18   mgn= red= grn= lgn= blu= brg= std=; \
19   am__color_tests=no
20 if %?COLOR%
21 # If stdout is a non-dumb tty, use colors.  If test -t is not supported,
22 # then this fails; a conservative approach.  Of course do not redirect
23 # stdout here, just stderr.
24 am__tty_colors = \
25 $(am__tty_colors_dummy); \
26 test "X$(AM_COLOR_TESTS)" != Xno \
27 && test "X$$TERM" != Xdumb \
28 && { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \
29 && { \
30   am__color_tests=yes; \
31   red='\e[0;31m'; \
32   grn='\e[0;32m'; \
33   lgn='\e[1;32m'; \
34   blu='\e[1;34m'; \
35   mgn='\e[0;35m'; \
36   brg='\e[1m'; \
37   std='\e[m'; \
38 }
39 else !%?COLOR%
40 am__tty_colors = $(am__tty_colors_dummy)
41 endif !%?COLOR%
42
43 .PHONY: check-TESTS
44
45 if %?PARALLEL_TESTS%
46
47 include inst-vars.am
48
49 ## New parallel test driver.
50 ##
51 ## The first version of the code here was adapted from check.mk, which was
52 ## originally written at EPITA/LRDE, further developed at Gostai, then made
53 ## its way from GNU coreutils to end up, largely rewritten, in Automake.
54 ## The current version is an heavy rewrite of that, to allow for support
55 ## of more test metadata, and the use of custom test derivers and protocols
56 ## (among them, TAP).
57
58 am__recheck_rx = ^[     ]*:recheck:[    ]*
59 am__global_test_result_rx = ^[  ]*:global-test-result:[         ]*
60 am__copy_in_global_log_rx = ^[  ]*:copy-in-global-log:[         ]*
61
62 # A command that, given a newline-separated list of test names on the
63 # standard input, print the name of the tests that are to be re-run
64 # upon "make recheck".
65 am__list_recheck_tests = $(AWK) '{ \
66 ## By default, we assume the test is to be re-run.
67   recheck = 1; \
68   while ((rc = (getline line < ($$0 ".trs"))) != 0) \
69     { \
70       if (rc < 0) \
71         { \
72 ## If we've encountered an I/O error here, there are three possibilities:
73 ##
74 ##  [1] The '.log' file exists, but the '.trs' does not; in this case,
75 ##      we "gracefully" recover by assuming the corresponding test is
76 ##      to be re-run (which will re-create the missing '.trs' file).
77 ##
78 ##  [2] Both the '.log' and '.trs' files are missing; this means that
79 ##      the corresponding test has not been run, and is thus *not* to
80 ##      be re-run.
81 ##
82 ##  [3] We have encountered some corner-case problem (e.g., a '.log' or
83 ##      '.trs' files somehow made unreadable, or issues with a bad NFS
84 ##      connection, or whatever); we don't handle such corner cases.
85 ##
86           if ((getline line2 < ($$0 ".log")) < 0) \
87             recheck = 0; \
88           break; \
89         } \
90       else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
91 ## A directive explicitly specifying the test is *not* to be re-run.
92         { \
93           recheck = 0; \
94           break; \
95         } \
96       else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
97         { \
98 ## A directive explicitly specifying the test *is* to be re-run.
99           break; \
100         } \
101 ## else continue with the next iteration.
102     }; \
103   if (recheck) \
104     print $$0; \
105 ## Don't leak open file descriptors, as this could cause serious
106 ## problems when there are many tests (yes, even on Linux).
107   close ($$0 ".trs"); \
108   close ($$0 ".log"); \
109 }'
110
111 # A command that, given a newline-separated list of test names on the
112 # standard input, create the global log from their .trs and .log files.
113 am__create_global_log = $(AWK) ' \
114 function fatal(msg) \
115 { \
116   print "fatal: making $@: " msg | "cat >&2"; \
117   exit 1; \
118 } \
119 function rst_section(header) \
120 { \
121   print header; \
122   len = length(header); \
123   for (i = 1; i <= len; i = i + 1) \
124     printf "="; \
125   printf "\n\n"; \
126 } \
127 { \
128 ## By default, we assume the test log is to be copied in the global log,
129 ## and that its result is simply "RUN" (i.e., we still don't know what
130 ## it outcome was, but we know that at least it has run).
131   copy_in_global_log = 1; \
132   global_test_result = "RUN"; \
133   while ((rc = (getline line < ($$0 ".trs"))) != 0) \
134     { \
135       if (rc < 0) \
136          fatal("failed to read from " $$0 ".trs"); \
137       if (line ~ /$(am__global_test_result_rx)/) \
138         { \
139           sub("$(am__global_test_result_rx)", "", line); \
140           sub("[        ]*$$", "", line); \
141           global_test_result = line; \
142         } \
143       else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
144         copy_in_global_log = 0; \
145     }; \
146   if (copy_in_global_log) \
147     { \
148       rst_section(global_test_result ": " $$0); \
149       while ((rc = (getline line < ($$0 ".log"))) != 0) \
150       { \
151         if (rc < 0) \
152           fatal("failed to read from " $$0 ".log"); \
153         print line; \
154       }; \
155     }; \
156 ## Don't leak open file descriptors, as this could cause serious
157 ## problems when there are many tests (yes, even on Linux).
158   close ($$0 ".trs"); \
159   close ($$0 ".log"); \
160 }'
161
162 # Restructured Text title.
163 am__rst_title = { sed 's/.*/   &   /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
164
165 # Solaris 10 'make', and several other traditional 'make' implementations,
166 # pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
167 # by disabling -e (using the XSI extension "set +e") if it's set.
168 am__sh_e_setup = case $$- in *e*) set +e;; esac
169
170 # Default flags passed to test drivers.
171 am__common_driver_flags = \
172   --color-tests "$$am__color_tests" \
173   --enable-hard-errors "$$am__enable_hard_errors" \
174   --expect-failure "$$am__expect_failure"
175
176 # To be inserted before the command running the test.  Creates the
177 # directory for the log if needed.  Stores in $dir the directory
178 # containing $f, in $tst the test, in $log the log.  Executes the
179 # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
180 # passes TESTS_ENVIRONMENT.  Set up options for the wrapper that
181 # will run the test scripts (or their associated LOG_COMPILER, if
182 # thy have one).
183 am__check_pre =                                         \
184 $(am__sh_e_setup);                                      \
185 $(am__vpath_adj_setup) $(am__vpath_adj)                 \
186 $(am__tty_colors);                                      \
187 srcdir=$(srcdir); export srcdir;                        \
188 case "$@" in                                            \
189   */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;;    \
190     *) am__odir=.;;                                     \
191 esac;                                                   \
192 test "x$$am__odir" = x"." || test -d "$$am__odir"       \
193   || $(MKDIR_P) "$$am__odir" || exit $$?;               \
194 if test -f "./$$f"; then dir=./;                        \
195 elif test -f "$$f"; then dir=;                          \
196 else dir="$(srcdir)/"; fi;                              \
197 tst=$$dir$$f; log='$@';                                 \
198 if test -n '$(DISABLE_HARD_ERRORS)'; then               \
199   am__enable_hard_errors=no;                            \
200 else                                                    \
201   am__enable_hard_errors=yes;                           \
202 fi;                                                     \
203 ## The use of $dir below is required to account for VPATH
204 ## rewriting done by Sun make.
205 case " $(XFAIL_TESTS) " in                              \
206   *[\ \ ]$$f[\ \        ]* | *[\ \      ]$$dir$$f[\ \   ]*) \
207     am__expect_failure=yes;;                            \
208   *)                                                    \
209     am__expect_failure=no;;                             \
210 esac;                                                   \
211 $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
212
213 # A shell command to get the names of the tests scripts with any registered
214 # extension removed (i.e., equivalently, the names of the test logs, with
215 # the '.log' extension removed).  The result is saved in the shell variable
216 # '$bases'.  This honors runtime overriding of TESTS and TEST_LOGS.  Sadly,
217 # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
218 # since that might cause problem with VPATH rewrites for suffix-less tests.
219 # See also 'test-harness-vpath-rewrite.test' and 'test-trs-basic.test'.
220 am__set_TESTS_bases = \
221   bases='$(TEST_LOGS)'; \
222   bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
223 ## Trim away any extra whitespace.  This has already proved useful
224 ## in avoiding weird bug on lesser make implementations.  It also
225 ## works around the GNU make 3.80 bug where trailing whitespace in
226 ## "TESTS = foo.test $(empty)" causes $(TESTS_LOGS)  to erroneously
227 ## expand to "foo.log .log".
228   bases=`echo $$bases`
229
230 # Recover from deleted '.trs' file; this should ensure that
231 # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
232 # both 'foo.log' and 'foo.trs'.  Break the recipe in two subshells
233 # to avoid problems with "make -n".
234 .log.trs:
235         rm -f $< $@
236         $(MAKE) $(AM_MAKEFLAGS) $<
237
238 $(TEST_SUITE_LOG): $(TEST_LOGS)
239         @$(am__set_TESTS_bases); \
240 ## Helper shell function, tells whether a path refers to an existing,
241 ## regular, readable file.
242         am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
243 ## We need to ensures that all the required '.trs' and '.log' files will
244 ## be present and readable.  The direct dependencies of $(TEST_SUITE_LOG)
245 ## only ensure that all the '.log' files exists; they don't ensure that
246 ## the '.log' files are readable, and worse, they don't ensure that the
247 ## '.trs' files even exist.
248         redo_bases=`for i in $$bases; do \
249                       am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
250                     done`; \
251         if test -n "$$redo_bases"; then \
252 ## Uh-oh, either some '.log' files were unreadable, or some '.trs' files
253 ## were missing (or unreadable).  We need to re-run the corresponding
254 ## tests in order to re-create them.
255           redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
256           redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
257           if $(am__make_dryrun); then :; else \
258 ## Break "rm -f" into two calls to minimize the possibility of exceeding
259 ## command line length limits.
260             rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
261           fi; \
262         fi; \
263 ## Use a trick to to ensure that we don't go into an infinite recursion
264 ## in case a test log in $(TEST_LOGS) is the same as $(TEST_SUITE_LOG).
265 ## Yes, this has already happened in practice.  Sigh!
266         if test -n "$$am__remaking_logs"; then \
267           echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
268                "recursion detected" >&2; \
269         else \
270           am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
271         fi; \
272         if $(am__make_dryrun); then :; else \
273 ## Sanity check: each unreadable or non-existent test result file should
274 ## has been properly remade at this point, as should the corresponding log
275 ## file.
276           st=0;  \
277           errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
278           for i in $$redo_bases; do \
279             test -f $$i.trs && test -r $$i.trs \
280               || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
281             test -f $$i.log && test -r $$i.log \
282               || { echo "$$errmsg $$i.log" >&2; st=1; }; \
283           done; \
284           test $$st -eq 0 || exit 1; \
285         fi
286 ## We need a new subshell to work portably with "make -n", since the
287 ## previous part of the recipe contained a $(MAKE) invocation.
288         @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
289         ws='[   ]'; \
290 ## List of test result files.
291         results=`for b in $$bases; do echo $$b.trs; done`; \
292         test -n "$$results" || results=/dev/null; \
293 ## Prepare data for the test suite summary.  These do not take into account
294 ## unreadable test results, but they'll be appropriately updated later if
295 ## needed.
296         all=`  grep "^$$ws*:test-result:"           $$results | wc -l`; \
297         pass=` grep "^$$ws*:test-result:$$ws*PASS"  $$results | wc -l`; \
298         fail=` grep "^$$ws*:test-result:$$ws*FAIL"  $$results | wc -l`; \
299         skip=` grep "^$$ws*:test-result:$$ws*SKIP"  $$results | wc -l`; \
300         xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
301         xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
302         error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
303 ## Whether the testsuite was successful or not.
304         if test `expr $$fail + $$xpass + $$error` -eq 0; then \
305           success=true; \
306         else \
307           success=false; \
308         fi; \
309 ## Make $br a line of exactly 76 '=' characters, that will be used to
310 ## enclose the testsuite summary report when displayed on the console.
311         br='==================='; br=$$br$$br$$br$$br; \
312 ## When writing the test summary to the console, we want to color a line
313 ## reporting the count of some result *only* if at least one test
314 ## experienced such a result.  This function is handy in this regard.
315         result_count () \
316         { \
317             if test x"$$1" = x"--maybe-color"; then \
318               maybe_colorize=yes; \
319             elif test x"$$1" = x"--no-color"; then \
320               maybe_colorize=no; \
321             else \
322               echo "$@: invalid 'result_count' usage" >&2; exit 4; \
323             fi; \
324             shift; \
325             desc=$$1 count=$$2; \
326             if test $$maybe_colorize = yes && test $$count -gt 0; then \
327               color_start=$$3 color_end=$$std; \
328             else \
329               color_start= color_end=; \
330             fi; \
331             echo "$${color_start}# $$desc $$count$${color_end}"; \
332         }; \
333 ## A shell function that creates the testsuite summary.  We need it
334 ## because we have to create *two* summaries, one for test-suite.log,
335 ## and a possibly-colorized one for console output.
336         create_testsuite_report () \
337         { \
338           result_count $$1 "TOTAL:" $$all   "$$brg"; \
339           result_count $$1 "PASS: " $$pass  "$$grn"; \
340           result_count $$1 "SKIP: " $$skip  "$$blu"; \
341           result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
342           result_count $$1 "FAIL: " $$fail  "$$red"; \
343           result_count $$1 "XPASS:" $$xpass "$$red"; \
344           result_count $$1 "ERROR:" $$error "$$mgn"; \
345         }; \
346 ## Write "global" testsuite log.
347         {                                                               \
348           echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" |       \
349             $(am__rst_title);                                           \
350           create_testsuite_report --no-color;                           \
351           echo;                                                         \
352           echo ".. contents:: :depth: 2";                               \
353           echo;                                                         \
354           for b in $$bases; do echo $$b; done                           \
355             | $(am__create_global_log);                                 \
356         } >$(TEST_SUITE_LOG).tmp || exit 1;                             \
357         mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG);                     \
358 ## Emit the test summary on the console.
359         if $$success; then                                              \
360           col="$$grn";                                                  \
361          else                                                           \
362           col="$$red";                                                  \
363           test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG);               \
364         fi;                                                             \
365 ## Multi line coloring is problematic with "less -R", so we really need
366 ## to color each line individually.
367         echo "$${col}$$br$${std}";                                      \
368         echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}";   \
369         echo "$${col}$$br$${std}";                                      \
370 ## This is expected to go to the console, so it might have to be colorized.
371         create_testsuite_report --maybe-color;                          \
372         echo "$$col$$br$$std";                                          \
373         if $$success; then :; else                                      \
374           echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}";         \
375           if test -n "$(PACKAGE_BUGREPORT)"; then                       \
376             echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
377           fi;                                                           \
378           echo "$$col$$br$$std";                                        \
379         fi;                                                             \
380 ## Be sure to exit with the proper exit status.  The use of "exit 1" below
381 ## is required to work around a FreeBSD make bug (present only when running
382 ## in concurrent mode).  See automake bug#9245:
383 ##  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9245>
384 ## and FreeBSD PR bin/159730:
385 ##  <http://www.freebsd.org/cgi/query-pr.cgi?pr=159730>.
386         $$success || exit 1
387
388 RECHECK_LOGS = $(TEST_LOGS)
389
390 ## ------------------------------------------ ##
391 ## Running all tests, or rechecking failures. ##
392 ## ------------------------------------------ ##
393
394 check-TESTS recheck:
395 ## If we are running "make recheck", it's not the user which can decide
396 ## which tests to consider for re-execution, so we must ignore the value
397 ## of $(RECHECK_LOGS).
398 ## Here and below, we expand $(RECHECK_LOGS) only once, to avoid exceeding
399 ## line length limits.
400         @if test $@ != recheck; then \
401            list='$(RECHECK_LOGS)'; \
402            test -z "$$list" || rm -f $$list; \
403          fi
404         @if test $@ != recheck; then \
405            list='$(RECHECK_LOGS:.log=.trs)'; \
406            test -z "$$list" || rm -f $$list; \
407          fi
408 ## We always have to remove TEST_SUITE_LOG, to ensure its rule is run
409 ## in any case even in lazy mode: otherwise, if no test needs rerunning,
410 ## or a prior run plus reruns all happen within the same timestamp (can
411 ## happen with a prior "make TESTS=<subset>"), then we get no log output.
412 ## OTOH, this means that, in the rule for '$(TEST_SUITE_LOG)', we
413 ## cannot use '$?' to compute the set of lazily rerun tests, lest
414 ## we rely on .PHONY to work portably.
415         @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
416         @$(am__set_TESTS_bases); \
417         if test $@ = recheck; then \
418 ## If running a "make recheck", we must only consider tests that had an
419 ## unexpected outcome (FAIL or XPASS) in the earlier run.
420           bases=`for i in $$bases; do echo $$i; done \
421                    | $(am__list_recheck_tests)` || exit 1; \
422         fi; \
423         log_list=`for i in $$bases; do echo $$i.log; done`; \
424         trs_list=`for i in $$bases; do echo $$i.trs; done`; \
425 ## Remove newlines and normalize whitespace, being careful to avoid extra
426 ## whitespace in the definition of $log_list, since its value will be
427 ## passed to the recursive make invocation below through the TEST_LOGS
428 ## macro, and leading/trailing white space in a make macro definition can
429 ## be problematic.  In this particular case, trailing white space is known
430 ## to have caused segmentation faults on Solaris 10 XPG4 make:
431         log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
432 ## Under "make recheck", remove the .log and .trs files associated
433 ## with the files to recheck, so that those will be rerun by the
434 ## "make test-suite.log" recursive invocation below.  But use a proper
435 ## hack to avoid extra files removal when running under "make -n".
436         if test $@ != recheck || $(am__make_dryrun); then :; else \
437           test -z "$$log_list" || rm -f $$log_list; \
438           test -z "$$trs_list" || rm -f $$trs_list; \
439         fi; \
440         $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"
441
442 ## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc.
443 ## It must also depend on the 'all' target.  See automake bug#11252.
444 recheck: all %CHECK_DEPS%
445
446 AM_RECURSIVE_TARGETS += check recheck
447
448 .PHONY: recheck
449
450 else !%?PARALLEL_TESTS%
451
452 check-TESTS: $(TESTS)
453         @failed=0; all=0; xfail=0; xpass=0; skip=0; \
454         srcdir=$(srcdir); export srcdir; \
455 ## Make sure Solaris VPATH-expands all members of this list, even
456 ## the first and the last one; thus the spaces around $(TESTS)
457         list=' $(TESTS) '; \
458         $(am__tty_colors); \
459         if test -n "$$list"; then \
460           for tst in $$list; do \
461             if test -f ./$$tst; then dir=./; \
462 ## Note: Solaris 2.7 seems to expand TESTS using VPATH.  That's
463 ## why we also try 'dir='.
464             elif test -f $$tst; then dir=; \
465             else dir="$(srcdir)/"; fi; \
466             if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \
467 ## Success
468               all=`expr $$all + 1`; \
469               case " $(XFAIL_TESTS) " in \
470               *[\ \     ]$$tst[\ \      ]*) \
471                 xpass=`expr $$xpass + 1`; \
472                 failed=`expr $$failed + 1`; \
473                 col=$$red; res=XPASS; \
474               ;; \
475               *) \
476                 col=$$grn; res=PASS; \
477               ;; \
478               esac; \
479             elif test $$? -ne 77; then \
480 ## Failure
481               all=`expr $$all + 1`; \
482               case " $(XFAIL_TESTS) " in \
483               *[\ \     ]$$tst[\ \      ]*) \
484                 xfail=`expr $$xfail + 1`; \
485                 col=$$lgn; res=XFAIL; \
486               ;; \
487               *) \
488                 failed=`expr $$failed + 1`; \
489                 col=$$red; res=FAIL; \
490               ;; \
491               esac; \
492             else \
493 ## Skipped
494               skip=`expr $$skip + 1`; \
495               col=$$blu; res=SKIP; \
496             fi; \
497             echo "$${col}$$res$${std}: $$tst"; \
498           done; \
499 ## Prepare the banner
500           if test "$$all" -eq 1; then \
501             tests="test"; \
502             All=""; \
503           else \
504             tests="tests"; \
505             All="All "; \
506           fi; \
507           if test "$$failed" -eq 0; then \
508             if test "$$xfail" -eq 0; then \
509               banner="$$All$$all $$tests passed"; \
510             else \
511               if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
512               banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
513             fi; \
514           else \
515             if test "$$xpass" -eq 0; then \
516               banner="$$failed of $$all $$tests failed"; \
517             else \
518               if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
519               banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
520             fi; \
521           fi; \
522 ## DASHES should contain the largest line of the banner.
523           dashes="$$banner"; \
524           skipped=""; \
525           if test "$$skip" -ne 0; then \
526             if test "$$skip" -eq 1; then \
527               skipped="($$skip test was not run)"; \
528             else \
529               skipped="($$skip tests were not run)"; \
530             fi; \
531             test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
532               dashes="$$skipped"; \
533           fi; \
534           report=""; \
535           if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
536             report="Please report to $(PACKAGE_BUGREPORT)"; \
537             test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
538               dashes="$$report"; \
539           fi; \
540           dashes=`echo "$$dashes" | sed s/./=/g`; \
541           if test "$$failed" -eq 0; then \
542             col="$$grn"; \
543           else \
544             col="$$red"; \
545           fi; \
546 ## Multi line coloring is problematic with "less -R", so we really need
547 ## to color each line individually.
548           echo "$${col}$$dashes$${std}"; \
549           echo "$${col}$$banner$${std}"; \
550           test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
551           test -z "$$report" || echo "$${col}$$report$${std}"; \
552           echo "$${col}$$dashes$${std}"; \
553           test "$$failed" -eq 0; \
554         else :; fi
555
556 endif !%?PARALLEL_TESTS%