]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
testsuite: refactor tests on TAP support in view of future changes
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 17 Aug 2011 10:06:25 +0000 (12:06 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 17 Aug 2011 13:32:28 +0000 (15:32 +0200)
* tests/defs (fetch_tap_driver): New subroutine; it fetches the
automake-provided TAP driver from the `lib/' directory into the
current directory, and edits its shebang line so that it will be
run with the perl interpreter determined at configure time.
* tests/tap-setup.sh: Use it.
* tests/tap-common-setup.test: There's no need to AC_SUBST `PERL'
anymore, nor to use it in the Makefile to run the TAP driver.
Also, use the `fetch_tap_driver' function instead of copying the
`tap-driver' auxiliary script directly.
* tests/tap-bad-prog.tap: Likewise.
* tests/tap-diagnostic-custom.test: Likewise.
* tests/tap-doc.test: Likewise.
* tests/tap-merge-stdout-stderr.test: Likewise.
* tests/tap-more.test: Likewise.
* tests/tap-more2.test: Likewise.
* tests/tap-recheck.test: Likewise.
* tests/tap-summary-aux.sh: Likewise.
* tests/tap-basic.test: Likewise, and fix a grammaro in comments
since we are at it.

13 files changed:
ChangeLog
tests/defs
tests/tap-bad-prog.tap
tests/tap-basic.test
tests/tap-common-setup.test
tests/tap-diagnostic-custom.test
tests/tap-doc.test
tests/tap-merge-stdout-stderr.test
tests/tap-more.test
tests/tap-more2.test
tests/tap-recheck.test
tests/tap-setup.sh
tests/tap-summary-aux.sh

index 2cb53d4664ce1f2eba8b09b02cc636f915d1cb04..b64124a431f01177285fa3e437b7d9f4d407f0a9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2011-08-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: refactor tests on TAP support in view of future changes
+       * tests/defs (fetch_tap_driver): New subroutine; it fetches the
+       automake-provided TAP driver from the `lib/' directory into the
+       current directory, and edits its shebang line so that it will be
+       run with the perl interpreter determined at configure time.
+       * tests/tap-setup.sh: Use it.
+       * tests/tap-common-setup.test: There's no need to AC_SUBST `PERL'
+       anymore, nor to use it in the Makefile to run the TAP driver.
+       Also, use the `fetch_tap_driver' function instead of copying the
+       `tap-driver' auxiliary script directly.
+       * tests/tap-bad-prog.tap: Likewise.
+       * tests/tap-diagnostic-custom.test: Likewise.
+       * tests/tap-doc.test: Likewise.
+       * tests/tap-merge-stdout-stderr.test: Likewise.
+       * tests/tap-more.test: Likewise.
+       * tests/tap-more2.test: Likewise.
+       * tests/tap-recheck.test: Likewise.
+       * tests/tap-summary-aux.sh: Likewise.
+       * tests/tap-basic.test: Likewise, and fix a grammaro in comments
+       since we are at it.
+
 2011-08-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        coverage: missing tap plan and non-zero exit status
index afce3cba943ec463c8473073033f8a0962a23632..2b5df6b0aa050b1ac1a632a86eda219287178297 100644 (file)
@@ -306,6 +306,18 @@ unindent ()
 }
 sed_unindent_prog="" # Avoid interferences from the environment.
 
+# fetch_tap_driver
+# ----------------
+# Fetch the Automake-provided TAP driver from the `lib/' directory into
+# the current directory, and edit its shebang line so that it will be
+# run with the perl interpreter determined at configure time.
+fetch_tap_driver ()
+{
+  sed "1s|#!.*|#! $PERL -w|" "$top_testsrcdir"/lib/tap-driver >tap-driver \
+    && chmod a+x tap-driver \
+    || fatal_ "failed to fetch perl tap driver"
+  sed 10q tap-driver # For debugging.
+}
 
 ## ----------------------------------------------------------- ##
 ##  Checks for required tools, and additional setups (if any)  ##
