Linux Netfilter development
 help / color / mirror / Atom feed
* [PATCH nft] tests: monitor: run-tests.sh: restore cwd before unshare
@ 2024-11-07 12:56 Florian Westphal
  2024-11-07 13:39 ` Phil Sutter
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2024-11-07 12:56 UTC (permalink / raw)
  To: netfilter-devel; +Cc: phil, Florian Westphal

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@strlen.de>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-07 13:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07 12:56 [PATCH nft] tests: monitor: run-tests.sh: restore cwd before unshare Florian Westphal
2024-11-07 13:39 ` Phil Sutter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox