From 9dae566ee749d5d2025728d076f083f86227e5cf Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Wed, 22 Jan 2020 09:54:08 -0500 Subject: [PATCH] LUCENE-9160: add params/docs to override jvm params in gradle build, default C2 off in tests. Adds some build parameters to tune how tests run. There is an example shown by "gradle helpLocalSettings" Default C2 off in tests as it is wasteful locally and causes slowdown of tests runs. You can override this by setting tests.jvmargs for gradle, or args for ant. Some crazy lucene stress tests may need to be toned down after the change, as they may have been doing too many iterations by default... but this is not a new problem. --- gradle/testing/defaults-tests.gradle | 17 ++++++++++------- help/localSettings.txt | 11 +++++++++++ lucene/common-build.xml | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/gradle/testing/defaults-tests.gradle b/gradle/testing/defaults-tests.gradle index 486f05f63f8..81dbaf1bec0 100644 --- a/gradle/testing/defaults-tests.gradle +++ b/gradle/testing/defaults-tests.gradle @@ -1,4 +1,5 @@ import org.apache.tools.ant.taskdefs.condition.Os +import org.apache.tools.ant.types.Commandline import org.gradle.api.tasks.testing.logging.* import org.apache.lucene.gradle.ErrorReportingTestListener @@ -9,8 +10,8 @@ allprojects { def verboseMode = Boolean.parseBoolean(propertyOrDefault("tests.verbose", "false")) project.ext { - testsWorkDir = file("${buildDir}/tmp/tests-cwd") - testsTmpDir = file("${buildDir}/tmp/tests-tmp") + testsCwd = file("${buildDir}/tmp/tests-cwd") + testsTmpDir = file(propertyOrDefault("tests.workDir", "${buildDir}/tmp/tests-tmp")) commonDir = project(":lucene").projectDir commonSolrDir = project(":solr").projectDir } @@ -43,11 +44,13 @@ allprojects { maxParallelForks = propertyOrDefault("tests.jvms", (int) Math.max(1, Math.min(Runtime.runtime.availableProcessors() / 2.0, 4.0))) } - workingDir testsWorkDir + workingDir testsCwd useJUnit() - minHeapSize = "256m" - maxHeapSize = "512m" + minHeapSize = propertyOrDefault("tests.minheapsize", "256m") + maxHeapSize = propertyOrDefault("tests.heapsize", "512m") + + jvmArgs Commandline.translateCommandline(propertyOrDefault("tests.jvmargs", "-XX:TieredStopAtLevel=1")) systemProperty 'java.util.logging.config.file', file("${commonDir}/tools/junit4/logging.properties") systemProperty 'java.awt.headless', 'true' @@ -72,7 +75,7 @@ allprojects { systemProperty("java.io.tmpdir", testsTmpDir) systemProperty("tempDir", testsTmpDir) doFirst { - testsWorkDir.mkdirs() + testsCwd.mkdirs() testsTmpDir.mkdirs() } @@ -101,7 +104,7 @@ allprojects { doFirst { // Print some diagnostics about locations used. - logger.info("Test folders for {}: cwd={}, tmp={}", project.path, testsWorkDir, testsTmpDir) + logger.info("Test folders for {}: cwd={}, tmp={}", project.path, testsCwd, testsTmpDir) } } } diff --git a/help/localSettings.txt b/help/localSettings.txt index c67c895b095..263af7f711c 100644 --- a/help/localSettings.txt +++ b/help/localSettings.txt @@ -33,6 +33,17 @@ it too high may not help. You can always override these settings locally using command line as well: gradlew -Ptests.jvms=N --max-workers=X +Test JVMS +--------- + +Test JVMs have their own set of arguments which can be customized. These are configured +separately from the gradle workers, for example: + +tests.jvms=3 +tests.heapsize=512m +tests.minheapsize=512m +tests.jvmargs=-XX:+UseParallelGC -XX:TieredStopAtLevel=1 + Gradle Daemon ------------- diff --git a/lucene/common-build.xml b/lucene/common-build.xml index 7b8e97a38d1..4239bb8d75d 100644 --- a/lucene/common-build.xml +++ b/lucene/common-build.xml @@ -106,7 +106,7 @@ - +