Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Sep 2025 12:53:35 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 2213e158886f - main - atf_python: allow test scripts to pass jail options
Message-ID:  <202509301253.58UCrZSw061723@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=2213e158886f72f45f288c94069a9a40c4f334ed

commit 2213e158886f72f45f288c94069a9a40c4f334ed
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-09-27 14:38:19 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-09-30 12:53:17 +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
---
 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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202509301253.58UCrZSw061723>