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">
<attribute name="threadNum" default="1"/>
<attribute name="threadTotal" default="1"/>
<attribute name="tempDir" default="${junit.output.dir}/temp"/>
<sequential>
<!-- no description so it doesn't show up in -projecthelp -->
<condition property="runall">
@ -424,6 +425,10 @@
<condition property="dir.prop" value="-Dsolr.directoryFactory=solr.StandardDirectoryFactory">
<isset property="use.fsdir"/>
</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=""/>
<junit printsummary="no"
haltonfailure="no"
@ -431,12 +436,13 @@
errorProperty="tests.failed"
failureProperty="tests.failed"
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="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>
<sysproperty key="tests.codec" value="${tests.codec}"/>
<sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="tempDir" file="@{tempDir}/@{threadNum}"/>
<jvmarg line="${dir.prop}"/>
<jvmarg line="${args}"/>

View File

@ -128,11 +128,15 @@
</solr-javac>
</target>
<property name="tempDir" value="${junit.output.dir}/temp" />
<target name="test" depends="testCore,testExtras"/>
<target name="testCore" depends="compileTests">
<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">
<not>
<or>
@ -149,9 +153,10 @@
errorProperty="tests.failed"
failureProperty="tests.failed"
dir="src/test/resources/"
tempdir="${junit.output.dir}"
tempdir="${tempDir}"
>
<sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="tempDir" file="${tempDir}"/>
<formatter type="brief" usefile="false" if="junit.details"/>
<classpath refid="test.classpath"/>
<formatter type="xml"/>
@ -174,6 +179,10 @@
<target name="testExtras" depends="compileExtrasTests">
<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">
<not>
@ -191,8 +200,10 @@
errorProperty="tests.failed"
failureProperty="tests.failed"
dir="src/extras/test/resources/"
tempdir="${tempDir}"
>
<sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="tempDir" file="${tempDir}"/>
<formatter type="brief" usefile="false" if="junit.details"/>
<classpath refid="test.extras.classpath"/>
<assertions>

View File

@ -78,8 +78,14 @@
</solr-javac>
</target>
<property name="tempDir" value="${junit.output.dir}/temp" />
<target name="test" depends="compileTests">
<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">
<not>
@ -97,9 +103,10 @@
errorProperty="tests.failed"
failureProperty="tests.failed"
dir="src/test/resources/"
tempdir="${junit.output.dir}"
tempdir="${tempDir}"
>
<sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="tempDir" file="${tempDir}"/>
<formatter type="brief" usefile="false" if="junit.details"/>
<classpath refid="test.classpath"/>
<assertions>

View File

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

View File

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