* Makefile.am (sc_tests_tap_plan): New maintainer check.
(syntax_check_rules): Add it.
* tests/suffix10.tap: Declare a TAP plan.
* tests/add-missing.tap: Likewise.
2011-08-14 Stefano Lattarini <stefano.lattarini@gmail.com>
+ maintcheck: look for TAP-based tests without TAP plan
+ * Makefile.am (sc_tests_tap_plan): New maintainer check.
+ (syntax_check_rules): Add it.
+ * tests/suffix10.tap: Declare a TAP plan.
+ * tests/add-missing.tap: Likewise.
+
+2011-08-14 Stefano Lattarini <stefano.lattarini@gmail.com>
+
testsuite: avoid confusing SKIP messages for errored tests
* tests/defs [$use_tap] (exit trap): Don't print the test plan
in case the client script exited with a non-zero status. This
sc_tests_plain_aclocal \
sc_tests_plain_perl \
sc_tests_required_after_defs \
+sc_tests_tap_plan \
sc_tests_overriding_macros_on_cmdline \
sc_tests_plain_sleep \
sc_tests_plain_egrep_fgrep \
fi; \
done
+## TAP-based test scripts should not forget to declare a TAP plan. In
+## case it is not known in advance how many tests will be run, a "lazy"
+## plan can be used; but its use should be deliberate, explicitly declared
+## with a "plan_ later" call, rather than the result of an oversight.
+## This check helps to ensure this is indeed the case.
+sc_tests_tap_plan:
+ @with_plan=`grep -l '^ *plan_ ' $(srcdir)/tests/*.tap`; \
+ with_plan=`echo $$with_plan`; \
+ ok=:; \
+ for t in $(srcdir)/tests/*.tap; do \
+ case " $$with_plan " in \
+ *" $$t "*) ;; \
+ *) ok=false; echo $$t;; \
+ esac; \
+ done; \
+ $$ok || { \
+ echo 'The tests above do not declare a TAP plan.' 1>&2; \
+ exit 1; \
+ }
+
## Overriding a Makefile macro on the command line is not portable when
## recursive targets are used. Better use an envvar. SHELL is an
## exception, POSIX says it can't come from the environment. V, DESTDIR,
sc_tests_plain_aclocal \
sc_tests_plain_perl \
sc_tests_required_after_defs \
+sc_tests_tap_plan \
sc_tests_overriding_macros_on_cmdline \
sc_tests_plain_sleep \
sc_tests_plain_egrep_fgrep \
fi; \
done
+sc_tests_tap_plan:
+ @with_plan=`grep -l '^ *plan_ ' $(srcdir)/tests/*.tap`; \
+ with_plan=`echo $$with_plan`; \
+ ok=:; \
+ for t in $(srcdir)/tests/*.tap; do \
+ case " $$with_plan " in \
+ *" $$t "*) ;; \
+ *) ok=false; echo $$t;; \
+ esac; \
+ done; \
+ $$ok || { \
+ echo 'The tests above do not declare a TAP plan.' 1>&2; \
+ exit 1; \
+ }
+
sc_tests_overriding_macros_on_cmdline:
@if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(srcdir)/tests/*.test; then \
echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
am_create_testdir=empty
. ./defs || Exit 1
-build_aux=build-aux
+plan_ "later"
+build_aux=build-aux
ocwd=`pwd` || fatal_ "cannot get current working directory"
# Try to improve readability of displayed diffs.
required='cc libtoolize yacc'
. ./defs || Exit 1
+plan_ 7
+
cat >>configure.in <<EOF
AC_PROG_CC
AC_PROG_YACC