aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2025-12-30 10:30:15 +0000
committerKristof Provost <kp@FreeBSD.org>2025-12-30 13:16:53 +0000
commit2eec2bcca2972b58fb8e9acb65c208af423f2181 (patch)
tree1635f1043d62209a9253c71aefc923b051d68094
parent96c7e70c18a42e8cad9305db2a3b30328d76d84f (diff)
pf tests: avoid cleanup failures on skipped tests
If we skip the nat:binat_* tests (e.g. because pf.ko isn't loaded) the inetd_tester.pid file isn't created. We still run the cleanup function, which tries to use this file to clean up the test environment. This results in 'broken: Test case cleanup did not terminate successfully'. Avoid this by checking if the pid file exists before using it. Sponsored by: Rubicon Communications, LLC ("Netgate")
-rw-r--r--tests/sys/netpfil/pf/nat.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/sys/netpfil/pf/nat.sh b/tests/sys/netpfil/pf/nat.sh
index 3d953b495953..025471f75f97 100644
--- a/tests/sys/netpfil/pf/nat.sh
+++ b/tests/sys/netpfil/pf/nat.sh
@@ -804,8 +804,8 @@ binat_compat_body()
binat_compat_cleanup()
{
+ [ -f ${PWD}/inetd_tester.pid ] && kill $(cat ${PWD}/inetd_tester.pid)
pft_cleanup
- kill $(cat ${PWD}/inetd_tester.pid)
}
atf_test_case "binat_match" "cleanup"
@@ -872,8 +872,8 @@ binat_match_body()
binat_match_cleanup()
{
+ [ -f ${PWD}/inetd_tester.pid ] && kill $(cat ${PWD}/inetd_tester.pid)
pft_cleanup
- kill $(cat ${PWD}/inetd_tester.pid)
}
atf_test_case "empty_pool" "cleanup"