Repository navigation
test: write test executables out of process - #13111
Merged
Merged
Conversation
#13056 avoided executables that a concurrently forked child kept busy in five ways: shell functions, a symlinked /bin/cat, /bin/sh symlinked as python3, scripts run through /bin/sh, and a retry loop. A child process now writes each test executable, so this process never holds it open for writing and no fork can inherit that descriptor. The SSH collector, recipe, vLLM launch, and SDK postcondition tests go back to plain scripts, and the scripted OpenTofu no longer needs its warm-up retry. The staged provider in nemoclaw-test-fixtures still runs through /bin/sh: the code under test writes that file, not the test.
Contributor
|
v1 documentation preview: https://nvidia-preview-nemoclaw-v1-pr-13111.docs.buildwithfern.com/nemoclaw |
cv
enabled auto-merge (squash)
October 13, 2026 18:44
cv
added a commit
that referenced
this pull request
Oct 13, 2026
`deployment.rs` and `scripted_tofu.rs` now share one test bundle writer. Stacked on #13112. ## Why Both tests wrote a bundle whose manifest verifies. `scripted_tofu.rs` (#13081) kept a copy of `deployment.rs::write_bundle` that differed only for `libexec/tofu`, because `deployment.rs` also runs on Windows and the scripted copy needs Unix. ## Change - `tests/support/bundle.rs` adds `write_bundle(directory, tofu: Option<&str>)`. Without a script, every file is a non-executable fixture. With one, `libexec/tofu` is that script, written with `write_executable` from #13111. Passing a script on a platform other than Unix panics. - `deployment.rs` and `scripted_tofu.rs` call it and drop their own copies. I left two other duplicates alone: - `Events` in `nemoclaw-e2e/tests/helm_recovery.rs`, which is two methods long. - `Snapshot` there and `Untouched` in `kubernetes_interruption.rs`, which check different state. Both sit in other crates, so sharing them would mean adding them to `nemoclaw-test-fixtures` for little gain. ## Validation - `cargo test -p nemoclaw-sdk --test integration`: 444 passed. - `cargo ci` on linux_arm64: all steps passed. GitHub CI checks the Windows build of `deployment.rs`; I couldn't cross-compile it here.
cv
added a commit
that referenced
this pull request
Oct 13, 2026
Removes the mutex that made scripted OpenTofu tests run one at a time. Stacked on #13111. ## Why `scripted_tofu.rs` (#13081) held a process-wide `ONE_AT_A_TIME` mutex for each `Scripted` fixture. Its comment gave the reason: a child that another thread forks while `Deployment` holds its lock file keeps the lock until it calls exec, so the next operation could find the deployment locked. #13056 fixed that cause in `Store::drop`, which now unlocks the file explicitly, so the lock is released when an operation ends even if a child still holds a copy of the descriptor. Nextest already runs each test in its own process. The mutex only slowed `cargo test`, which runs tests as threads of one process. ## Change Remove `ONE_AT_A_TIME` and the guard that `Scripted` held. ## Validation - `cargo test -p nemoclaw-sdk --test integration`: 12 rounds passed. The binary takes about 5 s instead of about 17 s. - `cargo test -p nemoclaw-sdk --test integration kubernetes_interruption -- --test-threads=32`: 20 rounds passed. - `cargo ci` on linux_arm64: all steps passed.
This was referenced Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test executables are now written by a child process, so a concurrently forked child cannot keep them busy. That replaces the workarounds #13056 added one test at a time.
Why
The kernel refuses to run a file that any process holds open for writing (
ExecutableFileBusy). When a test thread writes a script, a child that another thread forks at that moment inherits the writable descriptor until it calls exec. #13056 worked around this differently in each test:dockerandnvidia-smias shell functions, with an alias for the hyphenated name/bin/cat, replaced by a real directory to tamper with it/bin/shsymlinked aspython3, reading a module-named file from the working directory/bin/shwarmloop that retriedtofu inituntil the file was no longer busyChange
crates/test-support/executable.rsaddswrite_executable(path, contents). It pipes the contents to/bin/sh -c 'cat > "$1" && chmod 700 "$1"', so the test process never opens the file and no fork can inherit a writable descriptor for it.--modeldirectory argument that fix: report bounded OpenShell rejections and harden teardown, locking, and test fixtures #13056 added.warmand the call-log reset that followed it.nemoclaw-test-fixturesstill runs through/bin/sh, because the code under test writes that file, not the test.Validation
cargo test -p nemoclaw-provider --lib,-p nemoclaw-runtime --lib, and-p nemoclaw-sdk --test integration: eight rounds each, all passed.ExecutableFileBusyon this host, even with the in-process writes this replaces. So these runs show that the tests still pass, not that the race is gone. The fix rests on the reasoning above.cargo cion linux_arm64: all steps passed. Windows and macOS cfg gates are checked only by GitHub CI.