mirror of https://github.com/apache/lucene.git
LUCENE-5920: New beasting silencer, variant #2
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1622451 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2ffb741999
commit
fbe31fe3a8
|
@ -1146,8 +1146,17 @@
|
||||||
<!-- Append the number of non-ignored (actually executed) tests. -->
|
<!-- 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>
|
<echo file="${tests.totals.tmpfile}" append="true" encoding="UTF-8"># module: ${ant.project.name}
${junit4.stats.nonIgnored}
</echo>
|
||||||
|
|
||||||
|
<fail message="Beasting executed no tests (a typo in the filter pattern maybe?)">
|
||||||
|
<condition>
|
||||||
|
<and>
|
||||||
|
<isset property="tests.isbeasting"/>
|
||||||
|
<equals arg1="${junit4.stats.nonIgnored}" arg2="0"/>
|
||||||
|
</and>
|
||||||
|
</condition>
|
||||||
|
</fail>
|
||||||
|
|
||||||
<!-- 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 level="info">5 slowest tests:</echo>
|
||||||
<junit4:tophints max="5">
|
<junit4:tophints max="5">
|
||||||
<file file="${tests.cachedir}/${name}/timehints.txt" />
|
<file file="${tests.cachedir}/${name}/timehints.txt" />
|
||||||
</junit4:tophints>
|
</junit4:tophints>
|
||||||
|
@ -1334,6 +1343,8 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
|
||||||
<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;
|
import org.apache.tools.ant.BuildException;
|
||||||
|
import org.apache.tools.ant.BuildLogger;
|
||||||
|
import org.apache.tools.ant.Project;
|
||||||
|
|
||||||
int iters = (properties['beast.iters'] ?: '1') as int;
|
int iters = (properties['beast.iters'] ?: '1') as int;
|
||||||
if (iters <= 1) {
|
if (iters <= 1) {
|
||||||
|
@ -1343,11 +1354,39 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
|
||||||
antcall.target = '-test';
|
antcall.target = '-test';
|
||||||
antcall.inheritAll = true;
|
antcall.inheritAll = true;
|
||||||
antcall.inheritRefs = true;
|
antcall.inheritRefs = true;
|
||||||
|
def prop = antcall.createParam();
|
||||||
|
prop.name = "tests.isbeasting";
|
||||||
|
prop.value = "true";
|
||||||
(1..iters).each { i ->
|
(1..iters).each { i ->
|
||||||
task.log('Beast round: ' + i);
|
task.log('Beast round: ' + i, Project.MSG_INFO);
|
||||||
antcall.execute();
|
try {
|
||||||
|
// disable verbose build logging:
|
||||||
|
project.buildListeners.each { listener ->
|
||||||
|
if (listener instanceof BuildLogger) {
|
||||||
|
listener.messageOutputLevel = Project.MSG_WARN;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
task.log('Beasting finished.');
|
|
||||||
|
antcall.execute();
|
||||||
|
|
||||||
|
} catch (BuildException be) {
|
||||||
|
def logFile = new File(properties["junit.output.dir"], "tests-failures.txt");
|
||||||
|
if (logFile.exists()) {
|
||||||
|
logFile.eachLine("UTF-8", { line ->
|
||||||
|
task.log(line, Project.MSG_ERR);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
throw be;
|
||||||
|
} finally {
|
||||||
|
// restore build logging (unfortunately there is no way to get the original logging level (write-only property):
|
||||||
|
project.buildListeners.each { listener ->
|
||||||
|
if (listener instanceof BuildLogger) {
|
||||||
|
listener.messageOutputLevel = Project.MSG_INFO;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
task.log('Beasting finished.', Project.MSG_INFO);
|
||||||
]]></groovy>
|
]]></groovy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
@ -1366,7 +1405,7 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
|
||||||
statsFile.delete();
|
statsFile.delete();
|
||||||
|
|
||||||
if (total == 0) {
|
if (total == 0) {
|
||||||
throw new 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.
|
||||||
|
|
Loading…
Reference in New Issue