Apache Lucene open-source search software
LUCENE-2619: improve test system (consistency of var names, args, sysprops passed to solr contribs, etc)
Robert Muir66d7bb2f4d12
diff --git a/lucene/build.xml b/lucene/build.xmlindex da4d777ae3b..015e675b3a9 100644--- a/lucene/build.xml+++ b/lucene/build.xml@@ -116,12 +116,12 @@</sequential></macrodef>- <target name="junit-backwards-sequential" if="runsequential">+ <target name="junit-backwards-sequential" if="tests.sequential"><backwards-test-macro/></target>- <target name="junit-backwards-parallel" unless="runsequential">- <parallel threadsPerProcessor="${threadsPerProcessor}">+ <target name="junit-backwards-parallel" unless="tests.sequential">+ <parallel threadsPerProcessor="${tests.threadspercpu}"><backwards-test-macro threadNum="1" threadTotal="8"/><backwards-test-macro threadNum="2" threadTotal="8"/><backwards-test-macro threadNum="3" threadTotal="8"/>diff --git a/lucene/common-build.xml b/lucene/common-build.xmlindex 98106f124ad..057240ac204 100644--- a/lucene/common-build.xml+++ b/lucene/common-build.xml@@ -55,8 +55,14 @@<!-- default arguments to pass to JVM executing tests --><property name="testmethod" value=""/><property name="args" value=""/>- <property name="threadsPerProcessor" value="1" />- <property name="random.multiplier" value="1" />+ <property name="tests.threadspercpu" value="1" />+ <condition property="tests.sequential">+ <or>+ <isset property="testcase"/>+ <equals arg1="${tests.threadspercpu}" arg2="0"/>+ </or>+ </condition>+ <property name="tests.multiplier" value="1" /><property name="tests.codec" value="random" /><property name="tests.locale" value="random" /><property name="tests.timezone" value="random" />@@ -124,12 +130,6 @@<property name="junit.excludes" value=""/><property name="junit.details.formatter" value="org.apache.lucene.util.LuceneJUnitResultFormatter"/><property name="junit.parallel.selector" value="org.apache.lucene.util.LuceneJUnitDividingSelector"/>- <condition property="runsequential">- <or>- <isset property="testcase"/>- <isset property="sequential-tests"/>- </or>- </condition><property name="manifest.file" location="${common.dir}/build/MANIFEST.MF"/>@@ -449,7 +449,7 @@<sysproperty key="tests.directory" value="${tests.directory}"/><!-- TODO: create propertyset for test properties, so each project can have its own set -->- <sysproperty key="random.multiplier" value="${random.multiplier}"/>+ <sysproperty key="tests.multiplier" value="${tests.multiplier}"/><sysproperty key="tempDir" file="@{tempDir}/@{threadNum}"/><sysproperty key="lucene.version" value="${dev.version}"/>@@ -496,12 +496,12 @@<mkdir dir="${junit.output.dir}"/></target>- <target name="junit-sequential" if="runsequential">+ <target name="junit-sequential" if="tests.sequential"><test-macro/></target>- <target name="junit-parallel" unless="runsequential">- <parallel threadsPerProcessor="${threadsPerProcessor}">+ <target name="junit-parallel" unless="tests.sequential">+ <parallel threadsPerProcessor="${tests.threadspercpu}"><test-macro threadNum="1" threadTotal="8"/><test-macro threadNum="2" threadTotal="8"/><test-macro threadNum="3" threadTotal="8"/>diff --git a/lucene/contrib/benchmark/build.xml b/lucene/contrib/benchmark/build.xmlindex ae5b00aef7a..2dd207c1298 100644--- a/lucene/contrib/benchmark/build.xml+++ b/lucene/contrib/benchmark/build.xml@@ -9,7 +9,7 @@<property name="working.dir" location="work"/><!-- the tests have some parallel problems -->- <property name="runsequential" value="true"/>+ <property name="tests.threadspercpu" value="0"/><contrib-uptodate name="highlighter" property="highlighter.uptodate" classpath.property="highlighter.jar"/><module-uptodate name="analysis/icu" jarfile="${common.dir}/../modules/analysis/build/icu/lucene-analyzers-icu-${version}.jar"diff --git a/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java b/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.javaindex 3cdfe335e94..e49530002a3 100644--- a/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java+++ b/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java@@ -160,7 +160,7 @@ public class LuceneTestCaseJ4 {* A random multiplier which you should use when writing random tests:* multiply it by the number of iterations*/- public static final int RANDOM_MULTIPLIER = Integer.parseInt(System.getProperty("random.multiplier", "1"));+ public static final int RANDOM_MULTIPLIER = Integer.parseInt(System.getProperty("tests.multiplier", "1"));private int savedBoolMaxClauseCount;diff --git a/solr/build.xml b/solr/build.xmlindex f661ba0bdf2..9ee7bae8beb 100644--- a/solr/build.xml+++ b/solr/build.xml@@ -377,21 +377,14 @@description="Runs the core unit tests."depends="test-core, test-contrib" />- <condition property="runsequential">- <or>- <isset property="testcase"/>- <isset property="sequential-tests"/>- </or>- </condition>-<target name="junit" depends="compileTests,junit-mkdir,junit-sequential,junit-parallel"/>- <target name="junit-sequential" if="runsequential">+ <target name="junit-sequential" if="tests.sequential"><junit-macro/></target>- <target name="junit-parallel" unless="runsequential">- <parallel threadsPerProcessor="${threadsPerProcessor}">+ <target name="junit-parallel" unless="tests.sequential">+ <parallel threadsPerProcessor="${tests.threadspercpu}"><junit-macro threadNum="1" threadTotal="8"/><junit-macro threadNum="2" threadTotal="8"/><junit-macro threadNum="3" threadTotal="8"/>@@ -422,9 +415,6 @@</or></not></condition>- <condition property="dir.prop" value="-Dsolr.directoryFactory=solr.StandardDirectoryFactory">- <isset property="use.fsdir"/>- </condition><!-- <mkdir dir="@{tempDir}/@{pattern}"/>This is very loud and obnoxious. abuse touch instead for a "quiet" mkdir-->@@ -443,10 +433,13 @@<sysproperty key="tests.codec" value="${tests.codec}"/><sysproperty key="tests.locale" value="${tests.locale}"/><sysproperty key="tests.timezone" value="${tests.timezone}"/>+ <sysproperty key="tests.multiplier" value="${tests.multiplier}"/><sysproperty key="jetty.insecurerandom" value="1"/><sysproperty key="tempDir" file="@{tempDir}/@{threadNum}"/><sysproperty key="testmethod" value="${testmethod}"/>- <jvmarg line="${dir.prop}"/>+ <!-- TODO: why is this unconditionally set to "" above? disable for now+ <jvmarg line="${dir.prop}"/>+ --><jvmarg line="${args}"/><formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>diff --git a/solr/common-build.xml b/solr/common-build.xmlindex 79e4cb4e6a1..86f3d1e946e 100644--- a/solr/common-build.xml+++ b/solr/common-build.xml@@ -42,12 +42,23 @@<property name="args" value="" /><!-- TODO: measure toning this down by default to 1 -->- <property name="threadsPerProcessor" value="2"/>+ <property name="tests.threadspercpu" value="2"/>+ <condition property="tests.sequential">+ <or>+ <isset property="testcase"/>+ <equals arg1="${tests.threadspercpu}" arg2="0"/>+ </or>+ </condition>+ <property name="tests.multiplier" value="1" /><property name="tests.codec" value="random" /><property name="tests.locale" value="random" /><property name="tests.timezone" value="random" />+ <condition property="dir.prop" value="-Dsolr.directoryFactory=solr.StandardDirectoryFactory">+ <isset property="use.fsdir"/>+ </condition>+<!-- Example directory --><property name="example" value="${common-solr.dir}/example" /><!--diff --git a/solr/contrib/clustering/build.xml b/solr/contrib/clustering/build.xmlindex 1f6466f7519..51a2e6512e4 100644--- a/solr/contrib/clustering/build.xml+++ b/solr/contrib/clustering/build.xml@@ -107,6 +107,16 @@dir="src/test/resources/"tempdir="${junit.output.dir}">+ <sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/>+ <sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>+ <sysproperty key="tests.codec" value="${tests.codec}"/>+ <sysproperty key="tests.locale" value="${tests.locale}"/>+ <sysproperty key="tests.timezone" value="${tests.timezone}"/>+ <sysproperty key="tests.multiplier" value="${tests.multiplier}"/>+ <sysproperty key="jetty.insecurerandom" value="1"/>+ <sysproperty key="tempDir" file="${junit.output.dir}"/>+ <sysproperty key="testmethod" value="${testmethod}"/>+ <jvmarg line="${args}"/><formatter type="brief" usefile="false" if="junit.details"/><classpath refid="test.classpath"/><assertions>diff --git a/solr/contrib/dataimporthandler/build.xml b/solr/contrib/dataimporthandler/build.xmlindex 829e151a64f..cb5e8cc43b1 100644--- a/solr/contrib/dataimporthandler/build.xml+++ b/solr/contrib/dataimporthandler/build.xml@@ -159,9 +159,16 @@dir="src/test/resources/"tempdir="${tempDir}">+ <sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/>+ <sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>+ <sysproperty key="tests.codec" value="${tests.codec}"/>+ <sysproperty key="tests.locale" value="${tests.locale}"/>+ <sysproperty key="tests.timezone" value="${tests.timezone}"/>+ <sysproperty key="tests.multiplier" value="${tests.multiplier}"/><sysproperty key="jetty.insecurerandom" value="1"/><sysproperty key="tempDir" file="${tempDir}"/><sysproperty key="testmethod" value="${testmethod}"/>+ <jvmarg line="${args}"/><formatter type="brief" usefile="false" if="junit.details"/><classpath refid="test.classpath"/><formatter type="xml"/>@@ -207,9 +214,16 @@dir="src/extras/test/resources/"tempdir="${tempDir}">+ <sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/>+ <sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>+ <sysproperty key="tests.codec" value="${tests.codec}"/>+ <sysproperty key="tests.locale" value="${tests.locale}"/>+ <sysproperty key="tests.timezone" value="${tests.timezone}"/>+ <sysproperty key="tests.multiplier" value="${tests.multiplier}"/><sysproperty key="jetty.insecurerandom" value="1"/><sysproperty key="tempDir" file="${tempDir}"/><sysproperty key="testmethod" value="${testmethod}"/>+ <jvmarg line="${args}"/><formatter type="brief" usefile="false" if="junit.details"/><classpath refid="test.extras.classpath"/><assertions>diff --git a/solr/contrib/extraction/build.xml b/solr/contrib/extraction/build.xmlindex 31481b049e4..85c6e572eae 100644--- a/solr/contrib/extraction/build.xml+++ b/solr/contrib/extraction/build.xml@@ -108,9 +108,16 @@dir="src/test/resources/"tempdir="${tempDir}">+ <sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/>+ <sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>+ <sysproperty key="tests.codec" value="${tests.codec}"/>+ <sysproperty key="tests.locale" value="${tests.locale}"/>+ <sysproperty key="tests.timezone" value="${tests.timezone}"/>+ <sysproperty key="tests.multiplier" value="${tests.multiplier}"/><sysproperty key="jetty.insecurerandom" value="1"/><sysproperty key="tempDir" file="${tempDir}"/><sysproperty key="testmethod" value="${testmethod}"/>+ <jvmarg line="${args}"/><formatter type="brief" usefile="false" if="junit.details"/><classpath refid="test.classpath"/><assertions>