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")
This commit is contained in:
Kristof Provost
2025-12-30 11:30:15 +01:00
parent 96c7e70c18
commit 2eec2bcca2
+2 -2
View File
@@ -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"