[PATCH nft] tests: monitor: run-tests.sh: restore cwd before unshare

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The monitor script no longer works if not called from tests/monitor directory:

% tests/monitor/run-tests.sh
unshare: failed to execute tests/monitor/run-tests.sh: No such file or directory

... because the script will change the directory.
Stash and restore to old one so unshare $0 can work.

Signed-off-by: Florian Westphal <fw@xxxxxxxxx>
---
 tests/monitor/run-tests.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/monitor/run-tests.sh b/tests/monitor/run-tests.sh
index 214512d269e8..7a8b1a719dc1 100755
--- a/tests/monitor/run-tests.sh
+++ b/tests/monitor/run-tests.sh
@@ -1,5 +1,6 @@
 #!/bin/bash
 
+pushd .
 cd $(dirname $0)
 nft=${NFT:-../../src/nft}
 debug=false
@@ -125,6 +126,7 @@ for arg in "$@"; do
 	[[ "$arg" == "--no-netns" ]] && netns=false
 done
 if $netns; then
+	popd
 	exec unshare -n $0 --no-netns "$@"
 fi
 
-- 
2.45.2





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux