LUCENE-4094: Support overriding file.encoding on forked test JVMs

(force via -Drandomized.file.encoding=XXX). (Dawid Weiss)

LUCENE-4189: Test output should include timestamps (start/end for each
test/ suite). Added -Dtests.timestamps=[off by default]. (Dawid Weiss)

LUCENE-4110: Report long periods of forked jvm inactivity (hung tests/ suites).
Added -Dtests.heartbeat=[seconds] with the default of 60 seconds.
(Dawid Weiss)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1357543 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dawid Weiss 2012-07-05 10:40:01 +00:00
parent 80c5475725
commit b57a83e50a
13 changed files with 88 additions and 33 deletions

View File

@ -170,6 +170,6 @@
<classpathentry kind="lib" path="solr/contrib/velocity/lib/commons-beanutils-1.7.0.jar"/>
<classpathentry kind="lib" path="solr/contrib/velocity/lib/commons-collections-3.2.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lucene/test-framework/lib/randomizedtesting-runner-1.5.0.jar"/>
<classpathentry kind="lib" path="lucene/test-framework/lib/randomizedtesting-runner-1.6.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -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-1.5.0.jar!/" />
<root url="jar://$PROJECT_DIR$/lucene/test-framework/lib/randomizedtesting-runner-1.6.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View File

