* [iptables PATCH] tests: shell: Fix for ineffective 0007-mid-restore-flush_0
@ 2023-09-14 7:31 Phil Sutter
2023-09-14 10:35 ` Phil Sutter
0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2023-09-14 7:31 UTC (permalink / raw)
To: netfilter-devel
The test did not catch non-zero exit status of the spawned coprocess. To
make it happen, Drop the line killing it (it will exit anyway) and pass
its PID to 'wait'.
While being at it, put the sleep into the correct spot (otherwise the
check for chain 'foo' existence fails as it runs too early) and make
said chain existence check effective.
Fixes: 4e3c11a6f5a94 ("nft: Fix for ruleset flush while restoring")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
.../shell/testcases/nft-only/0007-mid-restore-flush_0 | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/iptables/tests/shell/testcases/nft-only/0007-mid-restore-flush_0 b/iptables/tests/shell/testcases/nft-only/0007-mid-restore-flush_0
index 43880ffbc5851..981f007f205b9 100755
--- a/iptables/tests/shell/testcases/nft-only/0007-mid-restore-flush_0
+++ b/iptables/tests/shell/testcases/nft-only/0007-mid-restore-flush_0
@@ -13,11 +13,11 @@ COMMIT
:foo [0:0]
EOF
-$XT_MULTI iptables-save | grep -q ':foo'
+sleep 1
+$XT_MULTI iptables-save | grep -q ':foo' || exit 1
nft flush ruleset
echo "COMMIT" >&"${COPROC[1]}"
-sleep 1
-
-[[ -n $COPROC_PID ]] && kill $COPROC_PID
-wait
+# close the pipe to make iptables-restore exit if it didn't error out yet
+eval "exec ${COPROC[1]}>&-"
+wait $COPROC_PID
--
2.41.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [iptables PATCH] tests: shell: Fix for ineffective 0007-mid-restore-flush_0
2023-09-14 7:31 [iptables PATCH] tests: shell: Fix for ineffective 0007-mid-restore-flush_0 Phil Sutter
@ 2023-09-14 10:35 ` Phil Sutter
0 siblings, 0 replies; 2+ messages in thread
From: Phil Sutter @ 2023-09-14 10:35 UTC (permalink / raw)
To: netfilter-devel
On Thu, Sep 14, 2023 at 09:31:16AM +0200, Phil Sutter wrote:
> The test did not catch non-zero exit status of the spawned coprocess. To
> make it happen, Drop the line killing it (it will exit anyway) and pass
> its PID to 'wait'.
>
> While being at it, put the sleep into the correct spot (otherwise the
> check for chain 'foo' existence fails as it runs too early) and make
> said chain existence check effective.
>
> Fixes: 4e3c11a6f5a94 ("nft: Fix for ruleset flush while restoring")
> Signed-off-by: Phil Sutter <phil@nwl.cc>
Patch applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-14 10:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-14 7:31 [iptables PATCH] tests: shell: Fix for ineffective 0007-mid-restore-flush_0 Phil Sutter
2023-09-14 10:35 ` Phil Sutter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).