Repository navigation
Remove each test's temp files when it ends - #266
Merged
Merged
Conversation
Test runs left their stores, repo copies and Chrome profiles in the system temp dir; 5 GB of them filled the disk. The runner now gives every test its own TMPDIR, linked to the shared tsx and Node compile caches, and removes it when the test passes, fails or times out. test/env.ts removes the store it made when a test run on its own exits.
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 runs left their files in the system temp dir and never removed them. These were the throwaway canvas stores that
test/env.tsmakes, the repos and stores other tests make withmkdtemp, and the Chrome profiles Puppeteer creates. On 2026-11-24 about 11,000 of these folders, 5 GB in all, filled the disk partway through a test run. A full run left about a hundred more each time.What changed
scripts/run-tests.tscreates a folder for each test and pointsTMPDIR,TMPandTEMPat it. When the test ends, whether it passed, failed or timed out, the runner deletes the folder. If you press Ctrl-C, it deletes the folder of the test that was running.mkdtempand Puppeteer's Chrome profiles both followTMPDIR, so nothing a test makes outlives it.TMPDIR, and macOS limits socket paths to about 104 characters, so a folder two levels deep broke tsx with "listen EINVAL".test/env.tsremoves its own store when the process exits, cleanly or with an error. This covers a single test run on its own, outside the runner.Tests
New:
test/unit/test-runner-temp.ts. It runs the real runner over three throwaway tests: one passes, one fails, and one hangs until it is killed. Each makes a folder and a file underos.tmpdir(). The test checks that:test/env.tsrun on its own removes its store after a clean exit and afterprocess.exit(1).Against the old runner and
env.ts, the test fails 6 checks and leaves 3 folders behind.Full tier: 156/157 pass. I listed the system temp dir before and after the run. It gained no
framesmith-*orfs-*folders, where it used to gain about a hundred.The one failure was load.
test-patterns-desktoptimed out at 180 seconds while the machine's load average was 10 to 15. Run alone it passes, in 77 seconds on this branch and 72 on master.Limits
com.google.Chrome.*entries per full run to the user temp dir, which it finds without readingTMPDIR. This change does not clean those.test/env.tsmade for it. Other temp folders it makes stay until the system cleans them.