Build: Add back leaveTemporary and ifNoTests

This change adds back the last of the missing test options to the juni4
wrapper. leaveTemporary is important in that setting it to true (which
is how we had it set in maven) removes the warnings we currently get
about a leftover file that cannot be deleted (from jna).
This commit is contained in:
Ryan Ernst 2015-11-22 22:18:42 -08:00
parent bc0a840a9c
commit 503d836ee4
2 changed files with 14 additions and 4 deletions

View File

@ -2,6 +2,7 @@ package com.carrotsearch.gradle.junit4
import com.carrotsearch.ant.tasks.junit4.ListenersList import com.carrotsearch.ant.tasks.junit4.ListenersList
import com.carrotsearch.ant.tasks.junit4.listeners.AggregatedEventListener import com.carrotsearch.ant.tasks.junit4.listeners.AggregatedEventListener
import com.esotericsoftware.kryo.serializers.FieldSerializer
import groovy.xml.NamespaceBuilder import groovy.xml.NamespaceBuilder
import groovy.xml.NamespaceBuilderSupport import groovy.xml.NamespaceBuilderSupport
import org.apache.tools.ant.BuildException import org.apache.tools.ant.BuildException
@ -58,6 +59,14 @@ class RandomizedTestingTask extends DefaultTask {
@Input @Input
boolean enableSystemAssertions = true boolean enableSystemAssertions = true
@Optional
@Input
boolean leaveTemporary = false
@Optional
@Input
String ifNoTests = 'ignore'
TestLoggingConfiguration testLoggingConfig = new TestLoggingConfiguration() TestLoggingConfiguration testLoggingConfig = new TestLoggingConfiguration()
BalancersConfiguration balancersConfig = new BalancersConfiguration(task: this) BalancersConfiguration balancersConfig = new BalancersConfiguration(task: this)
@ -172,9 +181,6 @@ class RandomizedTestingTask extends DefaultTask {
} }
} }
// TODO: add leaveTemporary
// TODO: add ifNoTests!
@TaskAction @TaskAction
void executeTests() { void executeTests() {
Map attributes = [ Map attributes = [
@ -184,7 +190,9 @@ class RandomizedTestingTask extends DefaultTask {
dir: workingDir, dir: workingDir,
tempdir: new File(workingDir, 'temp'), tempdir: new File(workingDir, 'temp'),
haltOnFailure: true, // we want to capture when a build failed, but will decide whether to rethrow later haltOnFailure: true, // we want to capture when a build failed, but will decide whether to rethrow later
shuffleOnSlave: shuffleOnSlave shuffleOnSlave: shuffleOnSlave,
leaveTemporary: leaveTemporary,
ifNoTests: ifNoTests
] ]
DefaultLogger listener = null DefaultLogger listener = null

View File

@ -322,6 +322,8 @@ class BuildPlugin implements Plugin<Project> {
return { return {
jvm "${project.javaHome}/bin/java" jvm "${project.javaHome}/bin/java"
parallelism System.getProperty('tests.jvms', 'auto') parallelism System.getProperty('tests.jvms', 'auto')
ifNoTests 'fail'
leaveTemporary true
// TODO: why are we not passing maxmemory to junit4? // TODO: why are we not passing maxmemory to junit4?
jvmArg '-Xmx' + System.getProperty('tests.heap.size', '512m') jvmArg '-Xmx' + System.getProperty('tests.heap.size', '512m')