automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, tap-testsuite-work, updated


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, tap-testsuite-work, updated. v1.11-1160-gb615fcd
Date: Tue, 09 Aug 2011 13:36:29 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=b615fcd597e99a8a16cfa873c6848d3c6204f777

The branch, tap-testsuite-work has been updated
       via  b615fcd597e99a8a16cfa873c6848d3c6204f777 (commit)
       via  376293a9ecaf9cc15041260d11e595af867608c8 (commit)
       via  07d9b536830dd8369e500c0b989dffb235cf34f0 (commit)
       via  389bd6b3d947dab08aa7fbce4540d1bd504e2446 (commit)
       via  4c4beef68cf5b0b3ab92e8e41ed322da2d8b21b5 (commit)
       via  9880431627fa196f7f5b4fd20aaeac97bee5cbd2 (commit)
       via  e3b6255fbf58b9120f1df8f91480749def57cec1 (commit)
      from  c463a964bec391ee9c2735801604e96941a1e33f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b615fcd597e99a8a16cfa873c6848d3c6204f777
Author: Stefano Lattarini <address@hidden>
Date:   Tue Aug 9 14:02:10 2011 +0200

    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.

commit 376293a9ecaf9cc15041260d11e595af867608c8
Author: Stefano Lattarini <address@hidden>
Date:   Tue Aug 9 12:13:53 2011 +0200

    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
    to be a theoretic-only improvement.

commit 07d9b536830dd8369e500c0b989dffb235cf34f0
Author: Stefano Lattarini <address@hidden>
Date:   Tue Aug 9 12:00:41 2011 +0200

    test defs: really make them "set -e" clean
    
    Motivated by a spurious failure of test `instsh3-w.shtst' on
    Solaris 10.
    
    * tests/defs: Make really "set -e" clean, to avoid spurious
    failures in case this file is sourced by a test script that has
    already set the `errexit' flag.  To be sure we don't regress,
    move the `set -e' call much earlier, and make the comment telling
    about the expected "set -e" cleanliness more loud and outstanding.

commit 389bd6b3d947dab08aa7fbce4540d1bd504e2446
Author: Stefano Lattarini <address@hidden>
Date:   Tue Aug 9 10:49:01 2011 +0200

    self tests: register an expected failures with Solaris /bin/sh
    
    Solaris 10 /bin/sh erroneously exit with success right away when
    the following three conditions are met at the same time:
     1. the `errexit' flag is active,
     2. an exit trap is installed, and
     3. a non-existing command is issued.
    
    * tests/self-exit.tap: When that bug is detected, issue an XFAIL
    rather than a FAIL.  Since we are at it, improve by avoiding
    creation of stray temporary files when testing for non-executable
    commands.

commit 4c4beef68cf5b0b3ab92e8e41ed322da2d8b21b5
Author: Stefano Lattarini <address@hidden>
Date:   Tue Aug 9 10:23:34 2011 +0200

    gitignore: update and improve for the testsuite files
    
    * tests/.gitignore: Don't ignore temporary partial log files,
    autogenerated tests and makefile fragments that are not used
    anymore.  Anchor all the remaining patterns.

commit 9880431627fa196f7f5b4fd20aaeac97bee5cbd2
Author: Stefano Lattarini <address@hidden>
Date:   Tue Aug 9 00:38:39 2011 +0200

    self tests: some new uses of TAP, few extensions
    
    * tests/self-check-me.test: Renamed ...
    * tests/self-check-me.tap: .. to this, and converted to use TAP.
    * tests/self-check-exit.test: Renamed ...
    * tests/self-check-exit.tap: .. to this, and converted to use TAP.
    Set `$stderr_fileno_' to `2', to avoid spurious messages on the
    console.  Add a new test, and relax another one.
    * tests/self-check-env-sanitize.test: Renamed ...
    * tests/self-check-env-sanitize.tap: .. to this, and converted to
    the use TAP.
    * tests/Makefile.am (TESTS): Update.

