git: 4c7dba0c93fc - stable/15 - atf_python: allow test scripts to pass jail options
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 05 Oct 2025 20:51:49 UTC
The branch stable/15 has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=4c7dba0c93fcec7f7db5d8a1aa8b98be07caff71
commit 4c7dba0c93fcec7f7db5d8a1aa8b98be07caff71
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-09-27 14:38:19 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-10-05 20:47:34 +0000
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)
---
tests/atf_python/sys/net/vnet.py | 12 ++++++++----
1 file 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)