From: Stefano Lattarini Date: Wed, 25 Jul 2012 22:20:03 +0000 (+0200) Subject: tests: simplify sourcing of helper shell files X-Git-Tag: v1.12.3~31^2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42fb45b7d98e9155d05f056609452f0ff2385333;p=thirdparty%2Fautomake.git tests: simplify sourcing of helper shell files Now that the early $PATH setup in both 'runtest' and AM_TESTS_ENVIRONMENT allow the '.' built-in to find to-be-sourced shell scripts in the 't/ax/' directory automatically, we can simplify several usages like: . "$am_testauxdir"/foo.sh to just: . foo.sh Also, because our test scripts run with the 'errexit' flag active, and because POSIX mandates that, when the '.' built-in is used, ... if no readable file is found, a non-interactive shell shall abort ... we can further simplify usages like: . "$am_testauxdir"/foo.sh || fatal_ "sourcing foo.sh" once again to to just: . foo.sh * ./defs, several tests: Adjusted. Signed-off-by: Stefano Lattarini --- diff --git a/defs b/defs index f69b7800c..01e90b832 100644 --- a/defs +++ b/defs @@ -20,4 +20,4 @@ # Source the actual test initialization and setup code, and return # control to the test script that is sourcing us. -. "$am_testauxdir/test-init.sh" +. test-init.sh diff --git a/t/tap-ambiguous-directive.sh b/t/tap-ambiguous-directive.sh index 74f258fb7..aaf2cd06d 100755 --- a/t/tap-ambiguous-directive.sh +++ b/t/tap-ambiguous-directive.sh @@ -20,7 +20,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test < all.test <<'END' 1..14 diff --git a/t/tap-bailout-and-logging.sh b/t/tap-bailout-and-logging.sh index 5b49c33cf..f87ccb361 100755 --- a/t/tap-bailout-and-logging.sh +++ b/t/tap-bailout-and-logging.sh @@ -20,7 +20,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test < a.test < Makefile.am < exit.test << 'END' #!/bin/sh diff --git a/t/tap-bailout-suppress-later-diagnostic.sh b/t/tap-bailout-suppress-later-diagnostic.sh index 69ac88f59..54e21fdc4 100755 --- a/t/tap-bailout-suppress-later-diagnostic.sh +++ b/t/tap-bailout-suppress-later-diagnostic.sh @@ -20,7 +20,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh echo AM_TEST_LOG_DRIVER_FLAGS = --comments >> Makefile diff --git a/t/tap-bailout-suppress-later-errors.sh b/t/tap-bailout-suppress-later-errors.sh index cd9aa146b..bd90f8dbd 100755 --- a/t/tap-bailout-suppress-later-errors.sh +++ b/t/tap-bailout-suppress-later-errors.sh @@ -20,7 +20,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh # Various errors that can all be squashed into a single test script. cat > foo.test << 'END' diff --git a/t/tap-bailout.sh b/t/tap-bailout.sh index 91dfd2442..08f12fdf0 100755 --- a/t/tap-bailout.sh +++ b/t/tap-bailout.sh @@ -19,7 +19,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh : > exp diff --git a/t/tap-color.sh b/t/tap-color.sh index 2fa45d184..a3fab2f94 100755 --- a/t/tap-color.sh +++ b/t/tap-color.sh @@ -36,7 +36,7 @@ TESTS = all.test skip.test bail.test badplan.test noplan.test \ few.test many.test order.test afterlate.test END -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test << 'END' 1..5 diff --git a/t/tap-deps.sh b/t/tap-deps.sh index ee76e938f..8e84a63bc 100755 --- a/t/tap-deps.sh +++ b/t/tap-deps.sh @@ -26,7 +26,7 @@ b.log: a.log c.log: b.log END -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > a.test << 'END' #!/bin/sh diff --git a/t/tap-diagnostic.sh b/t/tap-diagnostic.sh index 10b4f5b01..fc00af969 100755 --- a/t/tap-diagnostic.sh +++ b/t/tap-diagnostic.sh @@ -20,7 +20,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh metacharacters=\''"\$!&()[]<>#;^?*' diff --git a/t/tap-empty-diagnostic.sh b/t/tap-empty-diagnostic.sh index c92a152aa..ae0deef3c 100755 --- a/t/tap-empty-diagnostic.sh +++ b/t/tap-empty-diagnostic.sh @@ -19,7 +19,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh sed 's/\$$//' > all.test < empty.test diff --git a/t/tap-escape-directive-2.sh b/t/tap-escape-directive-2.sh index 30806635d..49c63981c 100755 --- a/t/tap-escape-directive-2.sh +++ b/t/tap-escape-directive-2.sh @@ -19,7 +19,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test <<'END' 1..8 diff --git a/t/tap-escape-directive.sh b/t/tap-escape-directive.sh index 2fb1ad9fb..9b59c3d8b 100755 --- a/t/tap-escape-directive.sh +++ b/t/tap-escape-directive.sh @@ -19,7 +19,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test <<'END' 1..2 diff --git a/t/tap-exit.sh b/t/tap-exit.sh index 09493841f..c9a9823b9 100755 --- a/t/tap-exit.sh +++ b/t/tap-exit.sh @@ -34,7 +34,7 @@ done chmod a+x *.test -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh $MAKE check >stdout && { cat stdout; exit 1; } cat stdout diff --git a/t/tap-fancy.sh b/t/tap-fancy.sh index f879cceab..9ca50217a 100755 --- a/t/tap-fancy.sh +++ b/t/tap-fancy.sh @@ -19,7 +19,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh # # From manpage Test::Harness::TAP(3): diff --git a/t/tap-fancy2.sh b/t/tap-fancy2.sh index 88ef41209..d69cf5035 100755 --- a/t/tap-fancy2.sh +++ b/t/tap-fancy2.sh @@ -19,7 +19,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh # # From manpage Test::Harness::TAP(3): diff --git a/t/tap-global-log.sh b/t/tap-global-log.sh index 85db2cb34..31e1ccb4f 100755 --- a/t/tap-global-log.sh +++ b/t/tap-global-log.sh @@ -19,7 +19,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > ok.test << 'END' 1..5 diff --git a/t/tap-global-result.sh b/t/tap-global-result.sh index ba232c3b3..528c7bb5e 100755 --- a/t/tap-global-result.sh +++ b/t/tap-global-result.sh @@ -20,7 +20,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > ok.test < all.test < Makefile.am chmod a+x foo.test -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh $MAKE check >stdout && { cat stdout; exit 1; } cat stdout diff --git a/t/tap-msg0-bailout.sh b/t/tap-msg0-bailout.sh index cf8918c74..bdda865a0 100755 --- a/t/tap-msg0-bailout.sh +++ b/t/tap-msg0-bailout.sh @@ -21,7 +21,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh echo 'Bail out! 0' > a.test echo 'Bail out! 0.0' > b.test diff --git a/t/tap-msg0-directive.sh b/t/tap-msg0-directive.sh index 9859e7290..9be3816d0 100755 --- a/t/tap-msg0-directive.sh +++ b/t/tap-msg0-directive.sh @@ -19,7 +19,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test << 'END' 1..3 diff --git a/t/tap-msg0-misc.sh b/t/tap-msg0-misc.sh index 166b78534..d7751d7d2 100755 --- a/t/tap-msg0-misc.sh +++ b/t/tap-msg0-misc.sh @@ -20,7 +20,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test << 'END' 1..14 diff --git a/t/tap-msg0-planskip.sh b/t/tap-msg0-planskip.sh index 7602affb1..24e569c1f 100755 --- a/t/tap-msg0-planskip.sh +++ b/t/tap-msg0-planskip.sh @@ -20,7 +20,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh echo '1..0 # SKIP 0' > a.test echo '1..0 # SKIP 0.0' > b.test diff --git a/t/tap-msg0-result.sh b/t/tap-msg0-result.sh index a1174bcde..f55b0559e 100755 --- a/t/tap-msg0-result.sh +++ b/t/tap-msg0-result.sh @@ -19,7 +19,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test << 'END' 1..10 diff --git a/t/tap-negative-numbers.sh b/t/tap-negative-numbers.sh index 765442a5e..fbf54be53 100755 --- a/t/tap-negative-numbers.sh +++ b/t/tap-negative-numbers.sh @@ -20,7 +20,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test <<'END' 1..7 diff --git a/t/tap-no-disable-hard-error.sh b/t/tap-no-disable-hard-error.sh index e9a109151..dc4cad34a 100755 --- a/t/tap-no-disable-hard-error.sh +++ b/t/tap-no-disable-hard-error.sh @@ -26,7 +26,7 @@ TEST_LOG_COMPILER = cat TESTS = bail.test few.test noplan.test END -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > bail.test < all.test < prefixes <<'END' A diff --git a/t/tap-no-spurious-summary.sh b/t/tap-no-spurious-summary.sh index 85e1bbaa2..13c577c7a 100755 --- a/t/tap-no-spurious-summary.sh +++ b/t/tap-no-spurious-summary.sh @@ -20,7 +20,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test <<'END' 1..1 diff --git a/t/tap-no-spurious.sh b/t/tap-no-spurious.sh index ebb58cf87..bc98a0900 100755 --- a/t/tap-no-spurious.sh +++ b/t/tap-no-spurious.sh @@ -20,7 +20,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh echo 1..5 > all.test diff --git a/t/tap-not-ok-skip.sh b/t/tap-not-ok-skip.sh index f73bb0395..bbb9a032a 100755 --- a/t/tap-not-ok-skip.sh +++ b/t/tap-not-ok-skip.sh @@ -20,7 +20,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test <<'END' 1..4 diff --git a/t/tap-number-wordboundary.sh b/t/tap-number-wordboundary.sh index 219a15918..2d15121c3 100755 --- a/t/tap-number-wordboundary.sh +++ b/t/tap-number-wordboundary.sh @@ -20,7 +20,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test <<'END' 1..5 diff --git a/t/tap-numbers-leading-zero.sh b/t/tap-numbers-leading-zero.sh index fd1c3b62d..620addfb5 100755 --- a/t/tap-numbers-leading-zero.sh +++ b/t/tap-numbers-leading-zero.sh @@ -19,7 +19,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh do_checks () { diff --git a/t/tap-numeric-description.sh b/t/tap-numeric-description.sh index 60292a76c..61bc25241 100755 --- a/t/tap-numeric-description.sh +++ b/t/tap-numeric-description.sh @@ -18,7 +18,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh # Some random numbers to be used as test names. The definitions below are # selected so that $x != for every n >= 1. We can't use positional diff --git a/t/tap-out-of-order.sh b/t/tap-out-of-order.sh index e884a1e07..ff0e80614 100755 --- a/t/tap-out-of-order.sh +++ b/t/tap-out-of-order.sh @@ -19,7 +19,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > a.test <> Makefile.am done -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh st=0 $MAKE check || st=$? diff --git a/t/tap-passthrough.sh b/t/tap-passthrough.sh index 993e750e8..e2eae177f 100755 --- a/t/tap-passthrough.sh +++ b/t/tap-passthrough.sh @@ -24,7 +24,7 @@ weirdchars=\''"\$@!&()[]<>#;,:.^?*/' -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh # # Only successful tests. diff --git a/t/tap-plan-corner.sh b/t/tap-plan-corner.sh index 86ba401e8..8fc0c7e0f 100755 --- a/t/tap-plan-corner.sh +++ b/t/tap-plan-corner.sh @@ -19,7 +19,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh # ------------------------------------------------------------------------- diff --git a/t/tap-plan-errors.sh b/t/tap-plan-errors.sh index 21fd01312..4b6a4105f 100755 --- a/t/tap-plan-errors.sh +++ b/t/tap-plan-errors.sh @@ -25,7 +25,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh my_check () { diff --git a/t/tap-plan-leading-zero.sh b/t/tap-plan-leading-zero.sh index 84047a664..dc1923c9f 100755 --- a/t/tap-plan-leading-zero.sh +++ b/t/tap-plan-leading-zero.sh @@ -21,7 +21,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > a.test < a.test < top1.test < foo.test < top.test <> Makefile diff --git a/t/tap-planskip-badexit.sh b/t/tap-planskip-badexit.sh index 1b208648f..0bcc7e315 100755 --- a/t/tap-planskip-badexit.sh +++ b/t/tap-planskip-badexit.sh @@ -22,7 +22,7 @@ echo TESTS = one.test two.test > Makefile.am -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > one.test <<'END' #!/bin/sh diff --git a/t/tap-planskip-bailout.sh b/t/tap-planskip-bailout.sh index 255443d7b..6558a6970 100755 --- a/t/tap-planskip-bailout.sh +++ b/t/tap-planskip-bailout.sh @@ -20,7 +20,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test < foo.test < all.test < foo.test < all.test < foo.test <#;^?*/@%=,.:' diff --git a/t/tap-realtime.sh b/t/tap-realtime.sh index ecd3bef44..92d78313b 100755 --- a/t/tap-realtime.sh +++ b/t/tap-realtime.sh @@ -54,7 +54,7 @@ fi cat > Makefile.am << 'END' TESTS = all.test END -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test <<'END' #! /bin/sh diff --git a/t/tap-recheck-logs.sh b/t/tap-recheck-logs.sh index e774f7310..1b7597e33 100755 --- a/t/tap-recheck-logs.sh +++ b/t/tap-recheck-logs.sh @@ -25,7 +25,7 @@ TESTS = foo.test bar.test baz.test baz.log: zardoz END -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh : > zardoz diff --git a/t/tap-result-comment.sh b/t/tap-result-comment.sh index 42907518e..714f328fd 100755 --- a/t/tap-result-comment.sh +++ b/t/tap-result-comment.sh @@ -19,7 +19,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh cat > all.test < a.test < all.test < stub.tap < all.test < all.test <<'END' 1..7 diff --git a/t/tap-xfail-tests.sh b/t/tap-xfail-tests.sh index aa86dca5d..94ae1c906 100755 --- a/t/tap-xfail-tests.sh +++ b/t/tap-xfail-tests.sh @@ -19,7 +19,7 @@ . ./defs || exit 1 -. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +. tap-setup.sh echo 'XFAIL_TESTS = $(TESTS)' >> Makefile diff --git a/t/testsuite-summary-color.sh b/t/testsuite-summary-color.sh index e1a747154..a0effd689 100755 --- a/t/testsuite-summary-color.sh +++ b/t/testsuite-summary-color.sh @@ -21,7 +21,7 @@ use_colors=yes use_vpath=no -. "$am_testauxdir"/testsuite-summary-checks.sh || exit 99 +. testsuite-summary-checks.sh ./configure diff --git a/t/testsuite-summary-count.sh b/t/testsuite-summary-count.sh index a6e546299..47bb66317 100755 --- a/t/testsuite-summary-count.sh +++ b/t/testsuite-summary-count.sh @@ -21,7 +21,7 @@ use_colors=no use_vpath=no -. "$am_testauxdir"/testsuite-summary-checks.sh || exit 99 +. testsuite-summary-checks.sh ./configure