LUCENE-4488: Enable heapdumps for Jenkins builds on supported JVMs

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1400037 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2012-10-19 10:53:18 +00:00
parent d80c59b48a
commit 5455c64a19
2 changed files with 44 additions and 9 deletions

View File

@ -30,6 +30,8 @@
<subant buildpath="lucene" target="test-help" inheritall="false" failonerror="true"/>
</target>
<property name="tests.heap-dump-dir" location="heapdumps"/>
<target name="precommit" description="Run basic checks before committing"
depends="check-svn-working-copy,validate,documentation-lint"/>
@ -218,13 +220,11 @@
<target name="clean" description="Clean Lucene and Solr build dirs">
<delete dir="dist" />
<sequential>
<subant target="clean" inheritall="false" failonerror="true">
<fileset dir="lucene" includes="build.xml" />
<fileset dir="solr" includes="build.xml" />
</subant>
<delete dir="dist" failonerror="false" />
</sequential>
<delete dir="${tests.heap-dump-dir}" />
<subant target="clean" inheritall="false" failonerror="true">
<fileset dir="lucene" includes="build.xml" />
<fileset dir="solr" includes="build.xml" />
</subant>
</target>
<target name="ivy-bootstrap" description="Download and install Ivy in the users ant lib dir">
@ -309,7 +309,7 @@
<param name="run.clover" value="true"/>
<!-- must be 1, as clover does not like parallel test runs: -->
<param name="tests.jvms" value="1"/>
<!-- Also override some other props to be fast, ignoring what's set on command line: -->
<!-- Also override some other props to be fast: -->
<param name="tests.multiplier" value="1"/>
<param name="tests.nightly" value="false"/>
<param name="tests.weekly" value="false"/>
@ -326,8 +326,40 @@
<subant buildpath="." antfile="extra-targets.xml" target="-generate-clover-reports" inheritall="false" failonerror="true"/>
</target>
<target name="test-with-heapdumps" depends="-test-with-heapdumps-enabled,-test-with-heapdumps-disabled" description="Runs tests with heap dumps on OOM enabled (if VM supports this)"/>
<condition property="vm.supports.heapdumps">
<or>
<contains string="${java.vm.name}" substring="hotspot" casesensitive="false"/>
<contains string="${java.vm.name}" substring="openjdk" casesensitive="false"/>
<contains string="${java.vm.name}" substring="jrockit" casesensitive="false"/>
</or>
</condition>
<target name="-test-with-heapdumps-enabled" if="vm.supports.heapdumps">
<echo level="info" message="${java.vm.name}: Enabling heap dumps on OutOfMemoryError to dir '${tests.heap-dump-dir}'."/>
<mkdir dir="${tests.heap-dump-dir}"/>
<delete includeEmptyDirs="true">
<fileset dir="${tests.heap-dump-dir}" includes="**/*"/>
</delete>
<antcall inheritAll="false" target="test">
<param name="tests.heapdump.args" value="-XX:+HeapDumpOnOutOfMemoryError &quot;-XX:HeapDumpPath=${tests.heap-dump-dir}&quot;"/>
</antcall>
<pathconvert property="heapdumps.list" setonempty="false" pathsep="${line.separator}">
<fileset dir="${tests.heap-dump-dir}"/>
<map from="${tests.heap-dump-dir}${file.separator}" to="* "/>
</pathconvert>
<fail if="heapdumps.list" message="Some of the tests produced a heap dump, but did not fail. Maybe a suppressed OutOfMemoryError? Dumps created:${line.separator}${heapdumps.list}"/>
<delete dir="${tests.heap-dump-dir}"/>
</target>
<target name="-test-with-heapdumps-disabled" unless="vm.supports.heapdumps">
<echo level="warning" message="WARN: The used JVM (${java.vm.name}) does not support HPROF heap dumps on OutOfMemoryError."/>
<antcall target="test"/>
</target>
<!-- Jenkins tasks -->
<target name="jenkins-hourly" depends="clean,test,validate,-jenkins-documentation-lint,jar-checksums,check-svn-working-copy"/>
<target name="jenkins-hourly" depends="clean,test-with-heapdumps,validate,-jenkins-documentation-lint,jar-checksums,check-svn-working-copy"/>
<target name="jenkins-maven-nightly" depends="clean,remove-maven-artifacts,run-maven-build,generate-maven-artifacts,validate-maven-dependencies"/>

View File

@ -109,6 +109,8 @@
</condition>
<property name="tests.clover.args" value=""/>
<property name="tests.heapdump.args" value=""/>
<property name="tests.tempDir" location="${build.dir}/test"/>
<property name="tests.cachefile" location="${common.dir}/tools/junit4/cached-timehints.txt" />
@ -827,6 +829,7 @@
<!-- JVM arguments and system properties. -->
<jvmarg line="${args}"/>
<jvmarg line="${tests.heapdump.args}"/>
<jvmarg line="${tests.clover.args}"/>
<!-- set the number of times tests should run -->