Skip to contentSkip to conversation

tests: monitor: Fix for out-of-path call

PATCH In review Phil Sutter 1 participant 2 messages Dec 16, 2025 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 tests: monitor: Fix for out-of-path call

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")
---
 tests/monitor/run-tests.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/monitor/run-tests.sh +1 -1
index 44f21a285b17c..26293e12b9a01 100755
@@ -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 testcase in ${testcases:-testcases/*.t}; do
+		for testcase in ${testcases:-$(dirname $0)/testcases/*.t}; do
 			run_testcase "$testcase"
 			let "total_rc += $?"
 		done
Signature · 1 line
2.51.0
author reviewer
#1 lore raw
Quoted 13 lines · Phil Sutter

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
Quoted 2 lines
Fixes 83eaf50c36fe8 ("tests: monitor: Become $PWD agnostic")

Patch applied.