Apache Lucene open-source search software
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.
Dawid Weiss40d289fdff1b
diff --git a/dev-tools/idea/.idea/libraries/JUnit.xml b/dev-tools/idea/.idea/libraries/JUnit.xmlindex 44fe35d4ac0..b3c2d128f00 100644--- a/dev-tools/idea/.idea/libraries/JUnit.xml+++ b/dev-tools/idea/.idea/libraries/JUnit.xml@@ -2,7 +2,7 @@<library name="JUnit"><CLASSES><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><JAVADOC /><SOURCES />diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex ae37ffdd1e5..e675bd51e05 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -267,6 +267,9 @@ Changes in backwards compatibility policyBuild+* 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 samedependency versions. (Steve Rowe)diff --git a/lucene/analysis/build.xml b/lucene/analysis/build.xmlindex c0c16e3d53d..5ab5c8d10da 100644--- a/lucene/analysis/build.xml+++ b/lucene/analysis/build.xml@@ -46,6 +46,7 @@<propertyref regex=".*\.uptodate$$"/><propertyref regex=".*\.compiled$$"/><propertyref regex=".*\.loaded$$"/>+ <propertyref name="tests.totals.tmpfile" /></propertyset><target name="common">diff --git a/lucene/build.xml b/lucene/build.xmlindex ee10754ccec..74f40db8e55 100644--- a/lucene/build.xml+++ b/lucene/build.xml@@ -52,7 +52,7 @@</target><!-- "-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)"/>diff --git a/lucene/common-build.xml b/lucene/common-build.xmlindex 12725747165..67b7bec8871 100644--- a/lucene/common-build.xml+++ b/lucene/common-build.xml@@ -263,6 +263,7 @@<propertyref regex=".*\.compiled$$"/><propertyref regex=".*\.loaded$$"/><propertyref name="lucene.javadoc.url"/><!-- for Solr -->+ <propertyref name="tests.totals.tmpfile" /></propertyset><patternset id="lucene.local.src.package.patterns"@@ -880,12 +881,16 @@<property name="tests.caches" location="${common.dir}/tools/junit4" /> <!-- defaults --><mkdir dir="${tests.cachedir}/${name}" />+ <local name="junit4.stats.nonIgnored" />+<junit4:junit4taskName="junit4"dir="@{workDir}"tempdir="@{workDir}/temp"- maxmemory="${tests.heapsize}"-+ maxmemory="${tests.heapsize}"++ statsPropertyPrefix="junit4.stats"+parallelism="@{threadNum}"printSummary="true"@@ -1035,7 +1040,7 @@</junit4:filtertrace></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-textfile="@{junit.output.dir}/tests-report.txt"showThrowable="true"@@ -1090,6 +1095,9 @@</junit4:duplicate></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. --><echo>5 slowest tests:</echo><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-frameworkjars 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}"/><test-macro threadNum="${tests.jvms.override}" /></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-->diff --git a/lucene/ivy-versions.properties b/lucene/ivy-versions.propertiesindex 077b7ddbc90..a71f538dc51 100644--- a/lucene/ivy-versions.properties+++ b/lucene/ivy-versions.properties@@ -4,7 +4,7 @@/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/randomizedtesting-runner = ${com.carrotsearch.randomizedtesting.version}diff --git a/lucene/licenses/junit4-ant-2.0.12.jar.sha1 b/lucene/licenses/junit4-ant-2.0.12.jar.sha1deleted file mode 100644index ce03d7bb6bc..00000000000--- a/lucene/licenses/junit4-ant-2.0.12.jar.sha1+++ /dev/null@@ -1 +0,0 @@-7e82374008eb6810e2b22c877ecd4c179cdac1eadiff --git a/lucene/licenses/junit4-ant-2.0.13.jar.sha1 b/lucene/licenses/junit4-ant-2.0.13.jar.sha1new file mode 100644index 00000000000..4c41a16e0fe--- /dev/null+++ b/lucene/licenses/junit4-ant-2.0.13.jar.sha1@@ -0,0 +1 @@+33904a47c5f920d270437ea1075cc9fa5ecb8099diff --git a/lucene/licenses/randomizedtesting-runner-2.0.12.jar.sha1 b/lucene/licenses/randomizedtesting-runner-2.0.12.jar.sha1deleted file mode 100644index 49ceb681f3f..00000000000--- a/lucene/licenses/randomizedtesting-runner-2.0.12.jar.sha1+++ /dev/null@@ -1 +0,0 @@-0a9b381e004bf866aa3783412e5a03ebfff48ea3diff --git a/lucene/licenses/randomizedtesting-runner-2.0.13.jar.sha1 b/lucene/licenses/randomizedtesting-runner-2.0.13.jar.sha1new file mode 100644index 00000000000..3ad2bb603f7--- /dev/null+++ b/lucene/licenses/randomizedtesting-runner-2.0.13.jar.sha1@@ -0,0 +1 @@+bdacac985583621c50de414b1d45b1e6e43f6d1fdiff --git a/solr/build.xml b/solr/build.xmlindex b2a56e41932..baabb63213f 100644--- a/solr/build.xml+++ b/solr/build.xml@@ -130,7 +130,7 @@depends="compile-core, compile-contrib"/><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 --><target name="test-core" description="Runs the core and solrj unit tests."depends="-clover.load, test-solr-core, test-solrj"/>diff --git a/solr/licenses/junit4-ant-2.0.12.jar.sha1 b/solr/licenses/junit4-ant-2.0.12.jar.sha1deleted file mode 100644index ce03d7bb6bc..00000000000--- a/solr/licenses/junit4-ant-2.0.12.jar.sha1+++ /dev/null@@ -1 +0,0 @@-7e82374008eb6810e2b22c877ecd4c179cdac1eadiff --git a/solr/licenses/junit4-ant-2.0.13.jar.sha1 b/solr/licenses/junit4-ant-2.0.13.jar.sha1new file mode 100644index 00000000000..4c41a16e0fe--- /dev/null+++ b/solr/licenses/junit4-ant-2.0.13.jar.sha1@@ -0,0 +1 @@+33904a47c5f920d270437ea1075cc9fa5ecb8099diff --git a/solr/licenses/randomizedtesting-runner-2.0.12.jar.sha1 b/solr/licenses/randomizedtesting-runner-2.0.12.jar.sha1deleted file mode 100644index 49ceb681f3f..00000000000--- a/solr/licenses/randomizedtesting-runner-2.0.12.jar.sha1+++ /dev/null@@ -1 +0,0 @@-0a9b381e004bf866aa3783412e5a03ebfff48ea3diff --git a/solr/licenses/randomizedtesting-runner-2.0.13.jar.sha1 b/solr/licenses/randomizedtesting-runner-2.0.13.jar.sha1new file mode 100644index 00000000000..3ad2bb603f7--- /dev/null+++ b/solr/licenses/randomizedtesting-runner-2.0.13.jar.sha1@@ -0,0 +1 @@+bdacac985583621c50de414b1d45b1e6e43f6d1f