2011-08-09 Stefano Lattarini <stefano.lattarini@gmail.com>
+ self tests: avoid spurious output on console, and related fixlets
+ * tests/self-check-cleanup.test: Set `$stderr_fileno_' to `2'
+ in the self tests, to avoid spurious diagnostic on console.
+ * tests/self-check-exit.tap: Only unset `am_explicit_skips' and
+ `$stderr_fileno_' in the self tests, not at the global level, it
+ is more correct.
+ ($init): New variable, to reduce code duplication.
+ Some refactoring and adjustments to the name of the tests.
+
+2011-08-09 Stefano Lattarini <stefano.lattarini@gmail.com>
+
test defs: few more sanity checks
* tests/defs: Catch some more (very unlikely) set-up or internal
errors, and diagnose them explicitly. This is intended mostly
plan_ 34
-unset am_explicit_skips stderr_fileno_
AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
+init='. ./defs; stderr_fileno_=2; unset am_explicit_skips'
+
for st in 1 2 3 4 5 77 99 126 127 128 129 130 255; do
- rc=0; $SHELL -c ". ./defs; Exit $st; :" || rc=$?
- command_ok_ "Exit $st" test $rc -eq $st
- rc=0; $SHELL -c ". ./defs; sh -c 'exit $st'; :" || rc=$?
- command_ok_ "exit $st" test $rc -eq $st
+ for ex in "Exit $st" "sh -c 'exit $st'"; do
+ rc=0; $SHELL -c "$init; $ex; :" || rc=$?
+ command_ok_ "$ex" test $rc -eq $st
+ done
done
for sig in 1 2 13 15; do
# signal when one is sent to the child $SHELL.
trap : 2
fi
- rc=0; $SHELL -c ". ./defs; kill -$sig \$\$; :" || rc=$?
+ rc=0; $SHELL -c "$init; kill -$sig \$\$; :" || rc=$?
if test $sig -eq 2; then
# Reset default SIGINT handler as portably as possible.
trap 2 || trap - 2
else
maybe_todo="" reason=""
fi
-if $SHELL -c ". ./defs; non-existent-program; :"; then
+if $SHELL -c "$init; non-existent-program; :"; then
r='not ok'
else
r='ok'
: Non-executable command.
test -f Makefile && test ! -x Makefile || \
framowork_failure_ "no proper Makefile in the current directory"
-rc=0; $SHELL -c ". ./defs; ./Makefile; :" || rc=$?
+rc=0; $SHELL -c "$init; ./Makefile; :" || rc=$?
command_ok_ "permission denied" test $rc -gt 0
: Syntax errors in the test code.
-rc=0; $SHELL -c ". ./defs; if :; then" || rc=$?
+rc=0; $SHELL -c "$init; if :; then" || rc=$?
command_ok_ "syntax error 1" test $rc -gt 0
-rc=0; $SHELL -c ". ./defs; fi" || rc=$?
+rc=0; $SHELL -c "$init; fi" || rc=$?
command_ok_ "syntax error 2" test $rc -gt 0
: