Allow individual projects to override test heapdump setting (#50096)

This commit goes from using a JvmArgumentProvider to using the normal
Test task APIs for passing the `HeapDumpOnOutOfMemoryError` JVM
argument. This makes it simpler for subprojects, such as lang-painless
to override this setting if necessary.

Closes #49117

(cherry picked from commit e97c38ff8e862abdc1d7816c66f9869ed216031f)
This commit is contained in:
Mark Vieira 2019-12-11 15:39:06 -08:00
parent 38b67f719e
commit fdfb1950fc
No known key found for this signature in database
GPG Key ID: CA947EF7E6D4B105

View File

@ -680,9 +680,10 @@ class BuildPlugin implements Plugin<Project> {
test.exclude '**/*$*.class'
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'
test.jvmArgumentProviders.add({ ['-XX:+HeapDumpOnOutOfMemoryError', "-XX:HeapDumpPath=$heapdumpDir"] } as CommandLineArgumentProvider)
test.jvmArgumentProviders.add({ ["-XX:HeapDumpPath=$heapdumpDir"] } as CommandLineArgumentProvider)
if (System.getProperty('tests.jvm.argline')) {
test.jvmArgs System.getProperty('tests.jvm.argline').split(" ")