]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: monitor: Support running individual test cases
authorPhil Sutter <phil@nwl.cc>
Fri, 10 Jan 2020 10:15:45 +0000 (11:15 +0100)
committerPhil Sutter <phil@nwl.cc>
Fri, 10 Jan 2020 11:37:25 +0000 (12:37 +0100)
Recognize testcase paths on command line and limit testing on those
only.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/monitor/run-tests.sh

index 0478cf60c0dfedc020e45619c7dba1a1f83f0a20..efacdaaab952b399acc65b4077ae38e866f5a653 100755 (executable)
@@ -108,6 +108,7 @@ echo_run_test() {
        touch $output_file
 }
 
+testcases=""
 while [ -n "$1" ]; do
        case "$1" in
        -d|--debug)
@@ -118,11 +119,15 @@ while [ -n "$1" ]; do
                test_json=true
                shift
                ;;
+       testcases/*.t)
+               testcases+=" $1"
+               shift
+               ;;
        *)
                echo "unknown option '$1'"
                ;&
        -h|--help)
-               echo "Usage: $(basename $0) [-j|--json] [-d|--debug]"
+               echo "Usage: $(basename $0) [-j|--json] [-d|--debug] [testcase ...]"
                exit 1
                ;;
        esac
@@ -138,7 +143,7 @@ for variant in $variants; do
        run_test=${variant}_run_test
        output_append=${variant}_output_append
 
-       for testcase in testcases/*.t; do
+       for testcase in ${testcases:-testcases/*.t}; do
                echo "$variant: running tests from file $(basename $testcase)"
                # files are like this:
                #