aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2025-09-27 16:38:19 +0200
committerKristof Provost <kp@FreeBSD.org>2025-10-05 22:47:34 +0200
commit4c7dba0c93fcec7f7db5d8a1aa8b98be07caff71 (patch)
treeb41d332d64a9d7c736520d498d44b714df694d94 /tests
parentff566e6b9b8fad0dc51184fa80e3b1269781f580 (diff)
atf_python: allow test scripts to pass jail options
Test scripts based on atf_python can now pass jail command options via the 'opts' key in the 'vnetX' key of TOPOLOGY. Reviewed by: melifaro MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D52761 (cherry picked from commit 2213e158886f72f45f288c94069a9a40c4f334ed)
Diffstat (limited to 'tests')
-rw-r--r--tests/atf_python/sys/net/vnet.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/atf_python/sys/net/vnet.py b/tests/atf_python/sys/net/vnet.py
index c96eb5d671fc..f75a3eaa693e 100644
--- a/tests/atf_python/sys/net/vnet.py
+++ b/tests/atf_python/sys/net/vnet.py
@@ -283,14 +283,15 @@ class VnetFactory(object):
time.sleep(0.1)
return not_matched
- def create_vnet(self, vnet_alias: str, ifaces: List[VnetInterface]):
+ def create_vnet(self, vnet_alias: str, ifaces: List[VnetInterface], opts: List[str]):
vnet_name = "pytest:{}".format(convert_test_name(self.topology_id))
if self._vnets:
# add number to distinguish jails
vnet_name = "{}_{}".format(vnet_name, len(self._vnets) + 1)
iface_cmds = " ".join(["vnet.interface={}".format(i.name) for i in ifaces])
- cmd = "/usr/sbin/jail -i -c name={} persist vnet {}".format(
- vnet_name, iface_cmds
+ opt_cmds = " ".join(["{}".format(i) for i in opts])
+ cmd = "/usr/sbin/jail -i -c name={} persist vnet {} {}".format(
+ vnet_name, iface_cmds, opt_cmds
)
jid = 0
try:
@@ -421,7 +422,10 @@ class VnetTestTemplate(BaseTest):
idx = len(iface_map[iface_alias].vnet_aliases)
iface_map[iface_alias].vnet_aliases.append(obj_name)
vnet_ifaces.append(iface_map[iface_alias].ifaces[idx])
- vnet = vnet_factory.create_vnet(obj_name, vnet_ifaces)
+ opts = []
+ if "opts" in obj_data:
+ opts = obj_data["opts"]
+ vnet = vnet_factory.create_vnet(obj_name, vnet_ifaces, opts)
vnet_map[obj_name] = vnet
# Allow reference to VNETs as attributes
setattr(self, obj_name, vnet)