From 6806a6914e92d4fa4694ed98988beea5d5176484 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Sat, 10 Nov 2007 11:11:21 +0100 Subject: [PATCH] Run each test in a process-private subdirectory. * tests/defs.in: Employ a trap to clean up at the end of the test in case the test succeeded. This needs to be revisited because we would like to keep the output of XPASSing tests. Also, note when we were interrupted by a signal. Code taken from Autoconf's _AC_INIT_PREPARE. If $keep_testdirs is set, keep them even for successful tests. * tests/Makefile.am (check-clean-local): New target. Remove all tests subdirs, but also make them writable first. The latter was already needed without per-test subdirs. (distclean-local): Depend upon check-clean-local. * tests/Makefile.in: Regenerate. * tests/.cvsignore, tests/.gitignore: Adjust. --- ChangeLog | 14 ++++++++++++++ HACKING | 2 ++ tests/.cvsignore | 2 +- tests/.gitignore | 2 +- tests/Makefile.am | 7 +++++-- tests/Makefile.in | 7 +++++-- tests/defs.in | 29 ++++++++++++++++++++++++----- 7 files changed, 52 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa941b46b..b79015ec9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2007-11-10 Ralf Wildenhues + Run each test in a process-private subdirectory. + * tests/defs.in: Employ a trap to clean up at the end of the + test in case the test succeeded. This needs to be revisited + because we would like to keep the output of XPASSing tests. + Also, note when we were interrupted by a signal. Code taken + from Autoconf's _AC_INIT_PREPARE. + If $keep_testdirs is set, keep them even for successful tests. + * tests/Makefile.am (check-clean-local): New target. Remove all + tests subdirs, but also make them writable first. The latter + was already needed without per-test subdirs. + (distclean-local): Depend upon check-clean-local. + * tests/Makefile.in: Regenerate. + * tests/.cvsignore, tests/.gitignore: Adjust. + Fix default includes ordering to be `-I. -I$(srcdir) ...' again. * automake.in (handle_compile): Put -I$(srcdir) before include paths for config headers, as was done before Automake 1.10, but diff --git a/HACKING b/HACKING index 5a3ed338a..9f2f1f4fa 100644 --- a/HACKING +++ b/HACKING @@ -119,6 +119,8 @@ * Make sure each test file is executable +* Use `keep_testdirs=yes' to keep test directories for successful + tests also. ================================================================ = Release procedure diff --git a/tests/.cvsignore b/tests/.cvsignore index c28dc161b..69d3d43f3 100644 --- a/tests/.cvsignore +++ b/tests/.cvsignore @@ -5,6 +5,6 @@ automake defs diffs log -testSubDir +*.dir aclocal-* automake-* diff --git a/tests/.gitignore b/tests/.gitignore index 0859387eb..f1c3bff33 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,4 +1,4 @@ aclocal-* automake-* defs -testSubDir +*.dir diff --git a/tests/Makefile.am b/tests/Makefile.am index 81a038221..3c586a1dc 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -627,5 +627,8 @@ EXTRA_DIST = ChangeLog-old $(TESTS) # Each test case depends on defs, aclocal, and automake. check_SCRIPTS = defs aclocal-$(APIVERSION) automake-$(APIVERSION) -distclean-local: - -rm -rf testSubDir +distclean-local: check-clean-local + +check-clean-local: + -chmod -R u+rwx *.dir + -rm -rf *.dir diff --git a/tests/Makefile.in b/tests/Makefile.in index 999ed2409..b44613055 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1023,8 +1023,11 @@ uninstall-am: pdf-am ps ps-am uninstall uninstall-am -distclean-local: - -rm -rf testSubDir +distclean-local: check-clean-local + +check-clean-local: + -chmod -R u+rwx *.dir + -rm -rf *.dir # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/tests/defs.in b/tests/defs.in index 78cf37a99..d79d874e6 100644 --- a/tests/defs.in +++ b/tests/defs.in @@ -235,16 +235,35 @@ case "$srcdir" in ;; esac -chmod -R a+rwx testSubDir > /dev/null 2>&1 -rm -rf testSubDir > /dev/null 2>&1 -mkdir testSubDir +curdir=`pwd` +testSubDir=$me.dir +chmod -R u+rwx $testSubDir > /dev/null 2>&1 +rm -rf $testSubDir > /dev/null 2>&1 +mkdir $testSubDir + +trap 'exit_status=$? + cd "$curdir" + case $exit_status,$keep_testdirs in + 0,) + chmod -R a+rwx $testSubDir > /dev/null 2>&1 + rm -rf "$testSubDir" ;; + esac + test "$signal" != 0 && + echo "$as_me: caught signal $signal" + echo "$as_me: exit $exit_status" + exit $exit_status +' 0 +for signal in 1 2 13 15; do + trap 'signal='$signal'; { (exit 1); exit 1; }' $signal +done +signal=0 # Copy in some files we need. for file in install-sh missing depcomp; do - cp $srcdir/../lib/$file testSubDir/$file || exit 1 + cp $srcdir/../lib/$file $testSubDir/$file || exit 1 done -cd ./testSubDir +cd ./$testSubDir # Build appropriate environment in test directory. Eg create # configure.in, touch all necessary files, etc. -- 2.11.4.GIT