You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/11/19 16:41:39 UTC

svn commit: r1203997 - /lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java

Author: rmuir
Date: Sat Nov 19 15:41:39 2011
New Revision: 1203997

URL: http://svn.apache.org/viewvc?rev=1203997&view=rev
Log:
backport fix to benchmark tests to use a real tempdir

Modified:
    lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java

Modified: lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java?rev=1203997&r1=1203996&r2=1203997&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java Sat Nov 19 15:41:39 2011
@@ -26,12 +26,28 @@ import java.io.StringReader;
 
 import org.apache.lucene.benchmark.byTask.Benchmark;
 import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util._TestUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 
 /** Base class for all Benchmark unit tests. */
 public abstract class BenchmarkTestCase extends LuceneTestCase {
+  private static File WORKDIR;
+  
+  @BeforeClass
+  public static void beforeClassBenchmarkTestCase() throws Exception {
+    WORKDIR = _TestUtil.getTempDir("benchmark");
+    WORKDIR.delete();
+    WORKDIR.mkdirs();
+  }
+  
+  @AfterClass
+  public static void afterClassBenchmarkTestCase() throws Exception {
+    WORKDIR = null;
+  }
   
   public File getWorkDir() {
-    return TEMP_DIR;
+    return WORKDIR;
   }
   
   /** Copy a resource into the workdir */