Include JVM Arg line in reproduce line

This commit is contained in:
Simon Willnauer 2013-11-25 14:35:12 +01:00
parent 32d073bbf8
commit 46ab6a1533
2 changed files with 40 additions and 7 deletions

11
pom.xml
View File

@ -35,11 +35,11 @@
<tests.shuffle>true</tests.shuffle>
<tests.output>onerror</tests.output>
<tests.client.ratio></tests.client.ratio>
<tests.jvm.argline></tests.jvm.argline>
<tests.jvm.option1>${env.ES_TESTS_JVM_OPTION1}</tests.jvm.option1>
<tests.jvm.option2>${env.ES_TESTS_JVM_OPTION2}</tests.jvm.option2>
<tests.jvm.option3>${env.ES_TESTS_JVM_OPTION3}</tests.jvm.option3>
<tests.jvm.option4>${env.ES_TESTS_JVM_OPTION4}</tests.jvm.option4>
<es.logger.level>INFO</es.logger.level>
</properties>
@ -370,6 +370,9 @@
<exclude>**/Abstract*.class</exclude>
<exclude>**/*StressTest.class</exclude>
</excludes>
<argLine>
${tests.jvm.argline}
</argLine>
<jvmArgs>
<param>${tests.jvm.option1}</param>
<param>${tests.jvm.option2}</param>
@ -385,6 +388,12 @@
<haltOnFailure>${tests.failfast}</haltOnFailure>
<systemProperties>
<!-- RandomizedTesting library system properties -->
<tests.jvm.argline>${tests.jvm.argline}</tests.jvm.argline>
<!-- the option[1..4] should go away soon once the jenkins skript if adjusted-->
<tests.jvm.option1>${tests.jvm.option1}</tests.jvm.option1>
<tests.jvm.option2>${tests.jvm.option2}</tests.jvm.option2>
<tests.jvm.option3>${tests.jvm.option3}</tests.jvm.option3>
<tests.jvm.option4>${tests.jvm.option4}</tests.jvm.option4>
<tests.iters>${tests.iters}</tests.iters>
<tests.maxfailures>${tests.maxfailures}</tests.maxfailures>
<tests.failfast>${tests.failfast}</tests.failfast>

View File

@ -14,6 +14,8 @@ import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
/**
* A {@link RunListener} that emits to {@link System#err} a string with command
@ -72,6 +74,7 @@ public class ReproduceInfoPrinter extends RunListener {
@Override
public ReproduceErrorMessageBuilder appendAllOpts(Description description) {
super.appendAllOpts(description);
appendJVMArgLine();
return appendESProperties();
}
@ -97,5 +100,26 @@ public class ReproduceInfoPrinter extends RunListener {
}
return this;
}
public ReproduceErrorMessageBuilder appendJVMArgLine() {
StringBuilder builder = new StringBuilder();
Set<String> values = new HashSet<String>();
for (String sysPropName : Arrays.asList(
"tests.jvm.option1", "tests.jvm.option2", "tests.jvm.option3", "tests.jvm.option4", "tests.jvm.argline")) {
if (System.getProperty(sysPropName) != null && !System.getProperty(sysPropName).isEmpty()) {
String propValue = System.getProperty(sysPropName).trim();
if (!values.contains(propValue)) {
builder.append(propValue);
values.add(propValue); // deduplicate
builder.append(' ');
}
}
}
if (builder.length() > 0) {
appendOpt("tests.jvm.argline", "\"" + builder.toString().trim() + "\"");
}
return this;
}
}
}