Page MenuHomeFreeBSD

atf_python: Run vnet handlers in $HOME
ClosedPublic

Authored by markj on Jan 30 2026, 3:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Feb 28, 4:28 AM
Unknown Object (File)
Thu, Feb 26, 11:24 AM
Unknown Object (File)
Fri, Feb 20, 9:42 AM
Unknown Object (File)
Wed, Feb 18, 6:11 AM
Unknown Object (File)
Wed, Feb 18, 3:12 AM
Unknown Object (File)
Tue, Feb 17, 8:24 PM
Unknown Object (File)
Sat, Feb 14, 11:08 AM
Unknown Object (File)
Tue, Feb 10, 10:21 PM

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

zlei added a subscriber: zlei.

Looks good to me.

This revision is now accepted and ready to land.Jan 30 2026, 5:00 PM

What was the directory at this point in the tests prior to this change?

tests/atf_python/sys/net/vnet.py
8

To support the suggested change below.

360

Using tempfile.gettempdir() is better since it's more explicit.

What was the directory at this point in the tests prior to this change?

The root of the jail.

tests/atf_python/sys/net/vnet.py
360

But that's not what I want. It's more useful for vnet handlers to start in the same directory as the main test thread.

tests/atf_python/sys/net/vnet.py
360

The jail module/support in atf_python, etc doesn't maintain the tempdir sandboxing support, even symmetrically between the jails?

tests/atf_python/sys/net/vnet.py
360

The test-provided vnet handler invoked below runs in the root of the jail, yes. The vnet.attach() call immediately above is what causes that.

ngie added inline comments.
tests/atf_python/sys/net/vnet.py
360

Bummer... that violates POLA for kyua as the default expectation is for kyua put all of the temporary files in temp sandbox directory and to clean everything up when done.

This revision was automatically updated to reflect the committed changes.