Fix remote cache misses for test tasks (#45521)

(cherry picked from commit 14486c73128feefc19d1c6a4cad4864d03ecaa9d)
This commit is contained in:
Mark Vieira 2019-08-13 19:06:20 -07:00
parent 3f5dab99c3
commit 1403a389f8
No known key found for this signature in database
GPG Key ID: CA947EF7E6D4B105
1 changed files with 6 additions and 5 deletions

View File

@ -810,6 +810,8 @@ class BuildPlugin implements Plugin<Project> {
test.addTestOutputListener(listener) test.addTestOutputListener(listener)
test.addTestListener(listener) test.addTestListener(listener)
test.doFirst { println test.jvmArgs }
/* /*
* We use lazy-evaluated strings in order to configure system properties whose value will not be known until * We use lazy-evaluated strings in order to configure system properties whose value will not be known until
* execution time (e.g. cluster port numbers). Adding these via the normal DSL doesn't work as these get treated * execution time (e.g. cluster port numbers). Adding these via the normal DSL doesn't work as these get treated
@ -848,10 +850,9 @@ class BuildPlugin implements Plugin<Project> {
test.exclude '**/*$*.class' test.exclude '**/*$*.class'
test.jvmArgs "-Xmx${System.getProperty('tests.heap.size', '512m')}", test.jvmArgs "-Xmx${System.getProperty('tests.heap.size', '512m')}",
"-Xms${System.getProperty('tests.heap.size', '512m')}", "-Xms${System.getProperty('tests.heap.size', '512m')}"
'-XX:+HeapDumpOnOutOfMemoryError',
"-XX:HeapDumpPath=$heapdumpDir"
test.jvmArgumentProviders.add({ ['-XX:+HeapDumpOnOutOfMemoryError', "-XX:HeapDumpPath=$heapdumpDir"] } as CommandLineArgumentProvider)
if (System.getProperty('tests.jvm.argline')) { if (System.getProperty('tests.jvm.argline')) {
test.jvmArgs System.getProperty('tests.jvm.argline').split(" ") test.jvmArgs System.getProperty('tests.jvm.argline').split(" ")
@ -862,8 +863,7 @@ class BuildPlugin implements Plugin<Project> {
} }
// we use './temp' since this is per JVM and tests are forbidden from writing to CWD // we use './temp' since this is per JVM and tests are forbidden from writing to CWD
test.systemProperties 'gradle.dist.lib': new File(project.class.location.toURI()).parent, test.systemProperties 'java.io.tmpdir': './temp',
'java.io.tmpdir': './temp',
'java.awt.headless': 'true', 'java.awt.headless': 'true',
'tests.gradle': 'true', 'tests.gradle': 'true',
'tests.artifact': project.name, 'tests.artifact': project.name,
@ -879,6 +879,7 @@ class BuildPlugin implements Plugin<Project> {
} }
// don't track these as inputs since they contain absolute paths and break cache relocatability // don't track these as inputs since they contain absolute paths and break cache relocatability
nonInputProperties.systemProperty('gradle.dist.lib', new File(project.class.location.toURI()).parent)
nonInputProperties.systemProperty('gradle.worker.jar', "${project.gradle.getGradleUserHomeDir()}/caches/${project.gradle.gradleVersion}/workerMain/gradle-worker.jar") nonInputProperties.systemProperty('gradle.worker.jar', "${project.gradle.getGradleUserHomeDir()}/caches/${project.gradle.gradleVersion}/workerMain/gradle-worker.jar")
nonInputProperties.systemProperty('gradle.user.home', project.gradle.getGradleUserHomeDir()) nonInputProperties.systemProperty('gradle.user.home', project.gradle.getGradleUserHomeDir())