mirror of https://github.com/apache/lucene.git
LUCENE-5283: Fail the build if ant test didn't execute any tests (everything filtered out). Take 2: after minor updates and comments from Uwe.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1539457 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6e40ba21af
commit
40d289fdff
|
@ -2,7 +2,7 @@
|
||||||
<library name="JUnit">
|
<library name="JUnit">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$PROJECT_DIR$/lucene/test-framework/lib/junit-4.10.jar!/" />
|
<root url="jar://$PROJECT_DIR$/lucene/test-framework/lib/junit-4.10.jar!/" />
|
||||||
<root url="jar://$PROJECT_DIR$/lucene/test-framework/lib/randomizedtesting-runner-2.0.12.jar!/" />
|
<root url="jar://$PROJECT_DIR$/lucene/test-framework/lib/randomizedtesting-runner-2.0.13.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES />
|
<SOURCES />
|
||||||
|
|
|
@ -267,6 +267,9 @@ Changes in backwards compatibility policy
|
||||||
|
|
||||||
Build
|
Build
|
||||||
|
|
||||||
|
* LUCENE-5283: Fail the build if ant test didn't execute any tests
|
||||||
|
(everything filtered out). (Dawid Weiss)
|
||||||
|
|
||||||
* LUCENE-5249, LUCENE-5257: All Lucene/Solr modules should use the same
|
* LUCENE-5249, LUCENE-5257: All Lucene/Solr modules should use the same
|
||||||
dependency versions. (Steve Rowe)
|
dependency versions. (Steve Rowe)
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
<propertyref regex=".*\.uptodate$$"/>
|
<propertyref regex=".*\.uptodate$$"/>
|
||||||
<propertyref regex=".*\.compiled$$"/>
|
<propertyref regex=".*\.compiled$$"/>
|
||||||
<propertyref regex=".*\.loaded$$"/>
|
<propertyref regex=".*\.loaded$$"/>
|
||||||
|
<propertyref name="tests.totals.tmpfile" />
|
||||||
</propertyset>
|
</propertyset>
|
||||||
|
|
||||||
<target name="common">
|
<target name="common">
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- "-clover.load" is *not* a useless dependency. do not remove -->
|
<!-- "-clover.load" is *not* a useless dependency. do not remove -->
|
||||||
<target name="test" depends="-clover.load, test-core, test-modules, test-backwards"
|
<target name="test" depends="-clover.load, -init-totals, test-core, test-modules, test-backwards, -check-totals"
|
||||||
description="Runs all unit tests (core, modules and back-compat)"
|
description="Runs all unit tests (core, modules and back-compat)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -263,6 +263,7 @@
|
||||||
<propertyref regex=".*\.compiled$$"/>
|
<propertyref regex=".*\.compiled$$"/>
|
||||||
<propertyref regex=".*\.loaded$$"/>
|
<propertyref regex=".*\.loaded$$"/>
|
||||||
<propertyref name="lucene.javadoc.url"/><!-- for Solr -->
|
<propertyref name="lucene.javadoc.url"/><!-- for Solr -->
|
||||||
|
<propertyref name="tests.totals.tmpfile" />
|
||||||
</propertyset>
|
</propertyset>
|
||||||
|
|
||||||
<patternset id="lucene.local.src.package.patterns"
|
<patternset id="lucene.local.src.package.patterns"
|
||||||
|
@ -880,12 +881,16 @@
|
||||||
<property name="tests.caches" location="${common.dir}/tools/junit4" /> <!-- defaults -->
|
<property name="tests.caches" location="${common.dir}/tools/junit4" /> <!-- defaults -->
|
||||||
<mkdir dir="${tests.cachedir}/${name}" />
|
<mkdir dir="${tests.cachedir}/${name}" />
|
||||||
|
|
||||||
|
<local name="junit4.stats.nonIgnored" />
|
||||||
|
|
||||||
<junit4:junit4
|
<junit4:junit4
|
||||||
taskName="junit4"
|
taskName="junit4"
|
||||||
dir="@{workDir}"
|
dir="@{workDir}"
|
||||||
tempdir="@{workDir}/temp"
|
tempdir="@{workDir}/temp"
|
||||||
maxmemory="${tests.heapsize}"
|
maxmemory="${tests.heapsize}"
|
||||||
|
|
||||||
|
statsPropertyPrefix="junit4.stats"
|
||||||
|
|
||||||
parallelism="@{threadNum}"
|
parallelism="@{threadNum}"
|
||||||
|
|
||||||
printSummary="true"
|
printSummary="true"
|
||||||
|
@ -1035,7 +1040,7 @@
|
||||||
</junit4:filtertrace>
|
</junit4:filtertrace>
|
||||||
</junit4:report-text>
|
</junit4:report-text>
|
||||||
|
|
||||||
<!-- Emits full status for all tests, their relative order on slaves. -->
|
<!-- Emits full status for all tests, their relative order on forked JVMs. -->
|
||||||
<junit4:report-text
|
<junit4:report-text
|
||||||
file="@{junit.output.dir}/tests-report.txt"
|
file="@{junit.output.dir}/tests-report.txt"
|
||||||
showThrowable="true"
|
showThrowable="true"
|
||||||
|
@ -1090,6 +1095,9 @@
|
||||||
</junit4:duplicate>
|
</junit4:duplicate>
|
||||||
</junit4:junit4>
|
</junit4:junit4>
|
||||||
|
|
||||||
|
<!-- Append the number of non-ignored (actually executed) tests. -->
|
||||||
|
<echo file="${tests.totals.tmpfile}" append="true" encoding="UTF-8"># module: ${ant.project.name}
${junit4.stats.nonIgnored}
</echo>
|
||||||
|
|
||||||
<!-- Report the 5 slowest tests from this run to the console. -->
|
<!-- Report the 5 slowest tests from this run to the console. -->
|
||||||
<echo>5 slowest tests:</echo>
|
<echo>5 slowest tests:</echo>
|
||||||
<junit4:tophints max="5">
|
<junit4:tophints max="5">
|
||||||
|
@ -1254,11 +1262,49 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
|
||||||
|
|
||||||
<!-- note: order here is important, the taskdef depends on test-framework
|
<!-- note: order here is important, the taskdef depends on test-framework
|
||||||
jars so we just order it after compile-test to ensure that -->
|
jars so we just order it after compile-test to ensure that -->
|
||||||
<target name="test" depends="clover,compile-test,install-junit4-taskdef,validate" description="Runs unit tests">
|
<target name="test" depends="clover,compile-test,install-junit4-taskdef,validate,-init-totals,-test,-check-totals" description="Runs unit tests">
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- Run the actual tests (must be wrapped with -init-totals, -check-totals) -->
|
||||||
|
<target name="-test">
|
||||||
<mkdir dir="${junit.output.dir}"/>
|
<mkdir dir="${junit.output.dir}"/>
|
||||||
<test-macro threadNum="${tests.jvms.override}" />
|
<test-macro threadNum="${tests.jvms.override}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="-check-totals" if="tests.totals.toplevel" depends="resolve-groovy">
|
||||||
|
<!-- We are concluding a test pass at the outermost level. Sum up all executed tests. -->
|
||||||
|
<local name="tests.totals.content" />
|
||||||
|
<loadfile srcFile="${tests.totals.tmpfile}" encoding="UTF-8" property="tests.totals.content" quiet="true" />
|
||||||
|
<groovy><![CDATA[
|
||||||
|
total = 0;
|
||||||
|
statsFile = new File(project.getProperty("tests.totals.tmpfile"));
|
||||||
|
statsFile.eachLine("UTF-8", { line ->
|
||||||
|
if (line ==~ /^[0-9]+/) {
|
||||||
|
total += Integer.valueOf(line);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
statsFile.delete();
|
||||||
|
|
||||||
|
if (total == 0) {
|
||||||
|
throw new org.apache.tools.ant.BuildException("Not even a single test was executed (a typo in the filter pattern maybe)?");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interesting but let's keep the build output quiet.
|
||||||
|
// project.log("Grand total of all executed tests (including sub-modules): " + total);
|
||||||
|
]]></groovy>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="-init-totals" unless="tests.totals.tmpfile">
|
||||||
|
<mkdir dir="${build.dir}" />
|
||||||
|
<tempfile property="tests.totals.tmpfile"
|
||||||
|
destdir="${build.dir}"
|
||||||
|
prefix=".test-totals-"
|
||||||
|
suffix=".tmp"
|
||||||
|
deleteonexit="true"
|
||||||
|
createfile="true" />
|
||||||
|
<property name="tests.totals.toplevel" value="true" />
|
||||||
|
</target>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
See http://issues.apache.org/jira/browse/LUCENE-721
|
See http://issues.apache.org/jira/browse/LUCENE-721
|
||||||
-->
|
-->
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
/cglib/cglib-nodep = 2.2
|
/cglib/cglib-nodep = 2.2
|
||||||
|
|
||||||
com.carrotsearch.randomizedtesting.version = 2.0.12
|
com.carrotsearch.randomizedtesting.version = 2.0.13
|
||||||
/com.carrotsearch.randomizedtesting/junit4-ant = ${com.carrotsearch.randomizedtesting.version}
|
/com.carrotsearch.randomizedtesting/junit4-ant = ${com.carrotsearch.randomizedtesting.version}
|
||||||
/com.carrotsearch.randomizedtesting/randomizedtesting-runner = ${com.carrotsearch.randomizedtesting.version}
|
/com.carrotsearch.randomizedtesting/randomizedtesting-runner = ${com.carrotsearch.randomizedtesting.version}
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
7e82374008eb6810e2b22c877ecd4c179cdac1ea
|
|
|
@ -0,0 +1 @@
|
||||||
|
33904a47c5f920d270437ea1075cc9fa5ecb8099
|
|
@ -1 +0,0 @@
|
||||||
0a9b381e004bf866aa3783412e5a03ebfff48ea3
|
|
|
@ -0,0 +1 @@
|
||||||
|
bdacac985583621c50de414b1d45b1e6e43f6d1f
|
|
@ -130,7 +130,7 @@
|
||||||
depends="compile-core, compile-contrib"/>
|
depends="compile-core, compile-contrib"/>
|
||||||
|
|
||||||
<target name="test" description="Validate, then run core, solrj, and contrib unit tests."
|
<target name="test" description="Validate, then run core, solrj, and contrib unit tests."
|
||||||
depends="test-core, test-contrib"/>
|
depends="-init-totals, test-core, test-contrib, -check-totals"/>
|
||||||
<!-- "-clover.load" is *not* a useless dependency. do not remove -->
|
<!-- "-clover.load" is *not* a useless dependency. do not remove -->
|
||||||
<target name="test-core" description="Runs the core and solrj unit tests."
|
<target name="test-core" description="Runs the core and solrj unit tests."
|
||||||
depends="-clover.load, test-solr-core, test-solrj"/>
|
depends="-clover.load, test-solr-core, test-solrj"/>
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
7e82374008eb6810e2b22c877ecd4c179cdac1ea
|
|
|
@ -0,0 +1 @@
|
||||||
|
33904a47c5f920d270437ea1075cc9fa5ecb8099
|
|
@ -1 +0,0 @@
|
||||||
0a9b381e004bf866aa3783412e5a03ebfff48ea3
|
|
|
@ -0,0 +1 @@
|
||||||
|
bdacac985583621c50de414b1d45b1e6e43f6d1f
|
Loading…
Reference in New Issue