Tests record a failure by setting the global ret=1 and the script ends with exit $ret. test_queue() overwrites that flag with the status of a bare wait, which is always 0. test_queue_bridge() runs last and calls test_queue() twice, so a failure recorded by any earlier test is lost and the script exits 0. Drop the assignment: test_queue() checks the listener output itself and exits on a mismatch.
Three connectivity checks exit with $ret after printing FAIL; ret is still 0 when nothing has failed before, so the script exits 0 there as well. Exit with 1. Replacing the test_hook_drop_scope call with ret=1 shows the difference: the script exited 0 before this patch and exits 1 with it. Reported-by: Sashiko (nipa) <[email protected]> Closes: https://lore.kernel.org/netfilter-devel/[email protected]/ Assisted-by: LLM Signed-off-by: Antonio Ojea <[email protected]> --- .../testing/selftests/net/netfilter/nft_queue.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/net/netfilter/nft_queue.sh b/tools/testing/selftests/net/netfilter/nft_queue.sh index a07652813a4b..516d9012d2e4 100755 --- a/tools/testing/selftests/net/netfilter/nft_queue.sh +++ b/tools/testing/selftests/net/netfilter/nft_queue.sh @@ -240,17 +240,16 @@ test_queue() busywait "$BUSYWAIT_TIMEOUT" nf_queue_wait "$nsrouter" 1 if ! test_ping;then - echo "FAIL: netns routing/connectivity with active listener on queues 0 and 1: $ret" 1>&2 - exit $ret + echo "FAIL: netns routing/connectivity with active listener on queues 0 and 1" 1>&2 + exit 1 fi if ! test_ping_router;then - echo "FAIL: netns router unreachable listener on queue 0 and 1: $ret" 1>&2 - exit $ret + echo "FAIL: netns router unreachable listener on queue 0 and 1" 1>&2 + exit 1 fi wait - ret=$? for file in $TMPFILE0 $TMPFILE1; do last=$(tail -n1 "$file") @@ -851,7 +850,7 @@ test_queue_bridge() if ! test_ping;then echo "FAIL: netns bridge connectivity" 1>&2 - exit $ret + exit 1 fi load_ruleset "bridge" "filter" 10 @@ -979,8 +978,8 @@ if test_ping; then # queue bypass works (rules were skipped, no listener) echo "PASS: ${ns1} can reach ${ns2}" else - echo "FAIL: ${ns1} cannot reach ${ns2}: $ret" 1>&2 - exit $ret + echo "FAIL: ${ns1} cannot reach ${ns2}" 1>&2 + exit 1 fi test_queue_blackhole ip -- 2.56.0.218.g1ec904b173-goog
