Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitlab/collect_results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ WORKSPACE_DIR=workspace
mkdir -p $TEST_RESULTS_DIR
mkdir -p $WORKSPACE_DIR

mapfile -t TEST_RESULT_DIRS < <(find $WORKSPACE_DIR -name test-results -type d)
# Main project modules redirect their build directory to workspace/<project-path>/build/ in CI
# (see build.gradle.kts layout.buildDirectory override). buildSrc is a separate Gradle build
# that runs before the main build is configured, so this redirect never applies to it;
# its test results always land in buildSrc/**/build/test-results/, not under workspace/.
SEARCH_DIRS=($WORKSPACE_DIR buildSrc)

mapfile -t TEST_RESULT_DIRS < <(find "${SEARCH_DIRS[@]}" -name test-results -type d)

if [[ ${#TEST_RESULT_DIRS[@]} -eq 0 ]]; then
echo "No test results found"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ internal open class GradleFixture(protected val projectDir: File) {
*/
fun run(vararg args: String, expectFailure: Boolean = false, env: Map<String, String> = emptyMap()): BuildResult {
val runner = GradleRunner.create()
.withTestKitDir(File(projectDir, ".gradle-test-kit"))
// Use a testkit dir scoped to this fixture's projectDir. The Tooling API always uses a
// daemon and ignores org.gradle.daemon=false. By giving each test its own testkit dir,
// we force a fresh daemon per test — ensuring withEnvironment() vars (e.g.
// MAVEN_REPOSITORY_PROXY) are correctly set on the daemon JVM and not inherited from
// a previously-started daemon with a different test's environment.
.withTestKitDir(file(".testkit"))
.withPluginClasspath()
.withProjectDir(projectDir)
.withEnvironment(System.getenv() + env)
Expand Down
Loading