]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
testsuite: TAP tests can have early plan now
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 7 Aug 2011 07:42:48 +0000 (09:42 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 7 Aug 2011 09:37:32 +0000 (11:37 +0200)
* tests/defs: When using TAP, allow the user to specify the number
of tests through the `$planned' variable.
(trap): Do not print the auto-generated plan if an explicit one
has already been printed.
* tests/defs-static.in: Complain and bail out if the `$planned'
variable is exported in the environment.  Reformat the code to
facilitate future additions.
* tests/Makefile.am (TESTS_ENVIRONMENT): Neutralize `$planned'.
* tests/self-check-env-sanitize.test: Update.
* tests/ac-output-old.tap: Give an explicit TAP plan, by defining
`$planned' just before including `./defs'.
* tests/depmode.tap: Likewise.
* tests/automake-cmdline.tap: Likewise.
* tests/tap-bad-prog.tap: Likewise.
* tests/instspc.tap: Likewise, and related adjustments.
* tests/add-missing.tap: Make it explicit that we have no a-priori
plan, and tell why.

12 files changed:
ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/ac-output-old.tap
tests/add-missing.tap
tests/automake-cmdline.tap
tests/defs
tests/defs-static.in
tests/depmod.tap
tests/instspc.tap
tests/self-check-env-sanitize.test
tests/tap-bad-prog.tap

index 0776f51666b03b69fb92b836de9b8b4270064cab..aa71382b7ec67d6d32526ec6cd30bec168b9a4c6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: TAP tests can have early plan now
+       * tests/defs: When using TAP, allow the user to specify the number
+       of tests through the `$planned' variable.
+       (trap): Do not print the auto-generated plan if an explicit one
+       has already been printed.
+       * tests/defs-static.in: Complain and bail out if the `$planned'
+       variable is exported in the environment.  Reformat the code to
+       facilitate future additions.
+       * tests/Makefile.am (TESTS_ENVIRONMENT): Neutralize `$planned'.
+       * tests/self-check-env-sanitize.test: Update.
+       * tests/ac-output-old.tap: Give an explicit TAP plan, by defining
+       `$planned' just before including `./defs'.
+       * tests/depmode.tap: Likewise.
+       * tests/automake-cmdline.tap: Likewise.
+       * tests/tap-bad-prog.tap: Likewise.
+       * tests/instspc.tap: Likewise, and related adjustments.
+       * tests/add-missing.tap: Make it explicit that we have no a-priori
+       plan, and tell why.
+
 2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        testsuite: run autogenerated tests with $(LOG_COMPILER) too
index 2369c9079e153c77e944ddcd437ee7c042b67d8e..76d14fdd75219946c54b0f5e765ad3c775df4697 100644 (file)
@@ -91,6 +91,7 @@ $(config_shell_tests):
 AM_TESTS_ENVIRONMENT = \
   test x"$$me" = x || unset me; \
   test x"$$required" = x || unset required; \
+  test x"$$planned" = x || unset planned; \
   test x"$$use_tap" = x || unset use_tap; \
   test x"$$parallel_tests" = x || unset parallel_tests; \
   test x"$$test_prefer_config_shell" || unset test_prefer_config_shell; \
index f5a22082b4d567caf8f8e2084d7e1e713151ac83..cd30b562f0ed230e4fa67031acc82d0c12c92075 100644 (file)
@@ -341,9 +341,10 @@ SHTST_LOG_COMPILER = $(LOG_COMPILER) $(srcdir)/config-shell-tests.sh
 # we are already running them under it explicitly in our setup (see e.g.
 # the definition of TEST_LOG_COMPILER above).
 AM_TESTS_ENVIRONMENT = test x"$$me" = x || unset me; test \
-       x"$$required" = x || unset required; test x"$$use_tap" = x || \
-       unset use_tap; test x"$$parallel_tests" = x || unset \
-       parallel_tests; test x"$$test_prefer_config_shell" || unset \
+       x"$$required" = x || unset required; test x"$$planned" = x || \
+       unset planned; test x"$$use_tap" = x || unset use_tap; test \
+       x"$$parallel_tests" = x || unset parallel_tests; test \
+       x"$$test_prefer_config_shell" || unset \
        test_prefer_config_shell; test x"$$original_AUTOMAKE" = x || \
        unset original_AUTOMAKE; test x"$$original_ACLOCAL" = x || \
        unset original_ACLOCAL; AM_TESTS_REEXEC=no; export \
index 74bbba363fd6445a05ee3fd9a2b6562367120787..201e5177b812db047961e7117a65c2bd2f40a9df 100755 (executable)
@@ -19,6 +19,7 @@
 # line breaking in the use of AC_OUTPUT.  Synthesised by a bunch
 # of older tests (referenced below).
 
+planned=22
 . ./defs || Exit 1
 
 rm -f configure.in depcomp # Not required.
index 4c6a6248c3680040cc35c74ad9f1397fca84c07a..cbf6e573d0fee7efddee33f116cab1c00c5afdb4 100755 (executable)
@@ -19,6 +19,7 @@
 # the files) it's supposed to, and that these files are symlinked by
 # default, but copied if the `--copy' option is used.
 
+planned=unknown # Counting it would be too much data-dependent.
 . ./defs || Exit 1
 
 build_aux=build-aux
index 592c73b7c533af2b584372a35997105f3b2ed289..1c53a6d622b247dec00148726f97208763cf7905 100755 (executable)
@@ -15,6 +15,8 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test Automake's command-line options.
+
+planned=17
 . ./defs || Exit 1
 
 # Usage: bad_cmdline DESCRIPTION REGEX-FOR-STDERR [ARGS-FOR-AUTOMAKE...]
index c468d5fa09359c684f28acf74f4ffd18f1bb57da..e9e241e4aa1147349bf3747e5e9f5179e06f67b7 100644 (file)
@@ -430,6 +430,11 @@ xsi_shell_code='
 ##  required by them.                                          ##
 ## ----------------------------------------------------------- ##
 
+# The TAP plan must be either the fist or last line of output.
+if test $using_tap = yes && test ${planned-unknown} != unknown; then
+  plan_ "$planned"
+fi
+
 # Print it here, so that the user will see it also if the test
 # will be skipped due to some tool missing in $PATH itself.
 echo "$PATH"
@@ -831,7 +836,9 @@ if test "$sh_errexit_works" = yes; then
     set +x
     test "$signal" != 0 && echo "$me: caught signal $signal"
     echo "$me: exit $exit_status"
-    test $using_tap = yes && late_plan_
+    if test $using_tap = yes && test $have_tap_plan_ != yes; then
+      late_plan_
+    fi
     exit $exit_status
   ' 0
   for signal in 1 2 13 15; do
index 407060d306623d9da8eb9e08c7e6f3182ea1ed71..73eaad1fb5f12018a19eb1521def9a362660fb07 100644 (file)
@@ -70,9 +70,16 @@ fi
 # Check that the environment is properly sanitized.
 # Having variables exported to the empty string is OK, since our code
 # treats such variables as if they were unset.
-for var in me required use_tap parallel_tests test_prefer_config_shell \
-           original_AUTOMAKE original_ACLOCAL;
-do
+for var in \
+  me \
+  required \
+  planned \
+  use_tap \
+  parallel_tests \
+  test_prefer_config_shell \
+  original_AUTOMAKE \
+  original_ACLOCAL \
+; do
   if eval "test x\"\$$var\" != x" && env | grep "^$var=" >/dev/null; then
     echo "$argv0: variable \`$var' is set in the environment:" \
          "this is unsafe" >&2
index 4470fdd36cde202ba04e31873ececd24e187f937..85bd9720b374bd7a0adfbe0c21e72938ca58fbbf 100755 (executable)
 # which caused make to die with an error like:
 #  "sub/.deps/subfoo.Po:3: *** missing separator.  Stop."
 
+# Per each valid depmode three kinds of VPATH, and per each of them
+# a test on "./configure" and one on "make & remake"; so there are
+# 17 * 3 * 2 = 102.
+planned=102
 required=cc
 . ./defs || Exit 99
 
index 64540d8e19431a1d864200b23a3d52d7d940793f..4c8115158ee1e240fe27bcc5aa71ea50e8656cdc 100755 (executable)
@@ -19,6 +19,7 @@
 # Original report from James Amundson about file names with spaces.
 # Other characters added by Paul Eggert.
 
+planned=94 # Two tests per "problematic string".
 . ./defs || Exit 99
 
 # Usage: is_in_list ITEM [LIST...]
@@ -222,7 +223,7 @@ for test_name in $test_names_list; do
   # characters in file names.
 
   mkdir "./$test_string" || \
-    skip_row_ 2 -r "mkdir failed" "$test_name"
+    skip_ -r "mkdir failed" "$test_name"
 
   # Where are the "weird" characters going to be used, in $(builddir)
   # or in $(DESTDIR)?  They are always going to be used in $(prefix)
index e2d8f2a65ffa3e4306c9ad90687b2425c0b8140d..84c6b9f081c2109e3f35c9ed0546933fd158b65c 100755 (executable)
@@ -27,6 +27,7 @@ vars='
   me
   parallel_tests
   required
+  planned
   use_tap
   test_prefer_config_shell
   original_AUTOMAKE
index 2dee975a7e21d53b26b1f51a3e8eb88eba52ba35..0cc3a1124ad51991c5cd46ef289353eb1212cadc 100755 (executable)
@@ -18,6 +18,7 @@
 #  - missing, unreadable, or not-executable test scripts cause proper
 #    error reports
 
+planned=5
 parallel_tests=yes
 . ./defs || Exit 1