git: 1977d9a37b88 - main - pf tests: factor out common dummynet check
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 May 2022 19:58:15 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=1977d9a37b880657512f16bd46e0656c02d19b29
commit 1977d9a37b880657512f16bd46e0656c02d19b29
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-05-09 10:14:00 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-05-12 19:50:10 +0000
pf tests: factor out common dummynet check
Reviewed by: glebius
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35160
---
tests/sys/netpfil/pf/ether.sh | 6 +-----
tests/sys/netpfil/pf/match.sh | 5 +----
tests/sys/netpfil/pf/utils.subr | 9 +++++++++
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/tests/sys/netpfil/pf/ether.sh b/tests/sys/netpfil/pf/ether.sh
index da936c9cfaeb..975438dc3438 100644
--- a/tests/sys/netpfil/pf/ether.sh
+++ b/tests/sys/netpfil/pf/ether.sh
@@ -326,11 +326,7 @@ captive_long_body()
# Host is client, jail 'gw' is the captive portal gateway, jail 'srv'
# is a random (web)server. We use the echo protocol rather than http
# for the test, because that's easier.
- pft_init
-
- if ! kldstat -q -m dummynet; then
- atf_skip "This test requires dummynet"
- fi
+ dummynet_init
epair_gw=$(vnet_mkepair)
epair_srv=$(vnet_mkepair)
diff --git a/tests/sys/netpfil/pf/match.sh b/tests/sys/netpfil/pf/match.sh
index 304c4e01ea71..d6bcf7aeb1bf 100644
--- a/tests/sys/netpfil/pf/match.sh
+++ b/tests/sys/netpfil/pf/match.sh
@@ -36,10 +36,7 @@ dummynet_head()
dummynet_body()
{
- pft_init
- if ! kldstat -q -m dummynet; then
- atf_skip "This test requires dummynet"
- fi
+ dummynet_init
epair=$(vnet_mkepair)
vnet_mkjail alcatraz ${epair}b
diff --git a/tests/sys/netpfil/pf/utils.subr b/tests/sys/netpfil/pf/utils.subr
index a010374993ff..f4f7f4fe4d83 100644
--- a/tests/sys/netpfil/pf/utils.subr
+++ b/tests/sys/netpfil/pf/utils.subr
@@ -87,6 +87,15 @@ pflog_init()
fi
}
+dummynet_init()
+{
+ pft_init
+
+ if ! kldstat -q -m dummynet; then
+ atf_skip "This test requires dummynet"
+ fi
+}
+
pft_set_rules()
{
jname=$1