Skip volatile directories when copying the repository into a test scratch dir - #282
Conversation
…atch dir Every core test copies the whole repository, build outputs and .git included, while Gradle keeps writing into them from the outer build and from the other test forks. A file that vanishes between listing and reading fails the copy, and the test dies in setup with FileNotFoundException. The copy only feeds ./gradlew library-model-loader:jar --rerun-tasks, which rebuilds what it needs, so build, .git and .gradle are left out.
…ere Gradle writes it The archive step only ran on success, so the report was never there when it was needed, and its path pointed at the root project, which has no test task: every run uploaded an empty artifact. It now runs unconditionally and collects the reports and the XML results of every subproject.
|
Correction on my own claim above: the copy filter alone does not stop the failure. The run on this branch still lost What the filter does do is worth keeping on its own: it stops copying the build outputs and the VCS metadata of the whole repository into a scratch dir 59 times, once per test, for a copy that only feeds To find the rest I added a second commit to this branch: I did not reproduce it locally: the whole |
Problem
AnnotatorBaseCoreTest.setupcopies the whole repository into the test's scratch dir:That walk includes
build/,.gradle/and.git/, which the outer Gradle build keeps writing into while the tests run, and four test forks walk them at once. When a file disappears betweenlist()and opening it the copy throws and the test dies before it starts:It is a race, so it lands on whichever tests happen to be running:
build-without-cachetookDeepTest,AnalysisModeTestandCoreTeston one run of #279, andbuild-with-gradle-build-action-cachefailed the same way on master at 63074f6.Changes
The copy skips
build,.gitand.gradle. The copy exists to run./gradlew library-model-loader:jar --rerun-tasksagainst the sources, which rebuilds what it needs, so none of the three is read from it. It also stops copying the build outputs of the whole repository into a temp dir once per test.Verification
DeepTest.paramPassTest,CoreTest.multipleReturnNullable,AnalysisModeTestandJava21Testgreen on JDK 21;spotlessCheckclean.