@ -383,7 +383,7 @@
<dependency>
<groupId>com.carrotsearch.randomizedtesting</groupId>
<artifactId>randomizedtesting-runner</artifactId>
<version>1.5.0</version>
<version>1.6.0</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@ -42,6 +42,16 @@ Bug Fixes
Build
* LUCENE-4094: Support overriding file.encoding on forked test JVMs
(force via -Drandomized.file.encoding=XXX). (Dawid Weiss)
* LUCENE-4189: Test output should include timestamps (start/end for each
test/ suite). Added -Dtests.timestamps=[off by default]. (Dawid Weiss)
* LUCENE-4110: Report long periods of forked jvm inactivity (hung tests/ suites).
Added -Dtests.heartbeat=[seconds] with the default of 60 seconds.
(Dawid Weiss)
* LUCENE-4160: Added a property to quit the tests after a given
number of failures has occurred. This is useful in combination
with -Dtests.iters=N (you can start N iterations and wait for M

View File

@ -18,7 +18,8 @@
-->
<project name="common" xmlns:artifact="antlib:org.apache.maven.artifact.ant"
xmlns:ivy="antlib:org.apache.ivy.ant">
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:junit4="antlib:com.carrotsearch.junit4">
<description>
This file is designed for importing into a main build file, and not intended
for standalone use.
@ -107,6 +108,11 @@
<property name="tests.maxClassNameColumns" value="10000" />
<!-- Show suite summaries for tests. -->
<property name="tests.showSuiteSummary" value="true" />
<!-- Show timestamps in console test reports. -->
<property name="tests.timestamps" value="false" />
<!-- Heartbeat in seconds for reporting long running tests or hung forked JVMs. -->
<property name="tests.heartbeat" value="60" />
<!-- Configure test emission to console for each type of status -->
<property name="tests.showError" value="true" />
<property name="tests.showFailure" value="true" />
@ -675,7 +681,7 @@
<target name="test-updatecache" description="Overwrite tests' timings cache for balancing." depends="install-junit4-taskdef">
<touch file="${tests.cachefile}" mkdirs="true" verbose="false" />
<mergehints file="${tests.cachefile}" historyLength="${tests.cachefilehistory}">
<junit4:mergehints file="${tests.cachefile}" historyLength="${tests.cachefilehistory}">
<resources>
<!-- The order is important. Include previous stats first, then append new stats. -->
<file file="${tests.cachefile}" />
@ -684,7 +690,7 @@
<exclude name="lucene/tools/junit4/**" />
</fileset>
</resources>
</mergehints>
</junit4:mergehints>
</target>
<!-- Aliases for tests filters -->
@ -739,11 +745,32 @@
<!-- Defaults. -->
<property name="tests.class" value="" />
<property name="tests.method" value="" />
<property name="tests.dynamicAssignmentRatio" value="0.25" /> <!-- 25% of suites -->
<property name="tests.dynamicAssignmentRatio" value="0.50" /> <!-- 50% of suites -->
<property name="tests.haltonfailure" value="true" />
<property name="tests.iters" value="" />
<junit4
<!-- Pick the random seed now (unless already set). -->
<junit4:pickseed property="tests.seed" />
<!-- Pick file.encoding based on the random seed. -->
<junit4:pickfromlist property="tests.file.encoding" allowundefined="false" seed="${tests.seed}">
<!-- Guaranteed support on any JVM. -->
<value>US-ASCII</value> <!-- single byte length -->
<value>ISO-8859-1</value> <!-- single byte length -->
<value>UTF-8</value> <!-- variable byte length -->
<value><!-- empty/ default encoding. --></value>
<!--
Disabled because of Java 1.7 bug on Linux/ Unix:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7181721
<value>UTF-16</value>
<value>UTF-16LE</value>
<value>UTF-16BE</value>
-->
</junit4:pickfromlist>
<junit4:junit4
dir="@{tempDir}"
tempdir="@{tempDir}"
maxmemory="${tests.heapsize}"
@ -758,6 +785,8 @@
shuffleOnSlave="true"
leaveTemporary="false"
seed="${tests.seed}"
heartbeat="${tests.heartbeat}"
>
<!-- Classpaths. -->
<classpath refid="@{junit.classpath}"/>
@ -825,17 +854,23 @@
<propertyref prefix="tests.failfast" />
</syspropertyset>
<!-- Pass randomized settings to the forked JVM. -->
<syspropertyset ignoreEmpty="true">
<propertyref prefix="tests.file.encoding" />
<mapper type="glob" from="tests.*" to="*" />
</syspropertyset>
<!-- Use static cached test balancing statistcs. -->
<balancers>
<execution-times>
<junit4:execution-times>
<fileset dir="${common.dir}/tools/junit4" includes="**/*.txt" />
</execution-times>
</junit4:execution-times>
</balancers>
<!-- Reporting listeners. -->
<listeners>
<!-- A simplified console output (maven-like). -->
<report-text
<junit4:report-text
showThrowable="true"
showStackTraces="true"
showOutputStream="true"
@ -850,10 +885,12 @@
useSimpleNames="${tests.useSimpleNames}"
maxClassNameColumns="${tests.maxClassNameColumns}"
timestamps="${tests.timestamps}"
/>
<!-- Emits full status for all tests, their relative order on slaves. -->
<report-text
<junit4:report-text
file="@{junit.output.dir}/tests-report.txt"
showThrowable="true"
showStackTraces="true"
@ -866,10 +903,11 @@
showStatusIgnored="true"
showSuiteSummary="true"
timestamps="true"
/>
<!-- Emits status on errors and failures only. -->
<report-text
<junit4:report-text
file="@{junit.output.dir}/tests-failures.txt"
showThrowable="true"
showStackTraces="true"
@ -882,14 +920,15 @@
showStatusIgnored="false"
showSuiteSummary="false"
timestamps="true"
/>
<!-- Emit the information about tests timings (could be used to determine
the slowest tests or for reuse in balancing). -->
<report-execution-times file="@{junit.output.dir}/tests-timehints.txt" historyLength="5" />
<junit4:report-execution-times file="@{junit.output.dir}/tests-timehints.txt" historyLength="5" />
<report-ant-xml dir="@{junit.output.dir}" />
<report-json file="@{junit.output.dir}/tests-report-${ant.project.name}/index.html" />
<junit4:report-ant-xml dir="@{junit.output.dir}" />
<junit4:report-json file="@{junit.output.dir}/tests-report-${ant.project.name}/index.html" />
</listeners>
<!-- Input test classes. -->
@ -898,29 +937,29 @@
<include name="**/*Test.class" />
<exclude name="**/*$*" />
</fileset>
</junit4>
</junit4:junit4>
<!-- Report the 5 slowest tests from this run to the console. -->
<echo>5 slowest tests:</echo>
<tophints max="5">
<junit4:tophints max="5">
<file file="@{junit.output.dir}/tests-timehints.txt" />
</tophints>
</junit4:tophints>
</sequential>
</macrodef>
<target name="test-times" description="Show the slowest tests (averages)." depends="install-junit4-taskdef">
<property name="max" value="10" />
<echo>Showing ${max} slowest tests according to local stats. (change with -Dmax=...).</echo>
<tophints max="${max}">
<junit4:tophints max="${max}">
<fileset dir="${basedir}" includes="**/tests-timehints.txt" />
</tophints>
</junit4:tophints>
<echo>Showing ${max} slowest tests in cached stats. (change with -Dmax=...).</echo>
<tophints max="${max}">
<junit4:tophints max="${max}">
<fileset dir="${common.dir}/tools/junit4">
<include name="*.txt" />
</fileset>
</tophints>
</junit4:tophints>
</target>
<target name="test-help" description="Help on 'ant test' syntax.">
@ -1021,6 +1060,12 @@ ant -Dtests.showSuccess=true test
# Display local averaged stats, if any (30 slowest tests).
ant test-times -Dmax=30
# Display a timestamp alongside each suite/ test.
ant -Dtests.timestamps=on ...
# Override forked JVM file.encoding
ant -Dtests.file.encoding=XXX ...
# Output test files and reports.
${tests-output}/tests-report.txt - full ASCII tests report
${tests-output}/tests-failures.txt - failures only (if any)
@ -1031,12 +1076,12 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
</echo>
</target>
<target name="install-junit4-taskdef">
<target name="install-junit4-taskdef" depends="ivy-configure">
<!-- JUnit4 taskdef. -->
<ivy:resolve file="${common.dir}/test-framework/ivy.xml" type="jar" log="quiet" />
<ivy:cachepath file="${common.dir}/test-framework/ivy.xml" conf="junit4-stdalone" type="jar" transitive="false" pathid="path.junit4" />
<taskdef resource="com/carrotsearch/junit4/antlib.xml">
<taskdef uri="antlib:com.carrotsearch.junit4">
<classpath refid="path.junit4" />
</taskdef>
</target>

View File

@ -588,7 +588,7 @@ public final class UnicodeUtil {
out[out_offset++] = (char)(((b&0xf)<<12) + ((utf8[offset]&0x3f)<<6) + (utf8[offset+1]&0x3f));
offset += 2;
} else {
assert b < 0xf8: "b=" + b;
assert b < 0xf8: "b = 0x" + Integer.toHexString(b);
int ch = ((b&0x7)<<18) + ((utf8[offset]&0x3f)<<12) + ((utf8[offset+1]&0x3f)<<6) + (utf8[offset+2]&0x3f);
offset += 3;
if (ch < UNI_MAX_BMP) {

View File

@ -29,7 +29,7 @@
<!-- you might need to tweak this from china so it works -->
<ibiblio name="working-chinese-mirror" root="http://mirror.netcologne.de/maven2" m2compatible="true" />
<chain name="default" returnFirst="true" checkmodified="true">
<chain name="default" returnFirst="true" checkmodified="true" changingPattern=".*SNAPSHOT">
<resolver ref="local"/>
<resolver ref="main"/>
<resolver ref="sonatype-releases" />

View File

@ -33,8 +33,8 @@
<dependency org="org.apache.ant" name="ant-junit" rev="1.8.2" transitive="false" />
<dependency org="junit" name="junit" rev="4.10" transitive="false" conf="default->*;junit4-stdalone->*" />
<dependency org="com.carrotsearch.randomizedtesting" name="junit4-ant" rev="1.5.0" transitive="false" conf="default->*;junit4-stdalone->*" />
<dependency org="com.carrotsearch.randomizedtesting" name="randomizedtesting-runner" rev="1.5.0" transitive="false" conf="default->*;junit4-stdalone->*" />
<dependency org="com.carrotsearch.randomizedtesting" name="junit4-ant" rev="1.6.0" transitive="false" conf="default->*;junit4-stdalone->*" />
<dependency org="com.carrotsearch.randomizedtesting" name="randomizedtesting-runner" rev="1.6.0" transitive="false" conf="default->*;junit4-stdalone->*" />
<exclude org="*" ext="*" matcher="regexp" type="${ivy.exclude.types}"/>
</dependencies>

View File

@ -1 +0,0 @@
4e920288c2d2cd39b7e15f3abcaa3c5e2213ec9c

View File

@ -0,0 +1 @@
c7a65e96a2c62ba83ca404065305aec5dc7fc8f1

View File

@ -1 +0,0 @@
378731cc7f26d45b68a6e5f600d4c7d071d165b1

View File

@ -0,0 +1 @@
709f9549a0b0c2e2ecdd5af012d9531325d6551b

View File

@ -160,8 +160,8 @@ public final class RunListenerPrintReproduceInfo extends RunListener {
addVmOpt(b, "tests.timezone", classEnvRule.timeZone.getID());
}
}
// Randomize this: LUCENE-4094
addVmOpt(b, "args", "-Dfile.encoding=" + System.getProperty("file.encoding"));
addVmOpt(b, "randomized.file.encoding", System.getProperty("file.encoding"));
System.err.println(b.toString());
}