commit e3b6255fbf58b9120f1df8f91480749def57cec1
Author: Stefano Lattarini <address@hidden>
Date:   Mon Aug 8 23:35:28 2011 +0200

    test defs: test directory creation more configurable
    
    After this change, the individual tests will be able to tell
    `./defs' whether or not to create a temporary test directory
    for them, and if yes, whether or not to pre-populate it.
    * tests/defs: Only create the temporary test directory if the
    variable `$am_create_testdir' is not set to "no".  In this
    case, only pre-populate it if that variable is not set to
    `$empty'.
    
    * tests/defs-static.in: Check that `$am_create_testdir' is not
    exported in the environment.
    * tests/self-check-env-sanitize.test: Update.
    * tests/self-check-dir.test: Extend, and make deeper and more
    robust.
    * tests/README (Section "Writing test cases" subsection "Do"):
    Update.
    * tests/autodist.test: Set `$am_create_testdir' instead of
    removing by hand files created by ./defs.
    * tests/tap-doc2.test: Likewise.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   84 +++++++++++++++
 tests/.gitignore                                   |   23 ++---
 tests/Makefile.am                                  |    6 +-
 tests/Makefile.in                                  |    6 +-
 tests/README                                       |   13 ++-
 tests/autodist.test                                |    6 +-
 tests/defs                                         |  108 ++++++++++++--------
 tests/defs-static.in                               |    1 +
 tests/self-check-cleanup.test                      |    9 ++-
 tests/self-check-dir.test                          |   49 +++++++--
 ...v-sanitize.test => self-check-env-sanitize.tap} |   23 ++++-
 .../{self-check-exit.test => self-check-exit.tap}  |   77 ++++++++------
 tests/self-check-me.tap                            |   75 ++++++++++++++
 tests/self-check-me.test                           |   45 --------
 tests/tap-doc2.test                                |    6 +-
 15 files changed, 355 insertions(+), 176 deletions(-)
 rename tests/{self-check-env-sanitize.test => self-check-env-sanitize.tap} 
(70%)
 rename tests/{self-check-exit.test => self-check-exit.tap} (54%)
 create mode 100755 tests/self-check-me.tap
 delete mode 100755 tests/self-check-me.test

diff --git a/ChangeLog b/ChangeLog
index e0f922a..3506838 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,87 @@
+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
+       to be a theoretic-only improvement.
+
+2011-08-09  Stefano Lattarini  <address@hidden>
+
+       test defs: really make them "set -e" clean
+       Motivated by a spurious failure of test `instsh3-w.shtst' on
+       Solaris 10.
+       * tests/defs: Make really "set -e" clean, to avoid spurious
+       failures in case this file is sourced by a test script that has
+       already set the `errexit' flag.  To be sure we don't regress,
+       move the `set -e' call much earlier, and make the comment telling
+       about the expected "set -e" cleanliness more loud and outstanding.
+
+2011-08-09  Stefano Lattarini  <address@hidden>
+
+       self tests: register an expected failures with Solaris /bin/sh
+       Solaris 10 /bin/sh erroneously exit with success right away when
+       the following three conditions are met at the same time:
+        1. the `errexit' flag is active,
+        2. an exit trap is installed, and
+        3. a non-existing command is issued.
+       * tests/self-exit.tap: When that bug is detected, issue an XFAIL
+       rather than a FAIL.  Since we are at it, improve by avoiding
+       creation of stray temporary files when testing for non-executable
+       commands.
+
+2011-08-09  Stefano Lattarini  <address@hidden>
+
+       gitignore: update and improve for the testsuite files
+       * tests/.gitignore: Don't ignore temporary partial log files,
+       autogenerated tests and makefile fragments that are not used
+       anymore.  Anchor all the remaining patterns.
+
+2011-08-09  Stefano Lattarini  <address@hidden>
+
+       self tests: some new uses of TAP, few extensions
+       * tests/self-check-me.test: Renamed ...
+       * tests/self-check-me.tap: .. to this, and converted to use TAP.
+       * tests/self-check-exit.test: Renamed ...
+       * tests/self-check-exit.tap: .. to this, and converted to use TAP.
+       Set `$stderr_fileno_' to `2', to avoid spurious messages on the
+       console.  Add a new test, and relax another one.
+       * tests/self-check-env-sanitize.test: Renamed ...
+       * tests/self-check-env-sanitize.tap: .. to this, and converted to
+       the use TAP.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-08-09  Stefano Lattarini  <address@hidden>
+
+       test defs: test directory creation more configurable
+       After this change, the individual tests will be able to tell
+       `./defs' whether or not to create a temporary test directory
+       for them, and if yes, whether or not to pre-populate it.
+       * tests/defs: Only create the temporary test directory if the
+       variable `$am_create_testdir' is not set to "no".  In this
+       case, only pre-populate it if that variable is not set to
+       `$empty'.
+       * tests/defs-static.in: Check that `$am_create_testdir' is not
+       exported in the environment.
+       * tests/self-check-env-sanitize.test: Update.
+       * tests/self-check-dir.test: Extend, and make deeper and more
+       robust.
+       * tests/README (Section "Writing test cases" subsection "Do"):
+       Update.
+       * tests/autodist.test: Set `$am_create_testdir' instead of
+       removing by hand files created by ./defs.
+       * tests/tap-doc2.test: Likewise.
+
 2011-08-08  Stefano Lattarini  <address@hidden>
 
        testsuite: more uses of the `seq_' function
