git: 83d175fc2e4e - stable/15 - atf_python: Run vnet handlers in $HOME

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 16 Feb 2026 15:44:31 UTC
The branch stable/15 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=83d175fc2e4e882a483111b4269b7dc58addb0e0

commit 83d175fc2e4e882a483111b4269b7dc58addb0e0
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-02-02 14:52:43 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-02-16 13:43:18 +0000

    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
    
    (cherry picked from commit 07940d1d85eb338853fcba0697c6b9a96412a7f2)
---
 tests/atf_python/sys/net/vnet.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/atf_python/sys/net/vnet.py b/tests/atf_python/sys/net/vnet.py
index f75a3eaa693e..3d431685836a 100644
--- a/tests/atf_python/sys/net/vnet.py
+++ b/tests/atf_python/sys/net/vnet.py
@@ -354,6 +354,7 @@ class VnetTestTemplate(BaseTest):
         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)