Merge branch 'maint'
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 1 Jul 2012 16:01:35 +0000 (18:01 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 1 Jul 2012 16:01:35 +0000 (18:01 +0200)
* maint:
  tests: don't trust the exit status of "make -k" for non-GNU makes
  parallel-tests: reimplement fix for bug#11791
  tests setup: unset CDPATH
  tests setup: more namespace safeness
  tests setup: remove an unused variable
  tests setup: less hard-coding of the test subdirectory

defs-static.in
lib/am/check.am
t/ax/test-init.sh
t/parallel-tests-recheck-pr11791.sh

index 781571c..6901212 100644 (file)
@@ -25,6 +25,9 @@
 #     shell, not only with configure-time detected $SHELL and/or
 #     $AM_TEST_RUNNER_SHELL.
 
+# CDPATH is evil if exported in the environment.
+CDPATH=; unset CDPATH
+
 # Be more Bourne compatible.
 # (Snippet inspired to configure's initialization in Autoconf 2.64)
 DUALCASE=1; export DUALCASE # for MKS sh
@@ -88,9 +91,9 @@ if test -z "$am_using_tap"; then
   case $argv0 in *.tap) am_using_tap=yes;; *) am_using_tap=no;; esac
 fi
 
+am_rel_srcdir='@srcdir@'
 am_top_srcdir='@abs_srcdir@'
 am_top_builddir='@abs_builddir@'
-testprefix='@prefix@'
 
 # Where testsuite-related helper scripts, data files and shell libraries
 # are placed.
@@ -131,6 +134,9 @@ PATH_SEPARATOR='@PATH_SEPARATOR@'
 host_alias=${host_alias-'@host_alias@'}; export host_alias
 build_alias=${build_alias-'@build_alias@'}; export build_alias
 
+# A concurrency-safe "mkdir -p" implementation.
+MKDIR_P=${AM_TESTSUITE_MKDIR_P-'@MKDIR_P@'}
+
 # The shell we use to run our own test scripts, determined at configure
 # time.  It is required in the self tests, and most importantly for the
 # automatic re-execution of test scripts.
index da71923..0bbe2ee 100644 (file)
@@ -240,6 +240,12 @@ am__set_TESTS_bases = \
        rm -f $< $@
        $(MAKE) $(AM_MAKEFLAGS) $<
 
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# exand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+       @:
+
 $(TEST_SUITE_LOG): $(TEST_LOGS)
        @$(am__set_TESTS_bases); \
 ## Helper shell function, tells whether a path refers to an existing,
@@ -431,11 +437,10 @@ recheck: all %CHECK_DEPS%
        bases=`for i in $$bases; do echo $$i; done \
                 | $(am__list_recheck_tests)` || exit 1; \
        log_list=`for i in $$bases; do echo $$i.log; done`; \
-       trs_list=`for i in $$bases; do echo $$i.trs; done`; \
 ## Remove newlines and normalize whitespace.  Trailing (and possibly
 ## leading) whitespace is known to cause segmentation faults on
 ## Solaris 10 XPG4 make.
-       log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+       log_list=`echo $$log_list`; \
 ## Move the '.log' and '.trs' files associated with the tests to be
 ## re-run out of the way, so that those tests will be re-run by the
 ## "make test-suite.log" recursive invocation below.
@@ -445,27 +450,14 @@ recheck: all %CHECK_DEPS%
 ##     we must ensure that any '.log' and '.trs' file referring to such
 ##     test are preserved, so that future "make recheck" invocations
 ##     will still try to re-compile and re-run it (automake bug#11791).
-## The extra contortions below cater to such requirements.
-       am_backupdir=.am-recheck; \
-       if $(am__make_dryrun); then :; else \
-         if test -n "$$trs_list$$log_list"; then \
-           { test ! -d $$am_backupdir || rm -rf $$am_backupdir; } \
-             && $(MKDIR_P) $$am_backupdir || exit 1; \
-           test -z "$$log_list" \
-             || mv -f $$log_list $$am_backupdir 2>/dev/null; \
-           test -z "$$trs_list" \
-             || mv -f $$trs_list $$am_backupdir 2>/dev/null; \
-         fi; \
-       fi; \
-       $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
-       st=$$?; \
-       if $(am__make_dryrun) || test ! -d $$am_backupdir; then :; else \
-         for f in $$log_list $$trs_list; do \
-           test -f $$f || mv $$am_backupdir/$$f . || exit 1; \
-         done; \
-         rm -rf $$am_backupdir || exit 1; \
-       fi; \
-       exit $$st;
+## The tricky recusrive make invocation below should cater to such
+## requirements.
+       $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+               am__force_recheck=am--force-recheck \
+               TEST_LOGS="$$log_list"; \
+## Be sure to exit with the proper exit status (automake bug#9245).  See
+## comments in the recipe of $(TEST_SUITE_LOG) above for more information.
+       exit $$?
 
 AM_RECURSIVE_TARGETS += check recheck
 
index 1144dd4..c2c8d4d 100644 (file)
@@ -929,7 +929,7 @@ trap 'exit_status=$?
     esac
     test $exit_status -eq 0 || keep_testdirs=yes
   fi
-  am_keeping_testdirs || rm_rf_ $testSubDir
+  am_keeping_testdirs || rm_rf_ $am_test_subdir
   set +x
   echo "$me: exit $exit_status"
   # Spurious escaping to ensure we do not call our "exit" alias.
@@ -964,20 +964,22 @@ trap "trap '' 13; fatal_ 'caught signal SIGPIPE'" 13
 
 # Create and populate the temporary directory, if and as required.
 if test x"$am_create_testdir" = x"no"; then
-  testSubDir=
+  am_test_subdir=
 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=t/$me.dir
-  test ! -e $testSubDir || rm_rf_ $testSubDir \
+  am_test_subdir=${argv0#$am_rel_srcdir/}
+  case $am_test_subdir in
+    */*) am_test_subdir=${am_test_subdir%/*}/$me.dir;;
+      *) am_test_subdir=$me.dir;;
+  esac
+  test ! -e $am_test_subdir || rm_rf_ $am_test_subdir \
     || framework_failure_ "removing old test subdirectory"
-  test -d t || mkdir t
-  mkdir $testSubDir \
+  $MKDIR_P $am_test_subdir \
     || framework_failure_ "creating test subdirectory"
-  # The leading './' is to avoid CDPATH issues.
-  cd ./$testSubDir \
+  cd $am_test_subdir \
     || framework_failure_ "cannot chdir into test subdirectory"
   if test x"$am_create_testdir" != x"empty"; then
     cp "$am_scriptdir"/install-sh "$am_scriptdir"/missing \
index 2cb18cf..2d2fc5a 100755 (executable)
@@ -42,8 +42,10 @@ $MAKE check >stdout && { cat stdout; exit 1; }
 cat stdout
 count_test_results total=1 pass=0 fail=1 xpass=0 xfail=0 skip=0 error=0
 
-$MAKE -k recheck >stdout && { cat stdout; exit 1; }
+st=0; $MAKE -k recheck >stdout || st=$?
 cat stdout
+# Don't trust the exit status of "make -k" for non-GNU makes.
+if using_gmake && test $st -eq 0; then exit 1; fi
 count_test_results total=1 pass=0 fail=1 xpass=0 xfail=0 skip=0 error=0
 
 # Introduce an error in foo.c, that should cause a compilation failure.