atf_python: Run vnet handlers in $HOME

When kyua runs a test, it creates a temp directory and sets $HOME to
point to it.  Tests are run with the cwd set to that temp directory.

When a process attaches to a jail, its cwd is set to the root of the
jail.  Modify atf_python to cd to $HOME instead, so that it's easier for
tests to share files.

Reviewed by:	zlei, ngie
MFC after:	2 weeks
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D54971
This commit is contained in:
Mark Johnston
2026-02-02 14:52:43 +00:00
parent d0309745e6
commit 07940d1d85
+1
View File
@@ -357,6 +357,7 @@ def _setup_vnet(self, vnet: VnetInstance, obj_map: Dict, pipe):
vnetX_handler() after setting up interface addresses
"""
vnet.attach()
os.chdir(os.getenv("HOME"))
print("# setup_vnet({})".format(vnet.name))
if pipe is not None:
vnet.set_pipe(pipe)