mirror of https://github.com/apache/lucene.git
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.
This commit is contained in:
parent
25ba52d1a0
commit
9dae566ee7
|
@ -1,4 +1,5 @@
|
||||||
import org.apache.tools.ant.taskdefs.condition.Os
|
import org.apache.tools.ant.taskdefs.condition.Os
|
||||||
|
import org.apache.tools.ant.types.Commandline
|
||||||
import org.gradle.api.tasks.testing.logging.*
|
import org.gradle.api.tasks.testing.logging.*
|
||||||
import org.apache.lucene.gradle.ErrorReportingTestListener
|
import org.apache.lucene.gradle.ErrorReportingTestListener
|
||||||
|
|
||||||
|
@ -9,8 +10,8 @@ allprojects {
|
||||||
def verboseMode = Boolean.parseBoolean(propertyOrDefault("tests.verbose", "false"))
|
def verboseMode = Boolean.parseBoolean(propertyOrDefault("tests.verbose", "false"))
|
||||||
|
|
||||||
project.ext {
|
project.ext {
|
||||||
testsWorkDir = file("${buildDir}/tmp/tests-cwd")
|
testsCwd = file("${buildDir}/tmp/tests-cwd")
|
||||||
testsTmpDir = file("${buildDir}/tmp/tests-tmp")
|
testsTmpDir = file(propertyOrDefault("tests.workDir", "${buildDir}/tmp/tests-tmp"))
|
||||||
commonDir = project(":lucene").projectDir
|
commonDir = project(":lucene").projectDir
|
||||||
commonSolrDir = project(":solr").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)))
|
maxParallelForks = propertyOrDefault("tests.jvms", (int) Math.max(1, Math.min(Runtime.runtime.availableProcessors() / 2.0, 4.0)))
|
||||||
}
|
}
|
||||||
|
|
||||||
workingDir testsWorkDir
|
workingDir testsCwd
|
||||||
useJUnit()
|
useJUnit()
|
||||||
|
|
||||||
minHeapSize = "256m"
|
minHeapSize = propertyOrDefault("tests.minheapsize", "256m")
|
||||||
maxHeapSize = "512m"
|
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.util.logging.config.file', file("${commonDir}/tools/junit4/logging.properties")
|
||||||
systemProperty 'java.awt.headless', 'true'
|
systemProperty 'java.awt.headless', 'true'
|
||||||
|
@ -72,7 +75,7 @@ allprojects {
|
||||||
systemProperty("java.io.tmpdir", testsTmpDir)
|
systemProperty("java.io.tmpdir", testsTmpDir)
|
||||||
systemProperty("tempDir", testsTmpDir)
|
systemProperty("tempDir", testsTmpDir)
|
||||||
doFirst {
|
doFirst {
|
||||||
testsWorkDir.mkdirs()
|
testsCwd.mkdirs()
|
||||||
testsTmpDir.mkdirs()
|
testsTmpDir.mkdirs()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +104,7 @@ allprojects {
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
// Print some diagnostics about locations used.
|
// 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,17 @@ it too high may not help.
|
||||||
You can always override these settings locally using command line as well:
|
You can always override these settings locally using command line as well:
|
||||||
gradlew -Ptests.jvms=N --max-workers=X
|
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
|
Gradle Daemon
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<!-- default arguments to pass to JVM executing tests -->
|
<!-- default arguments to pass to JVM executing tests -->
|
||||||
<property name="args" value=""/>
|
<property name="args" value="-XX:TieredStopAtLevel=1"/>
|
||||||
|
|
||||||
<property name="tests.seed" value="" />
|
<property name="tests.seed" value="" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue