Apache Lucene open-source search software
SOLR-2011: Solr tests now use a tempdir in build/ which is removed by 'ant clean', like lucene
Robert Muircf46248d35dd
diff --git a/solr/build.xml b/solr/build.xmlindex ab85b3cc916..199e328ed3d 100644--- a/solr/build.xml+++ b/solr/build.xml@@ -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}"/>diff --git a/solr/contrib/dataimporthandler/build.xml b/solr/contrib/dataimporthandler/build.xmlindex fa5ca20e047..0595f3bae11 100644--- a/solr/contrib/dataimporthandler/build.xml+++ b/solr/contrib/dataimporthandler/build.xml@@ -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>diff --git a/solr/contrib/extraction/build.xml b/solr/contrib/extraction/build.xmlindex 11e4aca89a7..dd2db0fda34 100644--- a/solr/contrib/extraction/build.xml+++ b/solr/contrib/extraction/build.xml@@ -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>diff --git a/solr/src/test/org/apache/solr/SolrTestCaseJ4.java b/solr/src/test/org/apache/solr/SolrTestCaseJ4.javaindex 34e3c3ecc4b..cd53bdc55fe 100755--- a/solr/src/test/org/apache/solr/SolrTestCaseJ4.java+++ b/solr/src/test/org/apache/solr/SolrTestCaseJ4.java@@ -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();}diff --git a/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java b/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.javaindex cec1849d867..03871e6c86c 100644--- a/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java+++ b/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java@@ -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();