From 503d836ee405ac6f49b9cfcf6890dc6a01db0fcf Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Sun, 22 Nov 2015 22:18:42 -0800 Subject: [PATCH] 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). --- .../gradle/junit4/RandomizedTestingTask.groovy | 16 ++++++++++++---- .../org/elasticsearch/gradle/BuildPlugin.groovy | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy index a7d1db1cc8c..33e16feb44a 100644 --- a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy +++ b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy @@ -2,6 +2,7 @@ package com.carrotsearch.gradle.junit4 import com.carrotsearch.ant.tasks.junit4.ListenersList import com.carrotsearch.ant.tasks.junit4.listeners.AggregatedEventListener +import com.esotericsoftware.kryo.serializers.FieldSerializer import groovy.xml.NamespaceBuilder import groovy.xml.NamespaceBuilderSupport import org.apache.tools.ant.BuildException @@ -58,6 +59,14 @@ class RandomizedTestingTask extends DefaultTask { @Input boolean enableSystemAssertions = true + @Optional + @Input + boolean leaveTemporary = false + + @Optional + @Input + String ifNoTests = 'ignore' + TestLoggingConfiguration testLoggingConfig = new TestLoggingConfiguration() BalancersConfiguration balancersConfig = new BalancersConfiguration(task: this) @@ -172,9 +181,6 @@ class RandomizedTestingTask extends DefaultTask { } } - // TODO: add leaveTemporary - // TODO: add ifNoTests! - @TaskAction void executeTests() { Map attributes = [ @@ -184,7 +190,9 @@ class RandomizedTestingTask extends DefaultTask { dir: workingDir, tempdir: new File(workingDir, 'temp'), 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 diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 07e5ca4c967..c35ec5cd0f6 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -322,6 +322,8 @@ class BuildPlugin implements Plugin { return { jvm "${project.javaHome}/bin/java" parallelism System.getProperty('tests.jvms', 'auto') + ifNoTests 'fail' + leaveTemporary true // TODO: why are we not passing maxmemory to junit4? jvmArg '-Xmx' + System.getProperty('tests.heap.size', '512m')