+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
}
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) ##
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
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
$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
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
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 =
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'
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
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
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)
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
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 \
*) 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