* tests/gen-wrap-tests: Partial rewrite to take into account the possibility that the wrapped test uses the TAP protocol. This complicates the code quite a bit, but is essential to ensure real correctness in all the wrapped scripts. * tests/wrap-tests.sh: Update, and add few more sanity checks. --- ChangeLog | 9 ++ tests/Makefile.in | 219 +++++++++++++++++++++++++++++++------------------- tests/gen-wrap-tests | 88 +++++++++++++++----- tests/wrap-tests.sh | 53 ++++++------- 4 files changed, 235 insertions(+), 134 deletions(-)
diff --git a/ChangeLog b/ChangeLog index be5d736..4ca10ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2011-08-29 Stefano Lattarini <stefano.lattar...@gmail.com> + tests: better respect of TAP usage in wrapped tests + * tests/gen-wrap-tests: Partial rewrite to take into account the + possibility that the wrapped test uses the TAP protocol. This + complicates the code quite a bit, but is essential to ensure real + correctness in all the wrapped scripts. + * tests/wrap-tests.sh: Update, and add few more sanity checks. + +2011-08-29 Stefano Lattarini <stefano.lattar...@gmail.com> + tests: use both perl and awk implementations for tests on TAP * tests/gen-wrap-tests (get_list_for_pltap): New function, gets the list of tests that check the Automake TAP support. diff --git a/tests/Makefile.in b/tests/Makefile.in index e3da364..79b68bf 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -184,18 +184,18 @@ TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ am__test_logs3 = $(am__test_logs2:.tap.log=.log) TAP_LOG_COMPILE = $(TAP_LOG_COMPILER) $(AM_TAP_LOG_FLAGS) \ $(TAP_LOG_FLAGS) -am__test_logs4 = $(am__test_logs3:.ptest.log=.log) -PTEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver -PTEST_LOG_COMPILE = $(PTEST_LOG_COMPILER) $(AM_PTEST_LOG_FLAGS) \ - $(PTEST_LOG_FLAGS) -am__test_logs5 = $(am__test_logs4:.shtst.log=.log) -SHTST_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver -SHTST_LOG_COMPILE = $(SHTST_LOG_COMPILER) $(AM_SHTST_LOG_FLAGS) \ - $(SHTST_LOG_FLAGS) -TEST_LOGS = $(am__test_logs5:.pltap.log=.log) -PLTAP_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver -PLTAP_LOG_COMPILE = $(PLTAP_LOG_COMPILER) $(AM_PLTAP_LOG_FLAGS) \ - $(PLTAP_LOG_FLAGS) +am__test_logs4 = $(am__test_logs3:.test_pt.log=.log) +TEST_PT_LOG_COMPILE = $(TEST_PT_LOG_COMPILER) $(AM_TEST_PT_LOG_FLAGS) \ + $(TEST_PT_LOG_FLAGS) +am__test_logs5 = $(am__test_logs4:.test_cs.log=.log) +TEST_CS_LOG_COMPILE = $(TEST_CS_LOG_COMPILER) $(AM_TEST_CS_LOG_FLAGS) \ + $(TEST_CS_LOG_FLAGS) +am__test_logs6 = $(am__test_logs5:.test_pltap.log=.log) +TEST_PLTAP_LOG_COMPILE = $(TEST_PLTAP_LOG_COMPILER) \ + $(AM_TEST_PLTAP_LOG_FLAGS) $(TEST_PLTAP_LOG_FLAGS) +TEST_LOGS = $(am__test_logs6:.tap_pltap.log=.log) +TAP_PLTAP_LOG_COMPILE = $(TAP_PLTAP_LOG_COMPILER) \ + $(AM_TAP_PLTAP_LOG_FLAGS) $(TAP_PLTAP_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -298,7 +298,7 @@ top_srcdir = @top_srcdir@ # Run the tests with the shell detected at configure time. LOG_COMPILER = $(SHELL) -TEST_EXTENSIONS = .test .tap .ptest .shtst .pltap +TEST_EXTENSIONS = .test .tap .test_pt .test_cs .test_pltap .tap_pltap TEST_LOG_COMPILER = $(LOG_COMPILER) TAP_LOG_COMPILER = $(LOG_COMPILER) TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/lib/tap-driver.sh @@ -1457,62 +1457,76 @@ tap-recheck.test \ tap-summary.test \ tap-summary-color.test -wrap_TESTS = check-concurrency-bug9245-w.ptest \ - check-exported-srcdir-w.ptest check-fd-redirect-w.ptest \ - check-subst-prog-w.ptest check-subst-w.ptest \ - check-tests-in-builddir-w.ptest check-w.ptest check11-w.ptest \ - check12-w.ptest check2-w.ptest check3-w.ptest check4-w.ptest \ - check5-w.ptest check6-w.ptest check7-w.ptest check8-w.ptest \ - color-w.ptest color2-w.ptest comment9-w.ptest dejagnu-w.ptest \ - exeext4-w.ptest maken3-w.ptest maken4-w.ptest \ - posixsubst-tests-w.ptest tests-environment-w.ptest \ - ar-lib-w.shtst compile-w.shtst compile2-w.shtst \ - compile3-w.shtst compile4-w.shtst compile5-w.shtst \ - compile6-w.shtst instsh2-w.shtst instsh3-w.shtst \ - mdate5-w.shtst mdate6-w.shtst missing-w.shtst missing2-w.shtst \ - missing3-w.shtst missing5-w.shtst mkinst3-w.shtst \ - tap-ambiguous-directive-w.pltap tap-autonumber-w.pltap \ - tap-bad-prog-w.pltap tap-bailout-and-logging-w.pltap \ - tap-bailout-suppress-badexit-w.pltap \ - tap-bailout-suppress-later-diagnostic-w.pltap \ - tap-bailout-suppress-later-errors-w.pltap tap-bailout-w.pltap \ - tap-basic-w.pltap tap-color-w.pltap tap-deps-w.pltap \ - tap-diagnostic-custom-w.pltap tap-diagnostic-w.pltap \ - tap-doc-w.pltap tap-driver-stderr-w.pltap \ - tap-empty-diagnostic-w.pltap tap-empty-w.pltap \ - tap-escape-directive-2-w.pltap tap-escape-directive-w.pltap \ - tap-exit-w.pltap tap-fancy-w.pltap tap-fancy2-w.pltap \ - tap-global-log-w.pltap tap-global-result-w.pltap \ - tap-html-w.pltap tap-log-w.pltap \ - tap-merge-stdout-stderr-w.pltap \ - tap-missing-plan-and-bad-exit-w.pltap tap-more-w.pltap \ - tap-more2-w.pltap tap-msg0-bailout-w.pltap \ - tap-msg0-directive-w.pltap tap-msg0-misc-w.pltap \ - tap-msg0-planskip-w.pltap tap-msg0-result-w.pltap \ - tap-negative-numbers-w.pltap tap-no-disable-hard-error-w.pltap \ - tap-no-merge-stdout-stderr-w.pltap \ - tap-no-spurious-numbers-w.pltap \ - tap-no-spurious-summary-w.pltap tap-no-spurious-w.pltap \ - tap-not-ok-skip-w.pltap tap-number-wordboundary-w.pltap \ - tap-numbers-leading-zero-w.pltap \ - tap-numeric-description-w.pltap tap-out-of-order-w.pltap \ - tap-passthrough-exit-w.pltap tap-passthrough-w.pltap \ - tap-plan-corner-w.pltap tap-plan-errors-w.pltap \ - tap-plan-leading-zero-w.pltap tap-plan-malformed-w.pltap \ - tap-plan-middle-w.pltap tap-plan-whitespace-w.pltap \ - tap-plan-w.pltap tap-planskip-and-logging-w.pltap \ - tap-planskip-badexit-w.pltap tap-planskip-bailout-w.pltap \ - tap-planskip-case-insensitive-w.pltap \ - tap-planskip-late-w.pltap tap-planskip-later-errors-w.pltap \ - tap-planskip-unplanned-corner-w.pltap \ - tap-planskip-unplanned-w.pltap tap-planskip-whitespace-w.pltap \ - tap-planskip-w.pltap tap-realtime-w.pltap \ - tap-recheck-logs-w.pltap tap-recheck-w.pltap \ - tap-result-comment-w.pltap tap-signal-w.pltap \ - tap-test-number-0-w.pltap tap-todo-skip-together-w.pltap \ - tap-todo-skip-whitespace-w.pltap tap-todo-skip-w.pltap \ - tap-unplanned-w.pltap tap-whitespace-normalization-w.pltap \ - tap-with-and-without-number-w.pltap tap-xfail-tests-w.pltap +wrap_TESTS = check-concurrency-bug9245-w.test_pt \ + check-exported-srcdir-w.test_pt check-fd-redirect-w.test_pt \ + check-subst-prog-w.test_pt check-subst-w.test_pt \ + check-tests-in-builddir-w.test_pt check-w.test_pt \ + check11-w.test_pt check12-w.test_pt check2-w.test_pt \ + check3-w.test_pt check4-w.test_pt check5-w.test_pt \ + check6-w.test_pt check7-w.test_pt check8-w.test_pt \ + color-w.test_pt color2-w.test_pt comment9-w.test_pt \ + dejagnu-w.test_pt exeext4-w.test_pt maken3-w.test_pt \ + maken4-w.test_pt posixsubst-tests-w.test_pt \ + tests-environment-w.test_pt ar-lib-w.test_cs compile-w.test_cs \ + compile2-w.test_cs compile3-w.test_cs compile4-w.test_cs \ + compile5-w.test_cs compile6-w.test_cs instsh2-w.test_cs \ + instsh3-w.test_cs mdate5-w.test_cs mdate6-w.test_cs \ + missing-w.test_cs missing2-w.test_cs missing3-w.test_cs \ + missing5-w.test_cs mkinst3-w.test_cs \ + tap-ambiguous-directive-w.test_pltap \ + tap-autonumber-w.test_pltap tap-bad-prog-w.tap_pltap \ + tap-bailout-and-logging-w.test_pltap \ + tap-bailout-suppress-badexit-w.test_pltap \ + tap-bailout-suppress-later-diagnostic-w.test_pltap \ + tap-bailout-suppress-later-errors-w.test_pltap \ + tap-bailout-w.test_pltap tap-basic-w.test_pltap \ + tap-color-w.test_pltap tap-deps-w.test_pltap \ + tap-diagnostic-custom-w.test_pltap tap-diagnostic-w.test_pltap \ + tap-doc-w.test_pltap tap-driver-stderr-w.test_pltap \ + tap-empty-diagnostic-w.test_pltap tap-empty-w.test_pltap \ + tap-escape-directive-2-w.test_pltap \ + tap-escape-directive-w.test_pltap tap-exit-w.test_pltap \ + tap-fancy-w.test_pltap tap-fancy2-w.test_pltap \ + tap-global-log-w.test_pltap tap-global-result-w.test_pltap \ + tap-html-w.test_pltap tap-log-w.test_pltap \ + tap-merge-stdout-stderr-w.test_pltap \ + tap-missing-plan-and-bad-exit-w.test_pltap \ + tap-more-w.test_pltap tap-more2-w.test_pltap \ + tap-msg0-bailout-w.test_pltap tap-msg0-directive-w.test_pltap \ + tap-msg0-misc-w.test_pltap tap-msg0-planskip-w.test_pltap \ + tap-msg0-result-w.test_pltap tap-negative-numbers-w.test_pltap \ + tap-no-disable-hard-error-w.test_pltap \ + tap-no-merge-stdout-stderr-w.test_pltap \ + tap-no-spurious-numbers-w.test_pltap \ + tap-no-spurious-summary-w.test_pltap \ + tap-no-spurious-w.test_pltap tap-not-ok-skip-w.test_pltap \ + tap-number-wordboundary-w.test_pltap \ + tap-numbers-leading-zero-w.test_pltap \ + tap-numeric-description-w.test_pltap \ + tap-out-of-order-w.test_pltap \ + tap-passthrough-exit-w.test_pltap tap-passthrough-w.test_pltap \ + tap-plan-corner-w.test_pltap tap-plan-errors-w.test_pltap \ + tap-plan-leading-zero-w.test_pltap \ + tap-plan-malformed-w.test_pltap tap-plan-middle-w.test_pltap \ + tap-plan-whitespace-w.test_pltap tap-plan-w.test_pltap \ + tap-planskip-and-logging-w.test_pltap \ + tap-planskip-badexit-w.test_pltap \ + tap-planskip-bailout-w.test_pltap \ + tap-planskip-case-insensitive-w.test_pltap \ + tap-planskip-late-w.test_pltap \ + tap-planskip-later-errors-w.test_pltap \ + tap-planskip-unplanned-corner-w.test_pltap \ + tap-planskip-unplanned-w.test_pltap \ + tap-planskip-whitespace-w.test_pltap tap-planskip-w.test_pltap \ + tap-realtime-w.test_pltap tap-recheck-logs-w.test_pltap \ + tap-recheck-w.test_pltap tap-result-comment-w.test_pltap \ + tap-signal-w.test_pltap tap-test-number-0-w.test_pltap \ + tap-todo-skip-together-w.test_pltap \ + tap-todo-skip-whitespace-w.test_pltap \ + tap-todo-skip-w.test_pltap tap-unplanned-w.test_pltap \ + tap-whitespace-normalization-w.test_pltap \ + tap-with-and-without-number-w.test_pltap \ + tap-xfail-tests-w.test_pltap wrap_LOGS = check-concurrency-bug9245-w.log \ check-exported-srcdir-w.log check-fd-redirect-w.log \ check-subst-prog-w.log check-subst-w.log \ @@ -1563,15 +1577,47 @@ wrap_LOGS = check-concurrency-bug9245-w.log \ tap-todo-skip-whitespace-w.log tap-todo-skip-w.log \ tap-unplanned-w.log tap-whitespace-normalization-w.log \ tap-with-and-without-number-w.log tap-xfail-tests-w.log -PTEST_LOG_COMPILER = \ +TEST_PT_LOG_DRIVER = \ + $(TEST_LOG_DRIVER) + +AM_TEST_PT_LOG_DRIVER_FLAGS = \ + $(AM_TEST_LOG_DRIVER_FLAGS) \ + $(TEST_LOG_DRIVER_FLAGS) + +TEST_PT_LOG_COMPILER = \ $(LOG_COMPILER) $(srcdir)/wrap-tests.sh \ - --type ptest --define parallel_tests "yes" + --type pt --define parallel_tests "yes" + +TEST_CS_LOG_DRIVER = \ + $(TEST_LOG_DRIVER) + +AM_TEST_CS_LOG_DRIVER_FLAGS = \ + $(AM_TEST_LOG_DRIVER_FLAGS) \ + $(TEST_LOG_DRIVER_FLAGS) -SHTST_LOG_COMPILER = \ +TEST_CS_LOG_COMPILER = \ $(LOG_COMPILER) $(srcdir)/wrap-tests.sh \ - --type shtst --define test_prefer_config_shell "yes" + --type cs --define test_prefer_config_shell "yes" -PLTAP_LOG_COMPILER = \ +TEST_PLTAP_LOG_DRIVER = \ + $(TEST_LOG_DRIVER) + +AM_TEST_PLTAP_LOG_DRIVER_FLAGS = \ + $(AM_TEST_LOG_DRIVER_FLAGS) \ + $(TEST_LOG_DRIVER_FLAGS) + +TEST_PLTAP_LOG_COMPILER = \ + $(LOG_COMPILER) $(srcdir)/wrap-tests.sh \ + --type pltap --define am_tap_implementation "perl" + +TAP_PLTAP_LOG_DRIVER = \ + $(TAP_LOG_DRIVER) + +AM_TAP_PLTAP_LOG_DRIVER_FLAGS = \ + $(AM_TAP_LOG_DRIVER_FLAGS) \ + $(TAP_LOG_DRIVER_FLAGS) + +TAP_PLTAP_LOG_COMPILER = \ $(LOG_COMPILER) $(srcdir)/wrap-tests.sh \ --type pltap --define am_tap_implementation "perl" @@ -1583,7 +1629,7 @@ am__tdf = diff-in-tests-lists.tmp all: all-am .SUFFIXES: -.SUFFIXES: .html .log .pltap .ptest .shtst .tap .test .trs +.SUFFIXES: .html .log .tap .tap_pltap .test .test_cs .test_pltap .test_pt .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/list-of-tests.mk $(srcdir)/wrap-tests.am $(top_srcdir)/CheckListOfTests.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -1819,20 +1865,25 @@ recheck recheck-html: --log-file '$*.log' --trs-file '$*.trs' \ $(am__common_driver_flags) $(AM_TAP_LOG_DRIVER_FLAGS) $(TAP_LOG_DRIVER_FLAGS) -- $(TAP_LOG_COMPILE) "$$tst" \ $(AM_TESTS_FD_REDIRECT) -.ptest.log: - @p='$<'; $(am__check_pre) $(PTEST_LOG_DRIVER) --test-name "$$f" \ +.test_pt.log: + @p='$<'; $(am__check_pre) $(TEST_PT_LOG_DRIVER) --test-name "$$f" \ + --log-file '$*.log' --trs-file '$*.trs' \ + $(am__common_driver_flags) $(AM_TEST_PT_LOG_DRIVER_FLAGS) $(TEST_PT_LOG_DRIVER_FLAGS) -- $(TEST_PT_LOG_COMPILE) "$$tst" \ + $(AM_TESTS_FD_REDIRECT) +.test_cs.log: + @p='$<'; $(am__check_pre) $(TEST_CS_LOG_DRIVER) --test-name "$$f" \ --log-file '$*.log' --trs-file '$*.trs' \ - $(am__common_driver_flags) $(AM_PTEST_LOG_DRIVER_FLAGS) $(PTEST_LOG_DRIVER_FLAGS) -- $(PTEST_LOG_COMPILE) "$$tst" \ + $(am__common_driver_flags) $(AM_TEST_CS_LOG_DRIVER_FLAGS) $(TEST_CS_LOG_DRIVER_FLAGS) -- $(TEST_CS_LOG_COMPILE) "$$tst" \ $(AM_TESTS_FD_REDIRECT) -.shtst.log: - @p='$<'; $(am__check_pre) $(SHTST_LOG_DRIVER) --test-name "$$f" \ +.test_pltap.log: + @p='$<'; $(am__check_pre) $(TEST_PLTAP_LOG_DRIVER) --test-name "$$f" \ --log-file '$*.log' --trs-file '$*.trs' \ - $(am__common_driver_flags) $(AM_SHTST_LOG_DRIVER_FLAGS) $(SHTST_LOG_DRIVER_FLAGS) -- $(SHTST_LOG_COMPILE) "$$tst" \ + $(am__common_driver_flags) $(AM_TEST_PLTAP_LOG_DRIVER_FLAGS) $(TEST_PLTAP_LOG_DRIVER_FLAGS) -- $(TEST_PLTAP_LOG_COMPILE) "$$tst" \ $(AM_TESTS_FD_REDIRECT) -.pltap.log: - @p='$<'; $(am__check_pre) $(PLTAP_LOG_DRIVER) --test-name "$$f" \ +.tap_pltap.log: + @p='$<'; $(am__check_pre) $(TAP_PLTAP_LOG_DRIVER) --test-name "$$f" \ --log-file '$*.log' --trs-file '$*.trs' \ - $(am__common_driver_flags) $(AM_PLTAP_LOG_DRIVER_FLAGS) $(PLTAP_LOG_DRIVER_FLAGS) -- $(PLTAP_LOG_COMPILE) "$$tst" \ + $(am__common_driver_flags) $(AM_TAP_PLTAP_LOG_DRIVER_FLAGS) $(TAP_PLTAP_LOG_DRIVER_FLAGS) -- $(TAP_PLTAP_LOG_COMPILE) "$$tst" \ $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) diff --git a/tests/gen-wrap-tests b/tests/gen-wrap-tests index f59a153..f794fb0 100755 --- a/tests/gen-wrap-tests +++ b/tests/gen-wrap-tests @@ -19,7 +19,10 @@ set -e set -u -tests=`${MAKE-make} -s -f list-of-tests.mk print-list-of-tests` \ +MAKE=${MAKE-make} +PERL=${PERL-perl} + +tests=`$MAKE -s -f list-of-tests.mk print-list-of-tests` \ && tests=`echo $tests` && test -n "$tests" \ || { echo "$0: cannot get list of tests" >&2; exit 1; } @@ -48,7 +51,7 @@ wrapper_type_list="" # Avoid interferences from the environment. # support, or is not meant to run with, the `parallel-tests' option, and # forcing it to do so in the sibling would likely cause a spurious failure. # -get_list_for_ptest () +get_list_for_pt () { { grep -l '^TESTS *=' $*; grep -l ' TESTS *=' $*; } \ | LC_ALL=C sort -u \ @@ -58,8 +61,8 @@ get_list_for_ptest () echo $tst done } -defines_for_ptest='--define parallel_tests "yes"' -add_wrapper_type "ptest" +defines_for_pt='--define parallel_tests "yes"' +add_wrapper_type "pt" # # For each test script in the Automake testsuite that tests features of @@ -80,7 +83,7 @@ add_wrapper_type "ptest" # to use, $SHELL to run the script under testing, and forcing it to do so # in the sibling would likely cause a spurious failure. # -get_list_for_shtst () +get_list_for_cs () { { grep -l '^get_shell_script ' $*; grep -l ' get_shell_script ' $*; } \ | LC_ALL=C sort -u \ @@ -88,8 +91,8 @@ get_list_for_shtst () grep "test_prefer_config_shell=" $tst >/dev/null || echo $tst done } -defines_for_shtst='--define test_prefer_config_shell "yes"' -add_wrapper_type "shtst" +defines_for_cs='--define test_prefer_config_shell "yes"' +add_wrapper_type "cs" # Tests on tap support should be run with both the perl and awk # implementations of the TAP driver. @@ -112,6 +115,7 @@ add_wrapper_type "pltap" echo '## Generated by gen-wrapped-tests. DO NOT EDIT.' echo 'wrap_TESTS =' echo 'wrap_LOGS =' +echo # NOTE: the following is not really right, since cannot compose wrapping # of tests matching more than one condition. Still, there should be no @@ -120,22 +124,62 @@ echo 'wrap_LOGS =' # in Makefile.am will start failing. for wtype in $wrapper_type_list; do - WTYPE=`echo $wtype | LC_ALL=C tr '[a-z]' '[A-Z]'` eval defines=\${defines_for_$wtype} - echo "TEST_EXTENSIONS += .$wtype" - echo "${WTYPE}_LOG_COMPILER = \\" - echo " \$(LOG_COMPILER) \$(srcdir)/wrap-tests.sh \\" - echo " --type $wtype $defines" get_list_for_$wtype $tests \ - | sed -e ' - h - s/\(.*\)\.\([^.]\)*$/wrap_TESTS += \1-w.'$wtype'/ - p - x - h - s/\(.*\)\.\([^.]*\)$/\1-w.log: \1.\2/ - p - x - s/\(.*\)\.[^.]*$/wrap_LOGS += \1-w.log/ + | wtype="$wtype" defines="$defines" $PERL -w -e ' + use strict; + use warnings FATAL => "all"; + + my $wtype = $ENV{"wtype"}; + + # Suffix for a generated wrapped test, from the suffix of a + # hand-written test. + sub gen_suffix ($) { return $_[0] . "_" . $wtype; } + + HANDLE_SUFFIX : + { + my %have_suffix; + sub handle_if_new_suffix ($) + { + my $suf = shift; + return + if $have_suffix{$suf}; + $have_suffix{$suf} = 1; + print "\n"; + print "TEST_EXTENSIONS += ." . gen_suffix ($suf) . "\n"; + my $uc_orig_suf = uc ($suf); + my $uc_wrap_suf = uc ($suf) . "_" . uc ($wtype); + print <<EOF; + +${uc_wrap_suf}_LOG_DRIVER = \\ + \$(${uc_orig_suf}_LOG_DRIVER) + +AM_${uc_wrap_suf}_LOG_DRIVER_FLAGS = \\ + \$(AM_${uc_orig_suf}_LOG_DRIVER_FLAGS) \\ + \$(${uc_orig_suf}_LOG_DRIVER_FLAGS) + +${uc_wrap_suf}_LOG_COMPILER = \\ + \$(LOG_COMPILER) \$(srcdir)/wrap-tests.sh \\ + --type $wtype $ENV{"defines"} + +EOF + } + } + while (<>) + { + chomp; + if (/^(.*)\.(test|tap)$/) + { + my ($bas, $suf) = ($1, $2); + handle_if_new_suffix ($suf); + print "wrap_TESTS += $bas-w." . gen_suffix ($suf) . "\n"; + print "wrap_LOGS += $bas-w.log\n"; + print "$bas-w.log: $bas.$suf\n"; + } + else + { + die "invalid test name `$_`"; + } + } ' done diff --git a/tests/wrap-tests.sh b/tests/wrap-tests.sh index 1a17db3..2eb65a5 100755 --- a/tests/wrap-tests.sh +++ b/tests/wrap-tests.sh @@ -49,44 +49,41 @@ while test $# -gt 0; do esac shift done -test -n "$typ" || fatal_ "suffix not specified" -case $#,$1 in - 0,) fatal_ "missing argument";; - 1,*-w.$typ) test_name=`expr x/"$1" : ".*/\\\\(.*\\\\)-w\\\\.$typ$"`;; - 1,*) fatal_ "invalid argument \`$1'";; +case $typ in + "") fatal_ "suffix not specified";; + *.*) fatal_ "invalid suffix \`$typ' (contains dot)";; +esac + +case $# in + 0) fatal_ "missing argument";; + 1) ;; *) fatal_ "too many arguments";; esac -set -x +# We must let the code in ./defs which kind of test script it is +# dealing with -- TAP or "plain". It won't be able to guess +# automatically, since it uses `$0' for such a guess, and with +# the present usage `$0' is always `wrap-tests.sh'. +case $1 in + *-w.test_$typ) using_tap=no suf=test;; + *-w.tap_$typ) using_tap=yes suf=tap;; + *) fatal_ "invalid argument \`$1'";; +esac + +test_name=`expr x/"$1" : ".*/\\\\(.*\\\\)-w\\\\.[^.][^.]*$"` \ + && test -n "$test_name" \ + || fatal_ "couldn't extract test name" +shift + # This is required to have the wrapped test use a proper temporary # directory to run into. me=${test_name}-w # In the spirit of VPATH, we prefer a test in the build tree # over one in the source tree. for dir in . "$testsrcdir"; do - # The testsuite shouldn't have a TAP and plain test with the same - # basename (they would end up sharing the same basename and thus the - # same `.log' and `.trs' files, wreaking havoc). So just test for - # the two flavors in random order. - for suf in tap test; do - if test -f "$dir/$test_name.$suf"; then - # We must let the code in ./defs which kind of test script it is - # dealing with -- TAP or "plain". It won't be able to guess - # automatically, since it uses `$0' for such a guess, and with - # the present usage `$0' is always `wrap-tests.sh'. - if test $suf = tap; then - using_tap=yes - else - using_tap=no - fi - # Shell traces will be properly re-enabled later by the sourced - # test script. - set +x - . "$dir/$test_name.$suf" - exit $? - fi - done + . "$dir/$test_name.$suf" + exit $? done fatal_ "cannot find wrapped test \`$test_name'" -- 1.7.2.3