SOLR-2011: Solr tests now use a tempdir in build/ which is removed by 'ant clean', like lucene

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@981598 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2010-08-02 16:59:23 +00:00
parent 3885ed48ac
commit cf46248d35
5 changed files with 32 additions and 10 deletions

View File

@ -410,6 +410,7 @@
<macrodef name="junit-macro"> <macrodef name="junit-macro">
<attribute name="threadNum" default="1"/> <attribute name="threadNum" default="1"/>
<attribute name="threadTotal" default="1"/> <attribute name="threadTotal" default="1"/>
<attribute name="tempDir" default="${junit.output.dir}/temp"/>
<sequential> <sequential>
<!-- no description so it doesn't show up in -projecthelp --> <!-- no description so it doesn't show up in -projecthelp -->
<condition property="runall"> <condition property="runall">
@ -424,6 +425,10 @@
<condition property="dir.prop" value="-Dsolr.directoryFactory=solr.StandardDirectoryFactory"> <condition property="dir.prop" value="-Dsolr.directoryFactory=solr.StandardDirectoryFactory">
<isset property="use.fsdir"/> <isset property="use.fsdir"/>
</condition> </condition>
<!-- <mkdir dir="@{tempDir}/@{pattern}"/>
This is very loud and obnoxious. abuse touch instead for a "quiet" mkdir
-->
<touch file="@{tempDir}/@{threadNum}/quiet.ant" verbose="false" mkdirs="true"/>
<property name="dir.prop" value=""/> <property name="dir.prop" value=""/>
<junit printsummary="no" <junit printsummary="no"
haltonfailure="no" haltonfailure="no"
@ -431,12 +436,13 @@
errorProperty="tests.failed" errorProperty="tests.failed"
failureProperty="tests.failed" failureProperty="tests.failed"
dir="src/test/test-files/" dir="src/test/test-files/"
tempdir="${junit.output.dir}" tempdir="@{tempDir}/@{threadNum}"
> >
<sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/> <sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/>
<sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/> <sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>
<sysproperty key="tests.codec" value="${tests.codec}"/> <sysproperty key="tests.codec" value="${tests.codec}"/>
<sysproperty key="jetty.insecurerandom" value="1"/> <sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="tempDir" file="@{tempDir}/@{threadNum}"/>
<jvmarg line="${dir.prop}"/> <jvmarg line="${dir.prop}"/>
<jvmarg line="${args}"/> <jvmarg line="${args}"/>

View File

@ -128,11 +128,15 @@
</solr-javac> </solr-javac>
</target> </target>
<property name="tempDir" value="${junit.output.dir}/temp" />
<target name="test" depends="testCore,testExtras"/> <target name="test" depends="testCore,testExtras"/>
<target name="testCore" depends="compileTests"> <target name="testCore" depends="compileTests">
<mkdir dir="${junit.output.dir}"/> <mkdir dir="${junit.output.dir}"/>
<!-- <mkdir dir="@{tempDir}/@{pattern}"/>
This is very loud and obnoxious. abuse touch instead for a "quiet" mkdir
-->
<touch file="${tempDir}/quiet.ant" verbose="false" mkdirs="true"/>
<condition property="runall"> <condition property="runall">
<not> <not>
<or> <or>
@ -149,9 +153,10 @@
errorProperty="tests.failed" errorProperty="tests.failed"
failureProperty="tests.failed" failureProperty="tests.failed"
dir="src/test/resources/" dir="src/test/resources/"
tempdir="${junit.output.dir}" tempdir="${tempDir}"
> >
<sysproperty key="jetty.insecurerandom" value="1"/> <sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="tempDir" file="${tempDir}"/>
<formatter type="brief" usefile="false" if="junit.details"/> <formatter type="brief" usefile="false" if="junit.details"/>
<classpath refid="test.classpath"/> <classpath refid="test.classpath"/>
<formatter type="xml"/> <formatter type="xml"/>
@ -174,6 +179,10 @@
<target name="testExtras" depends="compileExtrasTests"> <target name="testExtras" depends="compileExtrasTests">
<mkdir dir="${junit.output.dir}"/> <mkdir dir="${junit.output.dir}"/>
<!-- <mkdir dir="@{tempDir}/@{pattern}"/>
This is very loud and obnoxious. abuse touch instead for a "quiet" mkdir
-->
<touch file="${tempDir}/quiet.ant" verbose="false" mkdirs="true"/>
<condition property="runall"> <condition property="runall">
<not> <not>
@ -191,8 +200,10 @@
errorProperty="tests.failed" errorProperty="tests.failed"
failureProperty="tests.failed" failureProperty="tests.failed"
dir="src/extras/test/resources/" dir="src/extras/test/resources/"
tempdir="${tempDir}"
> >
<sysproperty key="jetty.insecurerandom" value="1"/> <sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="tempDir" file="${tempDir}"/>
<formatter type="brief" usefile="false" if="junit.details"/> <formatter type="brief" usefile="false" if="junit.details"/>
<classpath refid="test.extras.classpath"/> <classpath refid="test.extras.classpath"/>
<assertions> <assertions>

