Fix JVM test argline (#24448)

* Fix JVM test argline

The argline was being overridden by '-XX:-OmitStackTraceInFastThrow'
which led to test failures that were expecting the JVM to be in a
certain state based on the value of tests.jvm.argline but they were not
since these arguments were never passed to the JVM. Additionally, we
need to respect the provided JVM argline if it is already provided with
a flag for OmitStackTraceInFastThrow. This commit fixes this by only
setting OmitStackTraceInFastThrow if it is not already set.

* Add comment

* Fix comment

* More elaborate comment

* Sigh
This commit is contained in:
Jason Tedor 2017-05-02 19:59:07 -04:00 committed by GitHub
parent 6fcd24d264
commit 23801153c7
1 changed files with 12 additions and 2 deletions

View File

@ -468,8 +468,18 @@ class BuildPlugin implements Plugin<Project> {
File heapdumpDir = new File(project.buildDir, 'heapdump') File heapdumpDir = new File(project.buildDir, 'heapdump')
heapdumpDir.mkdirs() heapdumpDir.mkdirs()
jvmArg '-XX:HeapDumpPath=' + heapdumpDir jvmArg '-XX:HeapDumpPath=' + heapdumpDir
argLine System.getProperty('tests.jvm.argline') /*
argLine '-XX:-OmitStackTraceInFastThrow' * We only want to append -XX:-OmitStackTraceInFastThrow if a flag for OmitStackTraceInFastThrow is not already included in
* tests.jvm.argline.
*/
final String testsJvmArgline = System.getProperty('tests.jvm.argline')
if (testsJvmArgline == null) {
argLine '-XX:-OmitStackTraceInFastThrow'
} else if (testsJvmArgline.indexOf("OmitStackTraceInFastThrow") < 0) {
argLine testsJvmArgline.trim() + ' ' + '-XX:-OmitStackTraceInFastThrow'
} else {
argLine testsJvmArgline.trim()
}
// 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
systemProperty 'java.io.tmpdir', './temp' systemProperty 'java.io.tmpdir', './temp'