index 2dee975a7e21d53b26b1f51a3e8eb88eba52ba35..c5d37338cafc9a3cb914429dce7bd004d127b62c 100755 (executable)
 parallel_tests=yes
 . ./defs || Exit 1
 
-cp "$top_testsrcdir"/lib/tap-driver . \
-  || fatal_ "failed to fetch auxiliary script tap-driver"
+fetch_tap_driver
 
 cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
+TEST_LOG_DRIVER = $(srcdir)/tap-driver
 TESTS = none.test noread.test noexec.test
 none.test:
 END
index 26a749d4ae9163dfd2ce663d94fb9f627b1d5c2c..dde65f26f952b3944982815afe166b222726b14b 100755 (executable)
 parallel_tests=yes
 . ./defs || Exit 1
 
-cp "$top_testsrcdir"/lib/tap-driver . \
-  || fatal_ "failed to fetch auxiliary script tap-driver"
+fetch_tap_driver
 
 cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
+TEST_LOG_DRIVER = $(srcdir)/tap-driver
 ## Defining LOG_COMPILER should work and not intefere with the
 ## tap-driver script.
 TEST_LOG_COMPILER = cat
@@ -145,7 +143,7 @@ test `$FGREP -c ': bail.test' stdout` -eq 1
 $FGREP 'success.test' stdout && Exit 1
 
 # Override TEST_LOGS from the command line, making it point to a test
-# (ok.test) that have to be generated at make time.
+# (ok.test) that has to be generated at make time.
 
 rm -f *.log *.test
 
index de8ff2cbfb4dc8780f4d2afcd97e363c54536017..f97b5876d54f3ebf417283fc390ffd99c4b07b2b 100755 (executable)
 parallel_tests=yes
 . ./defs || Exit 1
 
-cp "$top_testsrcdir"/lib/tap-driver . \
-  || fatal_ "failed to fetch auxiliary script tap-driver"
+fetch_tap_driver
 
 cat >> configure.in << END
-AC_SUBST([PERL], ['$PERL'])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
+TEST_LOG_DRIVER = $(srcdir)/tap-driver
 TEST_LOG_COMPILER = cat
 TESTS = all.test
 END
index d96522944193b37d66919c0236411a5ffa0dab6a..88c859ce0c6ae7d6c17d63d5c86adc2efc2816aa 100755 (executable)
 parallel_tests=yes
 . ./defs || Exit 1
 
-cp "$top_testsrcdir"/lib/tap-driver . \
-  || fatal_ "failed to fetch auxiliary script tap-driver"
+fetch_tap_driver
 
 cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-my_log_driver = $(PERL) $(srcdir)/tap-driver
+my_log_driver = $(srcdir)/tap-driver
 my_log_compiler = cat
 TEST_EXTENSIONS =
 TESTS =
index 2920d4e2ea9af01d7f3ce4fc7fa80105006c0b97..8ccd30f628a2ed3d71cf32df5ba0815e04ef8cc5 100755 (executable)
 parallel_tests=yes
 . ./defs || Exit 1
 
-cp "$top_testsrcdir"/lib/tap-driver . \
-  || fatal_ "failed to fetch auxiliary script tap-driver"
+fetch_tap_driver
 
 cat >> configure.in <<END
 AC_PROG_CC
-AC_SUBST([PERL], ['$PERL'])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 TESTS = foo.sh zardoz.tap bar.sh mu.tap
 TEST_EXTENSIONS = .sh .tap
-TAP_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
+TAP_LOG_DRIVER = $(srcdir)/tap-driver
 END
 
 cat > foo.sh <<'END'
index 787ad51f2fefecbb8a53104f030a69a4d0e5d11b..4da9f386f7c8aefa2e4216b5aeb093b68b4e6149 100755 (executable)
@@ -21,8 +21,7 @@
 parallel_tests=yes
 . ./defs || Exit 1
 
