Skip to contentSkip to conversation

tests: monitor: Become $PWD agnostic

PATCH In review Phil Sutter 1 participant 2 messages Nov 7, 2024 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 tests: monitor: Become $PWD agnostic

The call to 'cd' is problematic since later the script tries to 'exec unshare -n $0'. This is not the only problem though: Individual test cases specified on command line are expected to be relative to the script's directory, too. Just get rid of these nonsensical restrictions.

---
 tests/monitor/run-tests.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
tests/monitor/run-tests.sh +2 -3
index 36fc800c10520..9d25a395cbcf2 100755
@@ -1,7 +1,6 @@
 #!/bin/bash
 
-cd $(dirname $0)
-nft=${NFT:-../../src/nft}
+nft=${NFT:-$(dirname $0)/../../src/nft}
 debug=false
 test_json=false
 
@@ -192,7 +191,7 @@ while [ -n "$1" ]; do
 		nft=nft
 		shift
 		;;
-	testcases/*.t)
+	*.t)
 		testcases+=" $1"
 		shift
 		;;
Signature · 1 line
2.47.0
author reviewer
#1 lore raw
Quoted 7 lines · Phil Sutter

The call to 'cd' is problematic since later the script tries to 'exec unshare -n $0'. This is not the only problem though: Individual test cases specified on command line are expected to be relative to the script's directory, too. Just get rid of these nonsensical restrictions.

Patch applied.