]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: allow to execute a single testcase
authorArturo Borrero Gonzalez <arturo@debian.org>
Wed, 16 Nov 2016 12:51:52 +0000 (13:51 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 24 Nov 2016 12:01:16 +0000 (13:01 +0100)
Using, for example:
 % sudo ./run-tests.sh testcase/mytest_0

Will result in an execution of this single testcase rather than
the complete suite.

This is useful while working with a concrete testcase.

Signed-off-by: Arturo Borrero Gonzalez <arturo@debian.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/run-tests.sh

index d9c44c804004ec9fe675555ebdaa11379bfd492d..4e41893eaf28c5848f250503be7864ae82f9fd63 100755 (executable)
@@ -43,6 +43,13 @@ if [ ! -x "$MODPROBE" ] ; then
        msg_error "no modprobe binary found"
 fi
 
+if [ -x "$1" ] ; then
+       if grep ^.*${RETURNCODE_SEPARATOR}[0-9]\\+$ <<< $1 >/dev/null ; then
+               SINGLE=$1
+               VERBOSE=y
+       fi
+fi
+
 if [ "$1" == "-v" ] ; then
        VERBOSE=y
 fi
@@ -65,6 +72,10 @@ kernel_cleanup() {
 }
 
 find_tests() {
+       if [ ! -z "$SINGLE" ] ; then
+               echo $SINGLE
+               return
+       fi
        ${FIND} ${TESTDIR} -executable -regex \
                .*${RETURNCODE_SEPARATOR}[0-9]+ | sort
 }