From 95a2d8b3b02c25e64b167223a4b314f8f8d57fa8 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Fri, 9 Sep 2011 12:47:57 +0200 Subject: [PATCH] tests: allow instspc.tap to only run a subset of its tests * tests/instspc.tap: If command-line arguments are passed to the tests, they are now taken as the list of test names for which the checks are to be run. --- ChangeLog | 7 +++++++ tests/instspc.tap | 25 +++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0aa5bc5..04959ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2011-09-09 Stefano Lattarini + tests: allow instspc.tap to only run a subset of its tests + * tests/instspc.tap: If command-line arguments are passed to the + tests, they are now taken as the list of test names for which the + checks are to be run. + +2011-09-09 Stefano Lattarini + coverage: distcheck-hook to catch missing/outdated *.m4 files Related to automake bug#9037. * tests/distcheck-missing-m4.test: New test. diff --git a/tests/instspc.tap b/tests/instspc.tap index 46f4b4e..6f819ef 100755 --- a/tests/instspc.tap +++ b/tests/instspc.tap @@ -21,8 +21,6 @@ . ./defs || Exit 99 -plan_ 94 # Two tests per "problematic string". - # Usage: is_in_list ITEM [LIST...] is_in_list () { @@ -41,7 +39,7 @@ define_problematic_string () eval "instspc__$tst=\$1" \ || fatal_ "define_problematic_string: bad argument: '$tst'" shift - test_names_list="$test_names_list $tst" + all_test_names_list="$all_test_names_list $tst" # Some of the "problematic" characters cannot be used in the name of # a build or install directory on a POSIX host. These lists should # be empty, but are not due to limitations in Autoconf, Automake, Make, @@ -55,7 +53,7 @@ define_problematic_string () } # Be sure to avoid interferences from the environment. -test_names_list='' +all_test_names_list='' builddir_xfails='' destdir_xfails='' @@ -210,6 +208,25 @@ unset def # Test data end # # =============== # +# Allow the user to select a subset of the tests. +if test $# -gt 0; then + test_names_list=$* + for test_name in $test_names_list; do + case " $all_test_names_list " in + *" $test_name "*);; + *) fatal_ "invalid user-specified test_name '$test_name'" + esac + done + # We need to determine the TAP plan adaptively. + n=`for t in $test_names_list; do echo $t; done | wc -l` + plan_ `expr $n '*' 2` # Two tests per "problematic string". + unset n +else + test_names_list=$all_test_names_list + # Prefer static TAP plan if possible, minimizes the chance of errors. + plan_ 94 +fi + ocwd=`pwd` || fatal_ "cannot get current working directory" create_input_data -- 2.7.4