LUCENE-5881: Add parameter check, beautify some other groovy code

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1617079 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2014-08-10 09:54:24 +00:00
parent a546284628
commit 3dbb07b9c2
1 changed files with 9 additions and 2 deletions

View File

@ -1310,7 +1310,12 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
<!-- Beast the actual tests (must be wrapped with -init-totals, -check-totals) --> <!-- Beast the actual tests (must be wrapped with -init-totals, -check-totals) -->
<target name="-beast" depends="resolve-groovy"> <target name="-beast" depends="resolve-groovy">
<groovy taskname="beaster"><![CDATA[ <groovy taskname="beaster"><![CDATA[
import org.apache.tools.ant.BuildException;
int iters = (properties['beast.iters'] ?: '1') as int; int iters = (properties['beast.iters'] ?: '1') as int;
if (iters <= 1) {
throw new BuildException("Please give -Dbeast.iters with an int value > 1.");
}
def antcall = project.createTask('antcall'); def antcall = project.createTask('antcall');
antcall.target = '-test'; antcall.target = '-test';
antcall.inheritAll = true; antcall.inheritAll = true;
@ -1326,8 +1331,10 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
<target name="-check-totals" if="tests.totals.toplevel" depends="resolve-groovy"> <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. --> <!-- We are concluding a test pass at the outermost level. Sum up all executed tests. -->
<groovy><![CDATA[ <groovy><![CDATA[
import org.apache.tools.ant.BuildException;
total = 0; total = 0;
statsFile = new File(project.getProperty("tests.totals.tmpfile")); statsFile = new File(properties["tests.totals.tmpfile"]);
statsFile.eachLine("UTF-8", { line -> statsFile.eachLine("UTF-8", { line ->
if (line ==~ /^[0-9]+/) { if (line ==~ /^[0-9]+/) {
total += Integer.valueOf(line); total += Integer.valueOf(line);
@ -1336,7 +1343,7 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
statsFile.delete(); statsFile.delete();
if (total == 0) { if (total == 0) {
throw new org.apache.tools.ant.BuildException("Not even a single test was executed (a typo in the filter pattern maybe)?"); throw new BuildException("Not even a single test was executed (a typo in the filter pattern maybe)?");
} }
// Interesting but let's keep the build output quiet. // Interesting but let's keep the build output quiet.