From b20ff7b90a695ac931e5293a8b870b4f8919ac49 Mon Sep 17 00:00:00 2001 From: Kristof Provost Date: Thu, 18 Apr 2019 10:54:08 +0000 Subject: [PATCH] pf tests: Fail the test if we can't set the rules The test should fail if pf rules can't be set. This is helpful both while writing tests and to verify that pfctl works as expected. MFC after: 1 week Event: Aberdeen hackathon 2019 --- tests/sys/netpfil/pf/utils.subr | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/sys/netpfil/pf/utils.subr b/tests/sys/netpfil/pf/utils.subr index 915aba318d18..34236335d44a 100644 --- a/tests/sys/netpfil/pf/utils.subr +++ b/tests/sys/netpfil/pf/utils.subr @@ -40,6 +40,10 @@ pft_set_rules() printf "$1\n" shift done | jexec ${jname} pfctl -f - + if [ $? -ne 0 ]; + then + atf_fail "Failed to set PF rules in ${jname}" + fi } pft_cleanup()