tests: link the running interpreter in the GuestWatch test #675
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/675"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from brcly/TuxBox. Originally posted by gtb-sbe on 2026-12-03T14:21:38Z.
Problem
GuestWatch.test_a_guest_that_died_stops_the_sandbox_instead_of_waiting_out_the_timeoutfails on everycheck --no-gpuI run on NixOS, inside the repository's own dev shell:The test links
os.path.realpath(sys.executable)asstage-baseline.exeand expects the kernel to name the process after the link. In the flake's dev shell,sys.executableis nixpkgs'python3.withPackageswrapper, a small binary thatexecvs the real interpreter in another store path. That exec renames the process topython3.12, sowatch_guestnever sees astage-baselineprocess, waits out the 60 ssleep, and returns the shell's exit status.Change
Link
/proc/self/exe, the binary that is actually running, instead ofsys.executable. Outside such wrappers both resolve to the same file. The test already relies on/proc(process_states).Testing
On my machine (NixOS, Python 3.12.16):
python -m unittest tests.test_stage_baselinein the flake's dev shell: 14 tests OK (1 skipped), 2.2 s. Before: 1 failure after 62 s.python3.withPackageswrapper and with plain unwrapped nixpkgs Python plus pefile: OK both times.python tuxbox.py check --no-gpu: 13 passed, 0 failed (Evidence: TuxBox check of ed039b3b2d79, no uncommitted changes, no GPU checks: 13 passed, 0 failed, 0 not run). No GPU checks, since the change only touches a Python test.AI use
I made this branch with an AI coding agent (Claude Code, following
AGENTS.md). The agent found the cause (the nixpkgs wrapper'sexecv), wrote the change, and ran the tests and checks listed above on my machine.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.