automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FYI 7/7] {tap-testsuite-work} self tests: avoid spurious output on cons


From: Stefano Lattarini
Subject: [FYI 7/7] {tap-testsuite-work} self tests: avoid spurious output on console, and related fixlets
Date: Tue, 9 Aug 2011 15:35:35 +0200

* 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.
---
 ChangeLog                     |   11 +++++++++++
 tests/self-check-cleanup.test |    9 ++++++++-
 tests/self-check-exit.tap     |   21 +++++++++++----------
 3 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3ba884f..3506838 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2011-08-09  Stefano Lattarini  <address@hidden>
 
+       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  <address@hidden>
+
        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
diff --git a/tests/self-check-cleanup.test b/tests/self-check-cleanup.test
index 7660316..fb5b055 100755
--- a/tests/self-check-cleanup.test
+++ b/tests/self-check-cleanup.test
@@ -57,6 +57,7 @@ test ! -r $dir
 # Check that post-test cleanup works also with directories with
 # "null" permissions, and containing broken symlinks.
 $SHELL -c '
+  stderr_fileno_=2
   . ./defs || Exit 1
   set -e
   mkdir dir dir/sub
@@ -95,6 +96,7 @@ if $have_symlinks; then
 
   $SHELL -c '
     ocwd=`pwd` || exit 1
+    stderr_fileno_=2
     . ./defs || Exit 1
     ln -s "$ocwd/dir" "$ocwd/file" .
   ' dummy.test
@@ -125,7 +127,12 @@ for bailout_command in \
   'kill -13 $$' \
   'kill -15 $$' \
 ; do
-  $SHELL -c  ". ./defs; : > foo; $bailout_command" dummy.test && Exit 1
+  $SHELL -c  "
+    stderr_fileno_=2
+    . ./defs
+    : > foo
+    $bailout_command
+  " dummy.test && Exit 1
   test -f dummy.dir/foo
 done
 
diff --git a/tests/self-check-exit.tap b/tests/self-check-exit.tap
index dc8cfda..ff0278a 100755
--- a/tests/self-check-exit.tap
+++ b/tests/self-check-exit.tap
@@ -24,14 +24,15 @@ am_create_testdir=no
 
 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
@@ -40,7 +41,7 @@ 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
@@ -73,7 +74,7 @@ if $SHELL -c 'set -e; trap "exit \$?" 0; 
non-existent-program'; then
 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'
@@ -83,13 +84,13 @@ result_ "$r" -D "$maybe_todo" -r "$reason" "command not 
found"
 : 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
 
 :
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]