check.am 22 KB

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