Skip to content

Give each nested test run its own build directory - #161

Merged
passsy merged 2 commits into
mainfrom
pw/isolate-nested-test-builds
Aug 5, 2026
Merged

passsy merged 2 commits into
mainfrom
pw/isolate-nested-test-builds

Conversation

@passsy

@passsy passsy commented Aug 5, 2026 •

Copy link
Copy Markdown
Owner

Tests that spawn flutter test all built into the repository's one build/.
On the master channel a run occasionally deletes the native_assets.json another run is about to copy into its test assets, failing a random timeline test:

[e] 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.

Every nested run now builds into a directory of its own, one per test file, set through a Flutter config file of its own.

@passsy
passsy force-pushed the pw/isolate-nested-test-builds branch from 1940090 to 93f0af4 Compare August 5, 2026 23:09
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
passsy force-pushed the pw/isolate-nested-test-builds branch from 93f0af4 to 001a13b Compare August 5, 2026 23:21
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.
@passsy
passsy merged commit 256ef60 into main Aug 5, 2026
8 checks passed
@passsy
passsy deleted the pw/isolate-nested-test-builds branch August 5, 2026 23:45
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