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 "*) continue;; esac; \
- case $$t in \
- *-w.tap) \
- : it is ok for an *auto-generated* test sourcing an \
- : hand-written one not to declare a TAP plan: that will \
- : be done by the sourced test; \
- t2=`echo $$t | sed -e 's|.*/||' -e 's/-w\.tap$$/.tap/'` \
- && grep -E "^ *\\. *[^ ]*/$$t2\\b" $$t >/dev/null \
- && continue || : ;; \
- esac; \
- ok=false; echo $$t; \
- 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,
set +e
cd "$testbuilddir"
if test $am_using_tap = yes; then
- if test $have_tap_plan_ != yes && test $exit_status -eq 0; then
+ if test "$planned_" = later && test $exit_status -eq 0; then
plan_ "now"
fi
test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \
bailout_ "plan_: missing argument"
elif test $# -ge 2; then
bailout_ "plan_: too many arguments"
+ elif test x"$planned_" != x"none" && test x"$planned_" != x"later"; then
+ bailout_ "plan_: called to many times"
elif test x"$1" = x"unknown" || test x"$1" = x"later"; then
- : No-op.
+ # This means we want to get back later to declaring the TAP plan.
+ planned_=later
+ return 0
elif test x"$1" = x"lazy" || test x"$1" = x"now"; then
- echo "1..$tap_count_" # Number of test results seen so far.
- have_tap_plan_=yes
+ planned_=$tap_count_ # Number of test results seen so far.
elif test $1 -ge 0; then
- echo "1..$1"
- have_tap_plan_=yes
+ planned_=$1
else
bailout_ "plan_: invalid argument '$1'"
fi
+ echo "1..$planned_"
}
-have_tap_plan_=no # Avoid interferences from the environment.
+planned_=none
# diag_ [EXPLANATION]
# ------------------
skip_all_ ()
{
echo "1..0 # SKIP" ${1+"$@"}
- have_tap_plan_=yes
+ planned_=0
Exit 0
}