selftests: netfilter: Avoid hanging ipvs.sh
Subsystems (3)
Phil Sutter
reviewerPATCH v2 1/1 selftests: netfilter: Avoid hanging ipvs.sh
If the client can't reach the server, the latter remains listening forever. Kill it after 5s of waiting.
Fixes 867d2190799ab ("selftests: netfilter: add ipvs test script")
Signed-off-by Phil Sutter <[email protected]>
---
Changes since v1:
- Don't rely upon availability of 'waitpid' but use 'timeout' instead.
--- tools/testing/selftests/net/netfilter/ipvs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/netfilter/ipvs.sh +1 -1
@@ -97,7 +97,7 @@ cleanup() { } server_listen() { - ip netns exec "$ns2" socat -u -4 TCP-LISTEN:8080,reuseaddr STDOUT > "${outfile}" & + ip netns exec "$ns2" timeout 5 socat -u -4 TCP-LISTEN:8080,reuseaddr STDOUT > "${outfile}" & server_pid=$! sleep 0.2 }
Signature · 1 line
2.43.0
Quoted 2 lines · Phil Sutter
If the client can't reach the server, the latter remains listening forever. Kill it after 5s of waiting.
This looks more similar to what I have seen.
I have to admit I am still learning the common idioms that are used in selftest.
Applied, thanks.