diff --git a/tests/.gitignore b/tests/.gitignore
index 430b25f..4ec56b1 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,15 +1,8 @@
-aclocal-*
-automake-*
-defs-static
-instspc-tests.am
-parallel-tests.am
-config-shell-tests.am
-depmod-tests.am
-*.dir
-*.log
-*.trs
-*.log-t
-*-p.test
-instspc-*-build.test
-instspc-*-install.test
-*.test-t
+/aclocal-*
+/automake-*
+/defs-static
+/parallel-tests.am
+/config-shell-tests.am
+/*.dir
+/*.log
+/*.trs
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c887155..1a0ef0e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -899,11 +899,11 @@ repeated-options.test \
 rulepat.test \
 self-check-cleanup.test \
 self-check-dir.test \
-self-check-env-sanitize.test \
-self-check-exit.test \
+self-check-env-sanitize.tap \
+self-check-exit.tap \
 self-check-explicit-skips.test \
 self-check-is_newest.test \
-self-check-me.test \
+self-check-me.tap \
 self-check-reexec.test \
 self-check-report.test \
 self-check-sanity.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 3520590..3a30b84 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1142,11 +1142,11 @@ repeated-options.test \
 rulepat.test \
 self-check-cleanup.test \
 self-check-dir.test \
-self-check-env-sanitize.test \
-self-check-exit.test \
+self-check-env-sanitize.tap \
+self-check-exit.tap \
 self-check-explicit-skips.test \
 self-check-is_newest.test \
-self-check-me.test \
+self-check-me.tap \
 self-check-reexec.test \
 self-check-report.test \
 self-check-sanity.test \
diff --git a/tests/README b/tests/README
index 8b8da14..54ec670 100644
--- a/tests/README
+++ b/tests/README
@@ -191,11 +191,14 @@ Do
   should be very very few), set the shell variable `parallel_tests' to
   "no" before including ./defs.
 
-  ./defs sets a skeleton configure.in.  If possible, append to this
-  file.  In some cases you'll have to overwrite it, but this should
-  be the exception.  Note that configure.in registers Makefile.in
-  but do not output anything by default.  If you need ./configure
-  to create Makefile, append AC_OUTPUT to configure.in.
+  ./defs brings in some commonly required files, and sets a skeleton
+  configure.in.  If possible, append to this file.  In some cases
+  you'll have to overwrite it, but this should be the exception.  Note
+  that configure.in registers Makefile.in but do not output anything by
+  default.  If you need ./configure to create Makefile, append AC_OUTPUT
+  to configure.in.  In case you don't want ./defs to pre-populate your
+  test directory (which is a rare occurrence), set `$am_create_destdir'
+  to "empty" before sourcing ./defs.
 
   By default, the testcases are run with the `errexit' shell flag on,
   to make it easier to catch failures you might not have thought of.
diff --git a/tests/autodist.test b/tests/autodist.test
index f2b31ab..ed8dcc3 100755
--- a/tests/autodist.test
+++ b/tests/autodist.test
@@ -19,13 +19,9 @@
 # Related to automake bug#7819.
 # Keep this test in sync with sister test `autodist-subdir.test'.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-# Ensure we are run from the right directory.
-# (The last thing we want is to delete some random user files.)
-test -f ../defs-static && test -f ../defs || Exit 99
-rm -f *
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AC_CONFIG_AUX_DIR([.])
diff --git a/tests/defs b/tests/defs
index dc2fee7..5e4c2c2 100644
--- a/tests/defs
+++ b/tests/defs
@@ -17,18 +17,18 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+########################################################
+###  IMPORTANT NOTE: keep this file 'set -e' clean.  ###
+########################################################
 
-# IMPORTANT NOTE: This file should execute correctly with any system's
-# /bin/sh shell, and not only with configure-time detected $CONFIG_SHELL,
-# until differently and explicitly specified.
-
+# NOTE: This file should execute correctly with any system's /bin/sh
+# shell, and not only with configure-time detected $CONFIG_SHELL,
+# *until differently and explicitly specified*.
 
 ## -------------------------------------------------------- ##
 ##  Source static setup and definitions for the testsuite.  ##
 ## -------------------------------------------------------- ##
 
-# This code needs to be 'set -e' clean.
-
 # Ensure we are running from the right directory.
 test -f ./defs-static || {
    echo "$0: ./defs-static: not found in current directory" >&2
@@ -38,6 +38,9 @@ test -f ./defs-static || {
 # Source the shell sanitization and variables' definitions.
 . ./defs-static || exit 99
 
+# Enable the errexit shell flag early.
+set -e
+
 # The name of the current test (without the `.test' suffix).
 # Test scripts can override it if they need to (but this should
 # be done carefully, and *before* including ./defs).
@@ -103,9 +106,10 @@ case ${AM_TESTS_REEXEC-yes} in
       *) opts=;;
     esac
     echo $me: exec $SHELL $opts "$0" "$*"
-    exec $SHELL $opts "$0" ${1+"$@"}
-    echo "$me: failed to re-execute with $SHELL" >&2
-    exit 99
+    exec $SHELL $opts "$0" ${1+"$@"} || {
+      echo "$me: failed to re-execute with $SHELL" >&2
+      exit 99
+    }
     ;;
 esac
 
@@ -117,6 +121,11 @@ esac
 ##  Environment cleanup.  ##
 ## ---------------------- ##
 
+# Temporarily disable this, since some shells (e.g., older version
+# of Bash) can return a non-zero exit status upon the when a non-set
+# variable is unset.
+set +e
+
 # Unset some MAKE... variables that may cause $MAKE to act like a
 # recursively invoked sub-make.  Any $MAKE invocation in a test is
 # conceptually an independent invocation, not part of the main
@@ -148,6 +157,8 @@ unset TEST_LOGS
 unset RECHECK_LOGS
 unset VERBOSE
 
+# Re-enable, it had been temporarily disabled above.
+set -e
 
 ## ---------------------------- ##
 ##  Auxiliary shell functions.  ##
@@ -177,7 +188,10 @@ else
 fi
 
 if test -f "$testsrcdir/$funcs_file_"; then
-  . "$testsrcdir/$funcs_file_"
+  . "$testsrcdir/$funcs_file_" || {
+    echo "$me: error sourcing $testsrcdir/$funcs_file_" >&2
+    Exit 99
+  }
 else
   echo "$me: $testsrcdir/$funcs_file_ not found, check \$testsrcdir" >&2
   Exit 99
@@ -610,8 +624,8 @@ do
         || framework_failure_ "creating unwritable file $priv_check_temp"
       # Not a useless use of subshell: lesser shells like Solaris /bin/sh
       # can exit if a builtin fails.
-      (echo foo >> $priv_check_temp)
-      overwrite_status=$?
+      overwrite_status=0
+      (echo foo >> $priv_check_temp) || overwrite_status=$?
       rm -f $priv_check_temp
       if test $overwrite_status -eq 0; then
         skip_all_ "cannot drop file write permissions"
@@ -639,8 +653,8 @@ do
         || framework_failure_ "creating unwritable directory $ro_dir_temp"
       # Not a useless use of subshell: lesser shells like Solaris /bin/sh
       # can exit if a builtin fails.
-      (: > $ro_dir_temp/probe)
-      create_status=$?
+      create_status=0
+      (: > $ro_dir_temp/probe) || create_status=$?
       rm -rf $ro_dir_temp
       if test $create_status -eq 0; then
         skip_all_ "cannot drop directory write permissions"
@@ -809,17 +823,7 @@ esac
 # Test scripts are free to override this if they need to.
 distdir=$me-1.0
 
-# The subdirectory where the current test script will run and write its
-# temporary/data files.  This will be created shortly, and will be removed
-# by the cleanup trap below if the test passes.  If the test doesn't pass,
-# this directory will be kept, to facilitate debugging.
-testSubDir=$me.dir
-
-test ! -d $testSubDir || rm_rf_ $testSubDir
-mkdir $testSubDir || framework_failure_ "creating test subdirectory"
-
-cd ./$testSubDir
-
+# Set up the exit trap.
 if test "$sh_errexit_works" = yes; then
   trap 'exit_status=$?
     set +e
@@ -865,31 +869,45 @@ if test "$sh_errexit_works" = yes; then
   unset signal
 fi
 
-# Copy in some files we need.
-cp "$top_testsrcdir"/lib/install-sh "$top_testsrcdir"/lib/missing \
-   "$top_testsrcdir"/lib/depcomp . \
-  || framework_failure_ "fetching common files from lib/"
-
-# Build appropriate environment in test directory.  Eg create
-# configure.in, touch all necessary files, etc.
-# Don't use AC_OUTPUT, but AC_CONFIG_FILES so that appending
-# still produces a valid configure.ac.  But then, tests running
-# config.status really need to append AC_OUTPUT.
-{
-  echo "AC_INIT([$me], [1.0])"
-  if test x"$parallel_tests" = x"yes"; then
-    echo "AM_INIT_AUTOMAKE([parallel-tests])"
-  else
-    echo "AM_INIT_AUTOMAKE"
+# Create and populate the temporary directory, if and as required.
+if test x"$am_create_testdir" = x"no"; then
+  testSubDir=
+else
+  # The subdirectory where the current test script will run and write its
+  # temporary/data files.  This will be created shortly, and will be removed
+  # by the cleanup trap below if the test passes.  If the test doesn't pass,
+  # this directory will be kept, to facilitate debugging.
+  testSubDir=$me.dir
+  test ! -d $testSubDir || rm_rf_ $testSubDir \
+    || framework_failure_ "removing old test subdirectory"
+  mkdir $testSubDir \
+    || framework_failure_ "creating test subdirectory"
+  cd ./$testSubDir \
+    || framework_failure_ "cannot chdir into test subdirectory"
+  if test x"$am_create_testdir" != x"empty"; then
+    cp "$top_testsrcdir"/lib/install-sh "$top_testsrcdir"/lib/missing \
+       "$top_testsrcdir"/lib/depcomp . \
+      || framework_failure_ "fetching common files from lib/"
+    # Build appropriate environment in test directory.  E.g., create
+    # configure.in, touch all necessary files, etc.  Don't use AC_OUTPUT,
+    # but AC_CONFIG_FILES so that appending still produces a valid
+    # configure.in.  But then, tests running config.status really need
+    # to append AC_OUTPUT.
+    {
+      echo "AC_INIT([$me], [1.0])"
+      if test x"$parallel_tests" = x"yes"; then
+        echo "AM_INIT_AUTOMAKE([parallel-tests])"
+      else
+        echo "AM_INIT_AUTOMAKE"
+      fi
+      echo "AC_CONFIG_FILES([Makefile])"
+    } >configure.in || framework_failure_ "creating configure.in skeleton"
   fi
-  echo "AC_CONFIG_FILES([Makefile])"
-} >configure.in
+fi
 
 ## ---------------- ##
 ##  Ready to go...  ##
 ## ---------------- ##
 
 set -x
-set -e
-
 pwd
diff --git a/tests/defs-static.in b/tests/defs-static.in
index 62f7486..0a7b77a 100644
--- a/tests/defs-static.in
+++ b/tests/defs-static.in
@@ -75,6 +75,7 @@ for var in \
   required \
   use_tap \
   parallel_tests \
+  am_create_testdir \
   test_prefer_config_shell \
   original_AUTOMAKE \
   original_ACLOCAL \
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-dir.test b/tests/self-check-dir.test
index 0b4dd4e..1aae601 100755
--- a/tests/self-check-dir.test
+++ b/tests/self-check-dir.test
@@ -16,26 +16,51 @@
 
 # Sanity check for the automake testsuite.
 # Check that tests using `./defs' create a proper temporary directory,
-# and run in it.
+# and run in it.  Also check that we can prevent the pre-population
+# and the creation of such directory if we want.
 
 . ./defs-static || exit 1
 
 set -ex
-
 AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
 
-this=S_dir
-outcome=:
-pwd
+# This needs to be consistent with what $SHELL deems to be the
+# current working directory.
+cwd=`$SHELL -c 'pwd'` || exit 99
+echo "$cwd"
+
+rm -f _self.tmp
 
-rm -f $this.tmp
+st=0
+$SHELL -c '
+  . ./defs || Exit 1
+  pwd; ls -l; # For debugging.
+  : > _self.tmp
+  test -f install-sh
+  test -f configure.in
+  case `pwd` in '"$cwd"'/_self.dir);; *) Exit 1;; esac
+' _self.test || st=1
+test -f _self.tmp && { rm -f _self.tmp; st=1; }
+test $st -eq 0 || exit 1
 
-$SHELL -c "
+st=0
+$SHELL -c '
+  am_create_testdir=empty
   . ./defs || Exit 1
-  : > $this.tmp
-  case \`pwd\` in '`pwd`'/$this.dir);; *) Exit 1;; esac
-" $this.test || outcome=false
+  pwd; ls -l; # For debugging.
+  ls -a | grep -v "^\\.\\{1,2\\}$" | grep . && Exit 1
+  : > _self.tmp
+  case `pwd` in '"$cwd"'/_self.dir);; *) Exit 1;; esac
+  :
+' _self.test || st=1
+test -f _self.tmp && { rm -f _self.tmp; st=1; }
+test $st -eq 0 || exit 1
 
-test -f $this.tmp && { rm -f $this.tmp; outcome=false; }
+$SHELL -c '
+  am_create_testdir=no
+  . ./defs || Exit 1
+  test -f self-check-dir.test
+  case `pwd` in '"$cwd"');; *) Exit 1;; esac
+' _self.test || exit 1
 
-$outcome
+:
diff --git a/tests/self-check-env-sanitize.test 
b/tests/self-check-env-sanitize.tap
similarity index 70%
rename from tests/self-check-env-sanitize.test
rename to tests/self-check-env-sanitize.tap
index e2d8f2a..16e3a99 100755
--- a/tests/self-check-env-sanitize.test
+++ b/tests/self-check-env-sanitize.tap
@@ -18,26 +18,39 @@
 # Make sure that the testsuite initialization code complains when
 # some testsuite-influential variables are set in the environment.
 
-. ./defs-static || exit 1
+am_create_testdir=no
+. ./defs || Exit 1
 
 set -x
 exec 5>&1
 
+plan_ 16 # Two times the number of variable names in $vars.
+
 vars='
   me
   parallel_tests
   required
   use_tap
+  am_create_testdir
   test_prefer_config_shell
   original_AUTOMAKE
   original_ACLOCAL
 '
 
+do_run ()
+{
+  env "$1=foo" $SHELL -c '. ./defs' foo.test
+}
+
+do_grep ()
+{
+  env "$1=foo" $SHELL -c '. ./defs' foo.test 2>&1 1>&5 \
+    | grep "foo\.test:.* variable \`$1'.* in the environment.*unsafe"
+}
+
 for var in $vars; do
-  env "$var=foo" $SHELL -c '. ./defs' foo.test && exit 1
-  env "$var=foo" $SHELL -c '. ./defs' foo.test 2>&1 1>&5 \
-    | grep "foo\.test:.* variable \`$var'.* in the environment.*unsafe" \
-    || exit 1
+  command_not_ok_ "$var [err status]" do_run $var
+  command_ok_ "$var [err message]" do_grep $var
 done
 
 :
diff --git a/tests/self-check-exit.test b/tests/self-check-exit.tap
similarity index 54%
rename from tests/self-check-exit.test
rename to tests/self-check-exit.tap
index 69aabcd..ff0278a 100755
--- a/tests/self-check-exit.test
+++ b/tests/self-check-exit.tap
@@ -19,65 +19,78 @@
 # passed to the exit trap installed by the `./defs' script.
 # Also check that the `errexit' shell flag is active.
 
-. ./defs-static || exit 99
+am_create_testdir=no
+. ./defs || Exit 99
 
-unset am_explicit_skips
-AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
-
-for st in 1 2 3 4 5 77 99 126 127 128 129 130 255; do
+plan_ 34
 
-  echo "* Try: Exit $st"
-  $SHELL -c  ". ./defs; Exit $st; :"
-  rc=$?
-  echo "* rc=$rc"
-  echo
-  test $rc -eq $st || exit 1
+AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
 
-  echo "* Try: sh -c 'exit $st'"
-  $SHELL -c  ". ./defs; sh -c 'exit $st'; :"
-  rc=$?
-  echo "* rc=$rc"
-  echo
-  test $rc -eq $st || exit 1
+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
+  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
 
-echo "* Try: non-existent-program"
-$SHELL -c  ". ./defs; non-existent-program; :"
-rc=$?
-echo "* rc=$rc"
-echo
-test $rc -eq 127 || exit 1
-
 for sig in 1 2 13 15; do
-
-  echo "* Try: kill -$sig \$\$"
   if test $sig -eq 2; then
     # Some Korn shells might otherwise get a spurious SIGINT
     # signal when one is sent to the child $SHELL.
     trap : 2
   fi
-  $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
   fi
-  echo "* rc=$rc"
-  echo
   if test x"$sh_errexit_works" = x"yes"; then
     # The exit trap should turn into an hard errors any failure
     # caused by signals.
-    test $rc -eq 99 || exit 1
+    command_ok_ "kill -$sig" test $rc -eq 99
   else
     # The exit trap is not installed, so that the shell should exit
     # with status 128+n when receiving signal number n.  But don't
     # be too strict in the check, as POSIX only says that "The exit
     # status of a command that terminated because it received a
     # signal shall be reported as greater than 128".
-    test $rc -gt 128 || exit 1
+    command_ok_ "kill -$sig" test $rc -gt 128
   fi
 
 done
 
+: Non-existent program.
+# Solaris 10 /bin/sh erroneously exit with success right away when the
+# following three conditions are met at the same time:
+#   1. the `errexit' flag is active,
+#   2. an exit trap is installed, and
+#   3. a non-existing command is issued.
+# Note that the non-existent command is issued as the last command to
+# the shell in the next line; this is deliberate.
+if $SHELL -c 'set -e; trap "exit \$?" 0; non-existent-program'; then
+  maybe_todo=TODO reason="known Solaris /bin/sh bug"
+else
+  maybe_todo="" reason=""
+fi
+if $SHELL -c  "$init; non-existent-program; :"; then
+  r='not ok'
+else
+  r='ok'
+fi
+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  "$init; ./Makefile; :" || rc=$?
+command_ok_ "permission denied" test $rc -gt 0
+
+: Syntax errors in the test code.
+rc=0; $SHELL -c  "$init; if :; then" || rc=$?
+command_ok_ "syntax error 1" test $rc -gt 0
+rc=0; $SHELL -c  "$init; fi" || rc=$?
+command_ok_ "syntax error 2" test $rc -gt 0
+
 :
diff --git a/tests/self-check-me.tap b/tests/self-check-me.tap
new file mode 100755
index 0000000..503a1d0
--- /dev/null
+++ b/tests/self-check-me.tap
@@ -0,0 +1,75 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Sanity check for the automake testsuite.
+# Make sure that $me gets automatically defined by `./defs', and that it
+# can be overridden by the test script.
+
+am_create_testdir=no
+. ./defs || Exit 1
+
+plan_ 9
+
+AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
+set +e
+
+do_check ()
+{
+  if $SHELL -c '. ./defs && echo me=$me' "$1" | grep "^me=$2$"; then
+    r='ok'
+  else
+    r='not ok'
+  fi
+  result_ "$r" "me=$1"
+  unset r
+}
+
+do_check foo-bar-.test 'foo-bar-'
+do_check _foo__bar.test '_foo__bar'
+do_check 012.test '012'
+do_check foo.bar 'foo\.bar'
+do_check a.b.c.test 'a\.b\.c'
+
+# If we override $me, ./defs should not modify it.
+
+if s=`$SHELL -c 'me=foo.test && . ./defs && echo me=$me' bad.test`; then
+  r='ok'
+else
+  r='not ok'
+fi
+result_ "$r" "override of \$me before ./defs causes no error"
+
+r='ok'
+if printf '%s\n' "$s" | grep '^me=foo\.test$'; then :; else r='not ok'; fi
+if printf '%s\n' "$s" | grep 'me=bad'; then r='not ok'; else :; fi
+result_ "$r" "override of \$me before defs is honored"
+
+# Overriding $me after sourcing ./defs-static should work.
+
+if s=`$SHELL -c '. ./defs-static && me=zardoz &&
+                 . ./defs && echo me=$me' bad.test`; then
+  r='ok'
+else
+  r='not ok'
+fi
+result_ "$r" "override of \$me after defs-static causes no error"
+
+r='ok'
+if printf '%s\n' "$s" | grep '^me=zardoz$'; then :; else r='not ok'; fi
+if printf '%s\n' "$s" | grep 'me=bad'; then r='not ok'; else :; fi
+result_ "$r" "override of \$me after ./defs-static is honored"
+
+:
diff --git a/tests/self-check-me.test b/tests/self-check-me.test
deleted file mode 100755
index e8b1361..0000000
--- a/tests/self-check-me.test
+++ /dev/null
@@ -1,45 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Sanity check for the automake testsuite.
-# Make sure that $me gets automatically defined by `./defs', and that it
-# can be overridden by the test script.
-
-. ./defs-static || exit 1
-
-set -ex
-
-AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
-
-$SHELL -c '. ./defs && echo me=$me' foo-bar-.test | grep '^me=foo-bar-$'
-$SHELL -c '. ./defs && echo me=$me' _foo__bar.test | grep '^me=_foo__bar$'
-$SHELL -c '. ./defs && echo me=$me' 012.test | grep '^me=012$'
-$SHELL -c '. ./defs && echo me=$me' foo.bar | grep '^me=foo\.bar$'
-$SHELL -c '. ./defs && echo me=$me' a.b.c.test | grep '^me=a\.b\.c$'
-
-# Overriding $me after sourcing ./defs-static should work.
-s=`$SHELL -c '. ./defs-static && me=zardoz && . ./defs && echo me=$me' \
-             bad.test` || exit 1
-printf '%s\n' "$s" | grep '^me=zardoz$'
-printf '%s\n' "$s" | grep 'me=bad' && exit 1
-
-# If we override $me, ./defs should not modify it.
-s=`$SHELL -c 'me=foo.test && . ./defs && echo me=$me' \
-             bad.test` || exit 1
-printf '%s\n' "$s" | grep '^me=foo\.test$'
-printf '%s\n' "$s" | grep 'me=bad' && exit 1
-
-:
diff --git a/tests/tap-doc2.test b/tests/tap-doc2.test
index 63bdc23..45d09ca 100755
--- a/tests/tap-doc2.test
+++ b/tests/tap-doc2.test
@@ -18,14 +18,10 @@
 # See section "Using the TAP test protocol", subsection "Use TAP
 # with the Automake test harness".
 
+am_create_testdir=empty
 parallel_tests=yes
 . ./defs || Exit 1
 
-# Ensure we are run from the right directory.
-# (The last thing we want is to delete some random user files.)
-test -f ../defs-static && test -f ../defs || Exit 99
-rm -f *
-
 cat > Makefile.am <<'END'
 TEST_LOG_DRIVER = $(PERL) $(srcdir)/build-aux/tap-driver
 TESTS = foo.test bar.test baz.test


hooks/post-receive
-- 
GNU Automake



reply via email to

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