Skip to content

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

Open
tannevaled wants to merge 1 commit into
mainfrom
fsize-test-child
Open

tannevaled wants to merge 1 commit 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

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>
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