Repository navigation
Give each nested test run its own build directory - #161
Merged
Merged
Conversation
passsy
force-pushed
the
pw/isolate-nested-test-builds
branch
from
August 5, 2026 23:09
1940090 to
93f0af4
Compare
Tests that spawn `flutter test` inherit the working directory, so every
run built into the repository's `build/`. `flutter test` empties
`build/native_assets/<os>/` at startup, writes into that same directory
the `native_assets.json` it later copies into the test assets, and does
that copy only after building the asset bundle. A run that started inside
that window deleted the file another run was about to copy, failing it on
the master channel with:
Flutter failed to copy file from ".../build/native_assets/linux/native_assets.json"
to ".../build/unit_test_assets/NativeAssetsManifest.json".
The file or directory could not be found.
The build directory is only settable through Flutter's config file, whose
location follows XDG_CONFIG_HOME, or APPDATA on Windows, so each nested
run now gets a config file of its own. The directory is named after the
test file rather than the run: runs started by one file are sequential
and cannot collide, and sharing keeps their compilation cache warm.
passsy
force-pushed
the
pw/isolate-nested-test-builds
branch
from
August 5, 2026 23:21
93f0af4 to
001a13b
Compare
Flutter reads $HOME/.flutter_settings before $XDG_CONFIG_HOME/settings, so a machine that still carries that long deprecated file kept sending nested runs to the shared build directory, and to the race with it. HOME now points at the same throwaway directory as the other two variables, and that directory holds both file names, so the config a nested run finds is this one whichever rule it follows. PUB_CACHE is named explicitly, because the nested run would otherwise look for the package cache in the home directory it just lost and fill the throwaway one instead.
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.
Tests that spawn
flutter testall built into the repository's onebuild/.On the master channel a run occasionally deletes the
native_assets.jsonanother run is about to copy into its test assets, failing a random timeline test:Every nested run now builds into a directory of its own, one per test file, set through a Flutter config file of its own.