From b5ddc39a6c7c091027a6c4866bfeafbd41ab84ab Mon Sep 17 00:00:00 2001 From: Christian Thaeter Date: Thu, 30 Aug 2007 00:27:17 +0200 Subject: [PATCH] add tests specifications test.sh running only the tests which match specifications given as arguments or in the env var TESTSUITES --- tests/test.sh | 37 ++++++++++++++++++++++++------------- wiki/index.html | 6 ++++-- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/tests/test.sh b/tests/test.sh index ed8d6a35b..571e8572a 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -188,20 +188,29 @@ function PLANNED() function RUNTESTS() { - for i in $srcdir/*.tests; do - source $i - done - echo - if [ $FAILCNT = 0 ]; then - echo " ... PASSED $(($TESTCNT - $SKIPCNT)) TESTS, $SKIPCNT SKIPPED" - #rm ,testlog - else - echo " ... SUCCEDED $(($TESTCNT - $FAILCNT - $SKIPCNT)) TESTS" - echo " ... FAILED $FAILCNT TESTS" - echo " ... SKIPPED $SKIPCNT TESTS" - echo " see ',testlog' for details" - exit 1 + if test "$TESTSUITES" != ''; then + if test ! "${TESTSUITES/* */}"; then + TESTSUITES={${TESTSUITES/ /,}} + fi fi + for t in $(eval echo *$TESTSUITES*.tests); do + echo "$t" + done | sort | uniq | { + while read i; do + source $i + done + echo + if [ $FAILCNT = 0 ]; then + echo " ... PASSED $(($TESTCNT - $SKIPCNT)) TESTS, $SKIPCNT SKIPPED" + #rm ,testlog + else + echo " ... SUCCEDED $(($TESTCNT - $FAILCNT - $SKIPCNT)) TESTS" + echo " ... FAILED $FAILCNT TESTS" + echo " ... SKIPPED $SKIPCNT TESTS" + echo " see ',testlog' for details" + exit 1 + fi + } } function TESTING() @@ -211,4 +220,6 @@ function TESTING() TESTBIN=$2 } +TESTSUITES="${TESTSUITES:+$TESTSUITES }$@" + RUNTESTS diff --git a/wiki/index.html b/wiki/index.html index 5e9b52bef..4511f4c20 100755 --- a/wiki/index.html +++ b/wiki/index.html @@ -3455,7 +3455,7 @@ Portions written by Luke Blanshard are hereby released into the public domain. <!--}}}--> -
+
! The Test Script
 There is a simple test script in tests which will be used to drive various tests. All tests are run under valgrind control if available unless {{{VALGRINDFLAGS=DISABLE}}} is defined. This test script is integrated in the automake build and will be used when {{{make check}}} is called.
 
@@ -3464,11 +3464,13 @@ One may define {{{TESTMODE}}} containing any one of the following strings:
 * {{{FAST}}} only run tests which failed recently
 * {{{FIRSTFAIL}}} abort the tests at the first failure
 
+The variable {{{TESTSUITES}}} may contain a list of string which are used to select which tests are run. If not given, all available tests are run.
+
 putting this together a very fast check (when using automake) while hacking on the source would look like:
 {{{
 VALGRINDFLAGS=DISABLE TESTMODE=FAST+FIRSTFAIL make check
 }}}
-This doesnt catch all errors, notably not regressions, but is useful to do coarse checks.
+This doesn't catch all errors, notably not regressions, but is useful to do coarse checks.
 
 Running the testsuite with everything enabled is just:
 {{{