]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: allow instspc.tap to only run a subset of its tests
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 9 Sep 2011 10:47:57 +0000 (12:47 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 9 Sep 2011 10:47:57 +0000 (12:47 +0200)
* 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
tests/instspc.tap

index 0aa5bc51e168948103d4ccae7ac9a8dd68e73bec..04959add3deb06a5b7e598e51dedf67b5178f836 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-09-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       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  <stefano.lattarini@gmail.com>
 
        coverage: distcheck-hook to catch missing/outdated *.m4 files
index 46f4b4e2d52cce846153b0d7469c2b52e22953b1..6f819efbc14cc979593130d8804c728ed4250cae 100755 (executable)
@@ -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