-cp "$top_testsrcdir"/lib/tap-driver . \
-  || fatal_ "failed to fetch auxiliary script tap-driver"
+fetch_tap_driver
 
 cat > Makefile.am << 'END'
 AM_TEST_LOG_DRIVER_FLAGS = --comments --merge
index 7d0bf86a0cc57b1c0bf2b4b464475c64b776f6ef..375aa001219b99c3e98b0a2967044c46915c692b 100755 (executable)
 parallel_tests=yes
 . ./defs || Exit 1
 
-cp "$top_testsrcdir"/lib/tap-driver . \
-  || fatal_ "failed to fetch auxiliary script tap-driver"
+fetch_tap_driver
 
 cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
 AC_SUBST([AM_TEST_LOG_DRIVER_FLAGS], ['--comments'])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
+TEST_LOG_DRIVER = $(srcdir)/tap-driver
 TESTS = 1.test 2.test 3.test
 EXTRA_DIST = $(TESTS) tap-driver
 END
index 810f9b86cd0e0b191d348634712af78c38bef1c2..f6f1ca1a11c697fc5c014ea5b01af04c003f5b00 100755 (executable)
@@ -23,19 +23,17 @@ required='cc native'
 parallel_tests=yes
 . ./defs || Exit 1
 
-cp "$top_testsrcdir"/lib/tap-driver . \
-  || fatal_ "failed to fetch auxiliary script tap-driver"
+fetch_tap_driver
 
 cat >> configure.in <<END
 AC_PROG_CC
-AC_SUBST([PERL], ['$PERL'])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 TEST_EXTENSIONS = .sh .tap
 
-tap_driver = $(PERL) $(srcdir)/tap-driver
+tap_driver = $(srcdir)/tap-driver
 
 LOG_DRIVER = $(tap_driver)
 SH_LOG_DRIVER = $(tap_driver)
index 14b02ad15e7972c5ebe2a483a1e430bae3ab5e20..0139b077533a3a8deed3015f9761367097a6a6b3 100755 (executable)
 parallel_tests=yes
 . ./defs || Exit 1
 
-cp "$top_testsrcdir"/lib/tap-driver . \
-  || fatal_ "failed to fetch auxiliary script tap-driver"
+fetch_tap_driver
 
 cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
+TEST_LOG_DRIVER = $(srcdir)/tap-driver
 TESTS = a.test b.test c.test d.test
 END
 
index 0d1a1e34e7050d229ae069d97fc6e55d18668ace..00397e0064b08d014db046268a8467cabb7519a6 100755 (executable)
@@ -31,8 +31,7 @@ test ! -f Makefile.am || mv Makefile.am Makefile.am~ \
 test -d ../tap-common-setup.dir && cp -Rp ../tap-common-setup.dir/* . \
   || fatal_ "couldn't get precomputed data files"
 
-cp "$top_testsrcdir"/lib/tap-driver . \
-  || fatal_ "failed to fetch auxiliary script tap-driver"
+fetch_tap_driver
 
 if test -f Makefile.am~; then
   mv -f Makefile.am~ Makefile.am \
index a5cad53882bc5b478915800f7f70a07ef1708e2c..7def11dc9b9d0fe8cf6089e1319f7562564e41a2 100755 (executable)
@@ -26,19 +26,17 @@ case $use_colors in
   *) fatal_ "invalid \$use_colors value '$use_colors'"
 esac
 
-cp "$top_testsrcdir"/lib/tap-driver . \
-  || fatal_ "failed to fetch auxiliary script tap-driver"
+fetch_tap_driver
 
 cat > configure.in <<END
 AC_INIT([GNU AutoTAP], [5.12], [bug-automake@gnu.org])
 AM_INIT_AUTOMAKE([parallel-tests])
-AC_SUBST([PERL], ['$PERL'])
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
+TEST_LOG_DRIVER = $(srcdir)/tap-driver
 TEST_LOG_COMPILER = cat
 TESTS = all.test
 END