lucene/gradle/testing/defaults-tests.gradle

61 lines
1.7 KiB
Groovy

import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.api.tasks.testing.logging.*
allprojects {
plugins.withType(JavaPlugin) {
project.ext {
commonDir = project(":lucene").projectDir
testsWorkDir = file("${buildDir}/tmp/tests-cwd")
testsTmpDir = file("${buildDir}/tmp/tests-tmp")
}
test {
workingDir testsWorkDir
useJUnit()
maxParallelForks = propertyOrDefault("tests.jvms", (int) Math.max(1, Math.min(Runtime.runtime.availableProcessors() / 2.0, 4.0)))
minHeapSize = "256m"
maxHeapSize = "512m"
systemProperty 'java.util.logging.config.file', file("${commonDir}/tools/junit4/logging.properties")
systemProperty 'java.awt.headless', 'true'
systemProperty 'jdk.map.althashing.threshold', '0'
if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
systemProperty 'java.security.egd', 'file:/dev/./urandom'
}
// jetty-related.
systemProperty 'jetty.testMode', '1'
systemProperty 'jetty.insecurerandom', '1'
// Turn jenkins blood red for hashmap bugs, even on jdk7
systemProperty 'jdk.map.althashing.threshold', '0'
// Set up cwd and temp locations.
systemProperty("java.io.tmpdir", testsTmpDir)
systemProperty("tempDir", testsTmpDir)
doFirst {
testsWorkDir.mkdirs()
testsTmpDir.mkdirs()
}
// Set up logging.
testLogging {
events TestLogEvent.FAILED
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
showStackTraces true
}
doFirst {
// Print some diagnostics about locations used.
logger.info("Test folders for {}: cwd={}, tmp={}", project.path, testsWorkDir, testsTmpDir)
}
}
}
}