View File

@ -78,8 +78,14 @@
</solr-javac> </solr-javac>
</target> </target>
<property name="tempDir" value="${junit.output.dir}/temp" />
<target name="test" depends="compileTests"> <target name="test" depends="compileTests">
<mkdir dir="${junit.output.dir}"/> <mkdir dir="${junit.output.dir}"/>
<!-- <mkdir dir="@{tempDir}/@{pattern}"/>
This is very loud and obnoxious. abuse touch instead for a "quiet" mkdir
-->
<touch file="${tempDir}/quiet.ant" verbose="false" mkdirs="true"/>
<condition property="runall"> <condition property="runall">
<not> <not>
@ -97,9 +103,10 @@
errorProperty="tests.failed" errorProperty="tests.failed"
failureProperty="tests.failed" failureProperty="tests.failed"
dir="src/test/resources/" dir="src/test/resources/"
tempdir="${junit.output.dir}" tempdir="${tempDir}"
> >
<sysproperty key="jetty.insecurerandom" value="1"/> <sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="tempDir" file="${tempDir}"/>
<formatter type="brief" usefile="false" if="junit.details"/> <formatter type="brief" usefile="false" if="junit.details"/>
<classpath refid="test.classpath"/> <classpath refid="test.classpath"/>
<assertions> <assertions>

View File

@ -181,9 +181,8 @@ public class SolrTestCaseJ4 extends LuceneTestCaseJ4 {
public static void createTempDir() { public static void createTempDir() {
String cname = getSimpleClassName(); String cname = getSimpleClassName();
dataDir = new File(System.getProperty("java.io.tmpdir") dataDir = new File(TEMP_DIR,
+ System.getProperty("file.separator") "solrtest-" + cname + "-" + System.currentTimeMillis());
+"solrtest-" + cname + "-" + System.currentTimeMillis());
dataDir.mkdirs(); dataDir.mkdirs();
} }

View File

@ -110,9 +110,8 @@ public abstract class AbstractSolrTestCase extends LuceneTestCase {
if (factoryProp == null) { if (factoryProp == null) {
System.setProperty("solr.directoryFactory","solr.RAMDirectoryFactory"); System.setProperty("solr.directoryFactory","solr.RAMDirectoryFactory");
} }
dataDir = new File(System.getProperty("java.io.tmpdir") dataDir = new File(TEMP_DIR,
+ System.getProperty("file.separator") getClass().getName() + "-" + System.currentTimeMillis());
+ getClass().getName() + "-" + System.currentTimeMillis());
dataDir.mkdirs(); dataDir.mkdirs();
String configFile = getSolrConfigFile(); String configFile = getSolrConfigFile();