Skip to content

vm: set the file-size limit in a child, not in the test process - #983

Merged
tannevaled merged 3 commits into
mainfrom
fsize-test-child
Nov 28, 2026
Merged

tannevaled merged 3 commits into
mainfrom
fsize-test-child

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

What

TestAFlushPastTheFileSizeLimitRaises, added with #978, lowered RLIMIT_FSIZE to 4 bytes in the test process itself. The limit is per process. While it held, every file written by the other tests, or by the testing package, was refused too.

Seen

On the first run of #982, the arch arm64 lane failed after internal/vm had printed PASS:

PASS
testing: can't write /tmp/go-build…/testlog.txt: write …/testlog.txt: file too large
FAIL	github.com/go-embedded-ruby/ruby/internal/vm	357.901s

Any pull request can hit it; whether it does depends on timing.

Fix

The limited flush runs in a child copy of the test binary. The child reports the class it raised on stdout, and the parent asserts Errno::EFBIG. The limit never applies to the process that runs the other tests.

Measured

  • The test: TestAFlushPastTheFileSizeLimitRaises passes (darwin).
  • Negative control: with the child's limit left unchanged, the test fails (fsize: raised with no class), so it still detects a flush that does not raise.
  • Vet: buildscan --vet passed under all 19 CI configurations.

Refs #982 (its arm64 lane is where this was seen)
Refs #978 (merged; it added the test)

🤖 Generated with Claude Code

tannevaled and others added 3 commits November 23, 2026 21:12
TestAFlushPastTheFileSizeLimitRaises lowered RLIMIT_FSIZE to 4 bytes in the
test process itself. The limit is per process, so every file written while it
held, by the other tests or by the testing package, was refused too: the arm64
lane of #982 failed with "can't write
.../testlog.txt: file too large" after every test had passed.

The limited flush now runs in a child copy of the test binary, which reports
the class it raised on stdout. Negative control: leaving the child's limit
unchanged makes the test fail ("fsize: raised " with no class).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The child printed "fsize: raised Errno::EFBIG" and PASS, then failed
writing its own coverage data under -cover ("file too large") and exited
with status 2 on the ubuntu and macos lanes. The limit is now restored
right after the flush raised, before anything else in the child writes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The EFBIG arm of writeDirty is reached only in the child on macOS (no
/dev/full there), and the child was started without -test.gocoverdir,
so its counters were dropped and the coverage ratchet failed the macos
lane: "internal/vm/io_dirty.go writeDirty 89.5% (was fully covered)".
The parent now passes its own -test.gocoverdir on; the testing package
merges every counter file in that directory into the profile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit e13fd48 into main Nov 28, 2026
26 checks passed
@tannevaled
tannevaled deleted the fsize-test-child branch November 28, 2026 22:44
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