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