Skip to content

test: build fixtures before a test runs its own binary again - #745

Merged
vyncint merged 1 commit into
mainfrom
fix/0119-fixture-race
Nov 11, 2026
Merged

vyncint merged 1 commit into
mainfrom
fix/0119-fixture-race

Conversation

@vyncint

@vyncint vyncint commented Nov 11, 2026

Copy link
Copy Markdown
Owner

The stress run on the v0.11.9 release commit (42930480712) failed three
macOS shards, at 2, 8 and 16 threads, with "fixture binary missing at
target/release/emit" in basic.rs and artifact.rs, right after a cargo
build that had succeeded.

Two tests added for #709 and #711 run their own test binary again, with
an environment of their own. fixture_bin builds each fixture once per
process, so every such child ran cargo build -p emit too, and cargo
relinks the binary (removes it, then links it again) even when nothing
is stale, while tests in the parent process were running it: the race
#278 fixed for the inspect example, reopened.

common::rerun_self now builds the fixtures a child needs in the parent
and marks the child (TERMLENS_TEST_FIXTURES_BUILT), and fixture_bin
builds nothing in a marked run. Both tests use it.

Shown with CARGO pointed at a wrapper that logs each call, running the
two tests' binaries directly: before, 3 build -p emit calls, all from
children (one from basic, two from artifact's two runs); after, 2, one
in each parent, and none from a child. The race itself did not show on
Linux in 40 runs of both suites at 16 threads; cargo's relink window
was hit on macOS.

Test-only, so no CHANGELOG entry.

Signed-off-by: Vyncint Ng 115854244+vyncint@users.noreply.github.com

The stress run on the v0.11.9 release commit (42930480712) failed three
macOS shards, at 2, 8 and 16 threads, with "fixture binary missing at
target/release/emit" in basic.rs and artifact.rs, right after a cargo
build that had succeeded.

Two tests added for #709 and #711 run their own test binary again, with
an environment of their own. `fixture_bin` builds each fixture once per
process, so every such child ran `cargo build -p emit` too, and cargo
relinks the binary (removes it, then links it again) even when nothing
is stale, while tests in the parent process were running it: the race
#278 fixed for the inspect example, reopened.

`common::rerun_self` now builds the fixtures a child needs in the parent
and marks the child (TERMLENS_TEST_FIXTURES_BUILT), and `fixture_bin`
builds nothing in a marked run. Both tests use it.

Shown with CARGO pointed at a wrapper that logs each call, running the
two tests' binaries directly: before, 3 `build -p emit` calls, all from
children (one from basic, two from artifact's two runs); after, 2, one
in each parent, and none from a child. The race itself did not show on
Linux in 40 runs of both suites at 16 threads; cargo's relink window
was hit on macOS.

Test-only, so no CHANGELOG entry.

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
@vyncint vyncint added this to the v0.11.9 milestone Nov 11, 2026
@vyncint
vyncint merged commit 484c02b into main Nov 11, 2026
31 checks passed
@vyncint
vyncint deleted the fix/0119-fixture-race branch November 11, 2026 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant