From 836ca56434e2d63b9ad8324a0b551f789878c3f6 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sat, 13 Aug 2011 11:52:26 +0200 Subject: [PATCH] testsuite: fixlets and improvements in two long TAP-based tests * tests/depmod.tap: Clean up the subdirectories used by tests that passed, to avoid ending up with a too big test directory. This is especially important since, on each and every system, at least some tests in this script are expected to be skipped (which ones exactly depends on the system), thus causing the test directory not to be removed when the script terminates. * tests/instspc.tap: Likewise (with the difference that tests here are not expected to be skipped, but to xfail). Give more explicit error message in case of setup failure. Skip the proper number of tests when required, to avoid spurious errors due to mismatched plan. Also, really avoid to run the unsupported test cases when the need to skip them is detected. --- ChangeLog | 16 ++++++++++++++++ tests/depmod.tap | 26 +++++++++++++++++++++----- tests/instspc.tap | 22 +++++++++++++++++----- 3 files changed, 54 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index d91bc59..1d4ee09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2011-08-13 Stefano Lattarini + + testsuite: fixlets and improvements in two long TAP-based tests + * tests/depmod.tap: Clean up the subdirectories used by tests that + passed, to avoid ending up with a too big test directory. This is + especially important since, on each and every system, at least some + tests in this script are expected to be skipped (which ones exactly + depends on the system), thus causing the test directory not to be + removed when the script terminates. + * tests/instspc.tap: Likewise (with the difference that tests here + are not expected to be skipped, but to xfail). Give more explicit + error message in case of setup failure. Skip the proper number of + tests when required, to avoid spurious errors due to mismatched + plan. Also, really avoid to run the unsupported test cases when + the need to skip them is detected. + 2011-08-09 Stefano Lattarini test harness: recursive make invocations must use $(AM_MAKEFLAGS) diff --git a/tests/depmod.tap b/tests/depmod.tap index 82fd844..c40fea8 100755 --- a/tests/depmod.tap +++ b/tests/depmod.tap @@ -146,28 +146,44 @@ for vpath in simple long absolute; do mkdir $depmode-$vpath.d cd $depmode-$vpath.d - command_ok_ "$pfx configure" \ - "$srcdir"/configure am_cv_CC_dependencies_compiler_type=$depmode + if "$srcdir"/configure am_cv_CC_dependencies_compiler_type=$depmode + then + r0='ok' + else + r0='not ok' + fi + result_ "$r0" "$pfx configure" \ # Do not fail with the first call to make fails, as the depmode # we've forced might not actually work, but we have overridden the # _AM_DEPENDENCIES tests. + r1='not ok' if $MAKE; then # We must clean and rebuild, as the actual error only happens the # second time the objects are built because 'depcomp' has silently # messed up the .Po files the first time. - r=ok $MAKE clean \ && { e=0; $MAKE >output 2>&1 || e=1; cat output; test $e -eq 0; } \ && { if grep 'src/[._]deps' output; then false; else :; fi; } \ - || r='not ok' - result_ "$r" "$pfx make & remake" + && r1='ok' + result_ "$r1" "$pfx make & remake" else skip_ -r "can't force depmode" "$pfx make & remake" fi cd "$ocwd" || fatal_ "cannot chdir back to top directory" + # Remove subdirectories for tests that have passed, to avoid ending up + # with a too big test directory. This is especially important since, + # on each and every system, at least some tests in this script are + # expected to be skipped (which ones exactly depends on the system), + # thus causing the test directory not to be removed when the script + # terminates. + case $keep_testdirs,$r0,$r1 in + ,ok,ok) rm_rf_ $depmode-$vpath.d;; + *) : For lesser shells with broken 'set -e';; + esac + done done diff --git a/tests/instspc.tap b/tests/instspc.tap index dc52299..46f4b4e 100755 --- a/tests/instspc.tap +++ b/tests/instspc.tap @@ -136,9 +136,9 @@ EOF test -f '$(DESTDIR)/$(file)-prefix/foo/libbase.a' EOF - $ACLOCAL - $AUTOCONF - $AUTOMAKE -a + $ACLOCAL || framework_failure_ "aclocal failed" + $AUTOCONF || framework_failure_ "autoconf failed" + $AUTOMAKE || framework_failure_ "automake failed" } # ================= # @@ -223,8 +223,11 @@ for test_name in $test_names_list; do # Skip the next checks if this system doesn't support the required # characters in file names. - mkdir "./$test_string" || \ - skip_ -r "mkdir failed" "$test_name" + mkdir "./$test_string" || { + skip_ -r "mkdir failed" "$test_name in builddir" + skip_ -r "mkdir failed" "$test_name in destdir" + continue + } # Where are the "weird" characters going to be used, in $(builddir) # or in $(DESTDIR)? They are always going to be used in $(prefix) @@ -271,6 +274,15 @@ for test_name in $test_names_list; do cd "$ocwd" || fatal_ "cannot chdir back to test directory" + # Remove subdirectories for tests that have passed, to avoid ending up + # with a too big test directory. This is especially important since + # some tests in this tests are expected to fail, and this will cause + # the test directory not to be removed when the script terminates. + case $keep_testdirs,$r1 in + ,ok) rm_rf_ $depmode-$vpath.d;; + *) : For lesser shells with broken 'set -e';; + esac + done # $instspc_action done # $test_name -- 2.7.4