]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: monitor: Fix for out-of-path call master
authorPhil Sutter <phil@nwl.cc>
Tue, 16 Dec 2025 14:36:23 +0000 (15:36 +0100)
committerPhil Sutter <phil@nwl.cc>
Tue, 16 Dec 2025 15:27:44 +0000 (16:27 +0100)
When called from another directory without specifying test cases, an
incorrect regexp was used to glob all tests and no test was run at all:

| # ./tests/monitor/run-tests.sh
| echo: running tests from file *.t
| ./tests/monitor/run-tests.sh: line 201: testcases/*.t: No such file or directory
| monitor: running tests from file *.t
| ./tests/monitor/run-tests.sh: line 201: testcases/*.t: No such file or directory
| json-echo: running tests from file *.t
| ./tests/monitor/run-tests.sh: line 201: testcases/*.t: No such file or directory
| json-monitor: running tests from file *.t
| ./tests/monitor/run-tests.sh: line 201: testcases/*.t: No such file or directory

Fixes: 83eaf50c36fe8 ("tests: monitor: Become $PWD agnostic")
Signed-off-by: Phil Sutter <phil@nwl.cc>
tests/monitor/run-tests.sh

index 44f21a285b17ce0e25736e93b032b76e64cb4651..26293e12b9a010ca0823fccc9ccd4574ba0442fa 100755 (executable)
@@ -253,7 +253,7 @@ total_rc=0
 for syntax in ${syntaxes:-standard json}; do
        [ $syntax == json ] && test_json=true || test_json=false
        for variant in ${variants:-echo monitor}; do
 for syntax in ${syntaxes:-standard json}; do
        [ $syntax == json ] && test_json=true || test_json=false
        for variant in ${variants:-echo monitor}; do
-               for testcase in ${testcases:-testcases/*.t}; do
+               for testcase in ${testcases:-$(dirname $0)/testcases/*.t}; do
                        run_testcase "$testcase"
                        let "total_rc += $?"
                done
                        run_testcase "$testcase"
                        let "total_rc += $?"
                done