cosmetics: fix typos and references in comments
[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 drivers 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       printf "\n"; \
160     }; \
161 ## Don't leak open file descriptors, as this could cause serious
162 ## problems when there are many tests (yes, even on Linux).
163   close ($$0 ".trs"); \
164   close ($$0 ".log"); \
165 }'
166
167 # Restructured Text title.
168 am__rst_title = { sed 's/.*/   &   /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
169
170 # Solaris 10 'make', and several other traditional 'make' implementations,
171 # pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
172 # by disabling -e (using the XSI extension "set +e") if it's set.
173 am__sh_e_setup = case $$- in *e*) set +e;; esac
174
175 # Default flags passed to test drivers.
176 am__common_driver_flags = \
177   --color-tests "$$am__color_tests" \
178   --enable-hard-errors "$$am__enable_hard_errors" \
179   --expect-failure "$$am__expect_failure"
180
181 # To be inserted before the command running the test.  Creates the
182 # directory for the log if needed.  Stores in $dir the directory
183 # containing $f, in $tst the test, in $log the log.  Executes the
184 # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
185 # passes TESTS_ENVIRONMENT.  Set up options for the wrapper that
186 # will run the test scripts (or their associated LOG_COMPILER, if
187 # thy have one).
188 am__check_pre =                                         \
189 $(am__sh_e_setup);                                      \
190 $(am__vpath_adj_setup) $(am__vpath_adj)                 \
191 $(am__tty_colors);                                      \
192 srcdir=$(srcdir); export srcdir;                        \
193 case "$@" in                                            \
194   */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;;    \
195     *) am__odir=.;;                                     \
196 esac;                                                   \
197 test "x$$am__odir" = x"." || test -d "$$am__odir"       \
198   || $(MKDIR_P) "$$am__odir" || exit $$?;               \
199 if test -f "./$$f"; then dir=./;                        \
200 elif test -f "$$f"; then dir=;                          \
201 else dir="$(srcdir)/"; fi;                              \
202 tst=$$dir$$f; log='$@';                                 \
203 if test -n '$(DISABLE_HARD_ERRORS)'; then               \
204   am__enable_hard_errors=no;                            \
205 else                                                    \
206   am__enable_hard_errors=yes;                           \
207 fi;                                                     \
208 ## The use of $dir below is required to account for VPATH
209 ## rewriting done by Sun make.
210 case " $(XFAIL_TESTS) " in                              \
211   *[\ \ ]$$f[\ \        ]* | *[\ \      ]$$dir$$f[\ \   ]*) \
212     am__expect_failure=yes;;                            \
213   *)                                                    \
214     am__expect_failure=no;;                             \
215 esac;                                                   \
216 $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
217
218 # A shell command to get the names of the tests scripts with any registered
219 # extension removed (i.e., equivalently, the names of the test logs, with
220 # the '.log' extension removed).  The result is saved in the shell variable
221 # '$bases'.  This honors runtime overriding of TESTS and TEST_LOGS.  Sadly,
222 # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
223 # since that might cause problem with VPATH rewrites for suffix-less tests.
224 # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
225 am__set_TESTS_bases = \
226   bases='$(TEST_LOGS)'; \
227   bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
228 ## Trim away any extra whitespace.  This has already proved useful
229 ## in avoiding weird bug on lesser make implementations.  It also
230 ## works around the GNU make 3.80 bug where trailing whitespace in
231 ## "TESTS = foo.test $(empty)" causes $(TESTS_LOGS)  to erroneously
232 ## expand to "foo.log .log".
233   bases=`echo $$bases`
234
235 # Recover from deleted '.trs' file; this should ensure that
236 # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
237 # both 'foo.log' and 'foo.trs'.  Break the recipe in two subshells
238 # to avoid problems with "make -n".
239 .log.trs:
240         rm -f $< $@
241         $(MAKE) $(AM_MAKEFLAGS) $<
242
243 # Leading 'am--fnord' is there to ensure the list of targets does not
244 # exand to empty, as could happen e.g. with make check TESTS=''.
245 am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
246 am--force-recheck:
247         @:
248
249 $(TEST_SUITE_LOG): $(TEST_LOGS)
250         @$(am__set_TESTS_bases); \
251 ## Helper shell function, tells whether a path refers to an existing,
252 ## regular, readable file.
253         am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
254 ## We need to ensures that all the required '.trs' and '.log' files will
255 ## be present and readable.  The direct dependencies of $(TEST_SUITE_LOG)
256 ## only ensure that all the '.log' files exists; they don't ensure that
257 ## the '.log' files are readable, and worse, they don't ensure that the
258 ## '.trs' files even exist.
259         redo_bases=`for i in $$bases; do \
260                       am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
261                     done`; \
262         if test -n "$$redo_bases"; then \
263 ## Uh-oh, either some '.log' files were unreadable, or some '.trs' files
264 ## were missing (or unreadable).  We need to re-run the corresponding
265 ## tests in order to re-create them.
266           redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
267           redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
268           if $(am__make_dryrun); then :; else \
269 ## Break "rm -f" into two calls to minimize the possibility of exceeding
270 ## command line length limits.
271             rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
272           fi; \
273         fi; \
274 ## Use a trick to to ensure that we don't go into an infinite recursion
275 ## in case a test log in $(TEST_LOGS) is the same as $(TEST_SUITE_LOG).
276 ## Yes, this has already happened in practice.  Sigh!
277         if test -n "$$am__remaking_logs"; then \
278           echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
279                "recursion detected" >&2; \
280         else \
281           am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
282         fi; \
283         if $(am__make_dryrun); then :; else \
284 ## Sanity check: each unreadable or non-existent test result file should
285 ## has been properly remade at this point, as should the corresponding log
286 ## file.
287           st=0;  \
288           errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
289           for i in $$redo_bases; do \
290             test -f $$i.trs && test -r $$i.trs \
291               || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
292             test -f $$i.log && test -r $$i.log \
293               || { echo "$$errmsg $$i.log" >&2; st=1; }; \
294           done; \
295           test $$st -eq 0 || exit 1; \
296         fi
297 ## We need a new subshell to work portably with "make -n", since the
298 ## previous part of the recipe contained a $(MAKE) invocation.
299         @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
300         ws='[   ]'; \
301 ## List of test result files.
302         results=`for b in $$bases; do echo $$b.trs; done`; \
303         test -n "$$results" || results=/dev/null; \
304 ## Prepare data for the test suite summary.  These do not take into account
305 ## unreadable test results, but they'll be appropriately updated later if
306 ## needed.
307         all=`  grep "^$$ws*:test-result:"           $$results | wc -l`; \
308         pass=` grep "^$$ws*:test-result:$$ws*PASS"  $$results | wc -l`; \
309         fail=` grep "^$$ws*:test-result:$$ws*FAIL"  $$results | wc -l`; \
310         skip=` grep "^$$ws*:test-result:$$ws*SKIP"  $$results | wc -l`; \
311         xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
312         xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
313         error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
314 ## Whether the testsuite was successful or not.
315         if test `expr $$fail + $$xpass + $$error` -eq 0; then \
316           success=true; \
317         else \
318           success=false; \
319         fi; \
320 ## Make $br a line of exactly 76 '=' characters, that will be used to
321 ## enclose the testsuite summary report when displayed on the console.
322         br='==================='; br=$$br$$br$$br$$br; \
323 ## When writing the test summary to the console, we want to color a line
324 ## reporting the count of some result *only* if at least one test
325 ## experienced such a result.  This function is handy in this regard.
326         result_count () \
327         { \
328             if test x"$$1" = x"--maybe-color"; then \
329               maybe_colorize=yes; \
330             elif test x"$$1" = x"--no-color"; then \
331               maybe_colorize=no; \
332             else \
333               echo "$@: invalid 'result_count' usage" >&2; exit 4; \
334             fi; \
335             shift; \
336             desc=$$1 count=$$2; \
337             if test $$maybe_colorize = yes && test $$count -gt 0; then \
338               color_start=$$3 color_end=$$std; \
339             else \
340               color_start= color_end=; \
341             fi; \
342             echo "$${color_start}# $$desc $$count$${color_end}"; \
343         }; \
344 ## A shell function that creates the testsuite summary.  We need it
345 ## because we have to create *two* summaries, one for test-suite.log,
346 ## and a possibly-colorized one for console output.
347         create_testsuite_report () \
348         { \
349           result_count $$1 "TOTAL:" $$all   "$$brg"; \
350           result_count $$1 "PASS: " $$pass  "$$grn"; \
351           result_count $$1 "SKIP: " $$skip  "$$blu"; \
352           result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
353           result_count $$1 "FAIL: " $$fail  "$$red"; \
354           result_count $$1 "XPASS:" $$xpass "$$red"; \
355           result_count $$1 "ERROR:" $$error "$$mgn"; \
356         }; \
357 ## Write "global" testsuite log.
358         {                                                               \
359           echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" |       \
360             $(am__rst_title);                                           \
361           create_testsuite_report --no-color;                           \
362           echo;                                                         \
363           echo ".. contents:: :depth: 2";                               \
364           echo;                                                         \
365           for b in $$bases; do echo $$b; done                           \
366             | $(am__create_global_log);                                 \
367         } >$(TEST_SUITE_LOG).tmp || exit 1;                             \
368         mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG);                     \
369 ## Emit the test summary on the console.
370         if $$success; then                                              \
371           col="$$grn";                                                  \
372          else                                                           \
373           col="$$red";                                                  \
374           test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG);               \
375         fi;                                                             \
376 ## Multi line coloring is problematic with "less -R", so we really need
377 ## to color each line individually.
378         echo "$${col}$$br$${std}";                                      \
379         echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}";   \
380         echo "$${col}$$br$${std}";                                      \
381 ## This is expected to go to the console, so it might have to be colorized.
382         create_testsuite_report --maybe-color;                          \
383         echo "$$col$$br$$std";                                          \
384         if $$success; then :; else                                      \
385           echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}";         \
386           if test -n "$(PACKAGE_BUGREPORT)"; then                       \
387             echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
388           fi;                                                           \
389           echo "$$col$$br$$std";                                        \
390         fi;                                                             \
391 ## Be sure to exit with the proper exit status.  The use of "exit 1" below
392 ## is required to work around a FreeBSD make bug (present only when running
393 ## in concurrent mode).  See automake bug#9245:
394 ##  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9245>
395 ## and FreeBSD PR bin/159730:
396 ##  <http://www.freebsd.org/cgi/query-pr.cgi?pr=159730>.
397         $$success || exit 1
398
399 RECHECK_LOGS = $(TEST_LOGS)
400
401 ## ------------------------------------------ ##
402 ## Running all tests, or rechecking failures. ##
403 ## ------------------------------------------ ##
404
405 check-TESTS:
406         @list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
407         @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
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         @set +e; $(am__set_TESTS_bases); \
417         log_list=`for i in $$bases; do echo $$i.log; done`; \
418         trs_list=`for i in $$bases; do echo $$i.trs; done`; \
419 ## Remove newlines and normalize whitespace.  Trailing (and possibly
420 ## leading) whitespace is known to cause segmentation faults on
421 ## Solaris 10 XPG4 make.
422         log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
423         $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
424 ## Be sure to exit with the proper exit status (automake bug#9245).  See
425 ## comments in the recipe of $(TEST_SUITE_LOG) above for more information.
426         exit $$?;
427
428 ## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc.
429 ## It must also depend on the 'all' target.  See automake bug#11252.
430 recheck: all %CHECK_DEPS%
431 ## See comments above in the check-TESTS recipe for why remove
432 ## $(TEST_SUITE_LOG) here.
433         @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
434         @set +e; $(am__set_TESTS_bases); \
435 ## We must only consider tests that had an unexpected outcome (FAIL
436 ## or XPASS) in the earlier run.
437         bases=`for i in $$bases; do echo $$i; done \
438                  | $(am__list_recheck_tests)` || exit 1; \
439         log_list=`for i in $$bases; do echo $$i.log; done`; \
440 ## Remove newlines and normalize whitespace.  Trailing (and possibly
441 ## leading) whitespace is known to cause segmentation faults on
442 ## Solaris 10 XPG4 make.
443         log_list=`echo $$log_list`; \
444 ## Move the '.log' and '.trs' files associated with the tests to be
445 ## re-run out of the way, so that those tests will be re-run by the
446 ## "make test-suite.log" recursive invocation below.
447 ## Two tricky requirements:
448 ##   - we must avoid extra files removal when running under "make -n";
449 ##   - in case the test is a compiled program whose compilation fails,
450 ##     we must ensure that any '.log' and '.trs' file referring to such
451 ##     test are preserved, so that future "make recheck" invocations
452 ##     will still try to re-compile and re-run it (automake bug#11791).
453 ## The tricky recursive make invocation below should cater to such
454 ## requirements.
455         $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
456                 am__force_recheck=am--force-recheck \
457                 TEST_LOGS="$$log_list"; \
458 ## Be sure to exit with the proper exit status (automake bug#9245).  See
459 ## comments in the recipe of $(TEST_SUITE_LOG) above for more information.
460         exit $$?
461
462 AM_RECURSIVE_TARGETS += check recheck
463
464 .PHONY: recheck
465
466 else !%?PARALLEL_TESTS%
467
468 check-TESTS: $(TESTS)
469         @failed=0; all=0; xfail=0; xpass=0; skip=0; \
470         srcdir=$(srcdir); export srcdir; \
471 ## Make sure Solaris VPATH-expands all members of this list, even
472 ## the first and the last one; thus the spaces around $(TESTS)
473         list=' $(TESTS) '; \
474         $(am__tty_colors); \
475         if test -n "$$list"; then \
476           for tst in $$list; do \
477             if test -f ./$$tst; then dir=./; \
478 ## Note: Solaris 2.7 seems to expand TESTS using VPATH.  That's
479 ## why we also try 'dir='.
480             elif test -f $$tst; then dir=; \
481             else dir="$(srcdir)/"; fi; \
482             if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \
483 ## Success
484               all=`expr $$all + 1`; \
485               case " $(XFAIL_TESTS) " in \
486               *[\ \     ]$$tst[\ \      ]*) \
487                 xpass=`expr $$xpass + 1`; \
488                 failed=`expr $$failed + 1`; \
489                 col=$$red; res=XPASS; \
490               ;; \
491               *) \
492                 col=$$grn; res=PASS; \
493               ;; \
494               esac; \
495             elif test $$? -ne 77; then \
496 ## Failure
497               all=`expr $$all + 1`; \
498               case " $(XFAIL_TESTS) " in \
499               *[\ \     ]$$tst[\ \      ]*) \
500                 xfail=`expr $$xfail + 1`; \
501                 col=$$lgn; res=XFAIL; \
502               ;; \
503               *) \
504                 failed=`expr $$failed + 1`; \
505                 col=$$red; res=FAIL; \
506               ;; \
507               esac; \
508             else \
509 ## Skipped
510               skip=`expr $$skip + 1`; \
511               col=$$blu; res=SKIP; \
512             fi; \
513             echo "$${col}$$res$${std}: $$tst"; \
514           done; \
515 ## Prepare the banner
516           if test "$$all" -eq 1; then \
517             tests="test"; \
518             All=""; \
519           else \
520             tests="tests"; \
521             All="All "; \
522           fi; \
523           if test "$$failed" -eq 0; then \
524             if test "$$xfail" -eq 0; then \
525               banner="$$All$$all $$tests passed"; \
526             else \
527               if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
528               banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
529             fi; \
530           else \
531             if test "$$xpass" -eq 0; then \
532               banner="$$failed of $$all $$tests failed"; \
533             else \
534               if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
535               banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
536             fi; \
537           fi; \
538 ## DASHES should contain the largest line of the banner.
539           dashes="$$banner"; \
540           skipped=""; \
541           if test "$$skip" -ne 0; then \
542             if test "$$skip" -eq 1; then \
543               skipped="($$skip test was not run)"; \
544             else \
545               skipped="($$skip tests were not run)"; \
546             fi; \
547             test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
548               dashes="$$skipped"; \
549           fi; \
550           report=""; \
551           if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
552             report="Please report to $(PACKAGE_BUGREPORT)"; \
553             test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
554               dashes="$$report"; \
555           fi; \
556           dashes=`echo "$$dashes" | sed s/./=/g`; \
557           if test "$$failed" -eq 0; then \
558             col="$$grn"; \
559           else \
560             col="$$red"; \
561           fi; \
562 ## Multi line coloring is problematic with "less -R", so we really need
563 ## to color each line individually.
564           echo "$${col}$$dashes$${std}"; \
565           echo "$${col}$$banner$${std}"; \
566           test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
567           test -z "$$report" || echo "$${col}$$report$${std}"; \
568           echo "$${col}$$dashes$${std}"; \
569           test "$$failed" -eq 0; \
570         else :; fi
571
572 endif !%?PARALLEL_TESTS%