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