Index: lucene/common-build.xml
===================================================================
--- lucene/common-build.xml (revision 1210031)
+++ lucene/common-build.xml (working copy)
@@ -94,10 +94,13 @@
+
+
+
@@ -527,8 +530,10 @@
-
-
+
+
+
+
@@ -542,7 +547,7 @@
This is very loud and obnoxious. abuse touch instead for a "quiet" mkdir
-->
-
@@ -584,6 +589,10 @@
+
+
+
+
Index: lucene/src/test/org/apache/lucene/index/Test2BTerms.java
===================================================================
--- lucene/src/test/org/apache/lucene/index/Test2BTerms.java (revision 1210031)
+++ lucene/src/test/org/apache/lucene/index/Test2BTerms.java (working copy)
@@ -41,11 +41,11 @@
// disk (but, should run successfully). Best to run w/
// -Dtests.codec=Standard, and w/ plenty of RAM, eg:
//
-// ant compile-test
+// ant test -Dtest.weekly=true -Dtest.slow=true -Dtests.heapsize=8g
//
// java -server -Xmx8g -d64 -cp .:lib/junit-4.7.jar:./build/classes/test:./build/classes/test-framework:./build/classes/java -Dlucene.version=4.0-dev -Dtests.directory=MMapDirectory -DtempDir=build -ea org.junit.runner.JUnitCore org.apache.lucene.index.Test2BTerms
//
-
+@LuceneTestCase.UseNoMemoryExpensiveCodec
public class Test2BTerms extends LuceneTestCase {
private final static int TOKEN_LEN = 10;
@@ -140,13 +140,13 @@
}
}
- @Ignore("Takes ~4 hours to run on a fast machine!! And requires that you don't use PreFlex codec.")
+ @Slow
public void test2BTerms() throws IOException {
if ("Lucene3x".equals(Codec.getDefault().getName())) {
- throw new RuntimeException("thist test cannot run with PreFlex codec");
+ throw new RuntimeException("this test cannot run with PreFlex codec");
}
-
+ System.out.println("Starting Test2B");
final long TERM_COUNT = ((long) Integer.MAX_VALUE) + 100000000;
final int TERMS_PER_DOC = _TestUtil.nextInt(random, 100000, 1000000);
Index: lucene/src/test-framework/java/org/apache/lucene/util/LuceneTestCaseRunner.java
===================================================================
--- lucene/src/test-framework/java/org/apache/lucene/util/LuceneTestCaseRunner.java (revision 1210031)
+++ lucene/src/test-framework/java/org/apache/lucene/util/LuceneTestCaseRunner.java (working copy)
@@ -17,6 +17,7 @@
* limitations under the License.
*/
+import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
@@ -26,6 +27,8 @@
import java.util.Random;
import org.apache.lucene.util.LuceneTestCase.Nightly;
+import org.apache.lucene.util.LuceneTestCase.Weekly;
+import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.lucene.util.LuceneTestCase.UseNoMemoryExpensiveCodec;
import org.junit.Ignore;
import org.junit.Test;
@@ -45,8 +48,11 @@
import static org.apache.lucene.util.LuceneTestCase.TEST_METHOD;
import static org.apache.lucene.util.LuceneTestCase.TEST_SEED;
import static org.apache.lucene.util.LuceneTestCase.TEST_NIGHTLY;
+import static org.apache.lucene.util.LuceneTestCase.TEST_WEEKLY;
+import static org.apache.lucene.util.LuceneTestCase.TEST_SLOW;
import static org.apache.lucene.util.LuceneTestCase.VERBOSE;
+
/** optionally filters the tests to be run by TEST_METHOD */
public class LuceneTestCaseRunner extends BlockJUnit4ClassRunner {
private List testMethods;
@@ -89,28 +95,14 @@
}
if (TEST_NIGHTLY == false) {
- if (getTestClass().getJavaClass().isAnnotationPresent(Nightly.class)) {
- /* the test class is annotated with nightly, remove all methods */
- String className = getTestClass().getJavaClass().getSimpleName();
- System.err.println("NOTE: Ignoring nightly-only test class '" + className + "'");
- testMethods.clear();
- } else {
- /* remove all nightly-only methods */
- for (int i = 0; i < testMethods.size(); i++) {
- final FrameworkMethod m = testMethods.get(i);
- if (m.getAnnotation(Nightly.class) != null) {
- System.err.println("NOTE: Ignoring nightly-only test method '" + m.getName() + "'");
- testMethods.remove(i--);
- }
- }
- }
- /* dodge a possible "no-runnable methods" exception by adding a fake ignored test */
- if (testMethods.isEmpty()) {
- try {
- testMethods.add(new FrameworkMethod(LuceneTestCase.class.getMethod("alwaysIgnoredTestMethod")));
- } catch (Exception e) { throw new RuntimeException(e); }
- }
+ removeAnnotatedTests(Nightly.class, "@nightly");
}
+ if (TEST_WEEKLY == false) {
+ removeAnnotatedTests(Weekly.class, "@weekly");
+ }
+ if (TEST_SLOW == false) {
+ removeAnnotatedTests(Slow.class, "@slow");
+ }
// sort the test methods first before shuffling them, so that the shuffle is consistent
// across different implementations that might order the methods different originally.
Collections.sort(testMethods, new Comparator() {
@@ -122,7 +114,31 @@
Collections.shuffle(testMethods, r);
return testMethods;
}
-
+
+ private void removeAnnotatedTests(Class extends Annotation> annotation, String userFriendlyName) {
+ if (getTestClass().getJavaClass().isAnnotationPresent(annotation)) {
+ /* the test class is annotated with the annotation, remove all methods */
+ String className = getTestClass().getJavaClass().getSimpleName();
+ System.err.println("NOTE: Ignoring " + userFriendlyName + " test class '" + className + "'");
+ testMethods.clear();
+ } else {
+ /* remove all methods with the annotation*/
+ for (int i = 0; i < testMethods.size(); i++) {
+ final FrameworkMethod m = testMethods.get(i);
+ if (m.getAnnotation(annotation) != null) {
+ System.err.println("NOTE: Ignoring " + userFriendlyName + " test method '" + m.getName() + "'");
+ testMethods.remove(i--);
+ }
+ }
+ }
+ /* dodge a possible "no-runnable methods" exception by adding a fake ignored test */
+ if (testMethods.isEmpty()) {
+ try {
+ testMethods.add(new FrameworkMethod(LuceneTestCase.class.getMethod("alwaysIgnoredTestMethod")));
+ } catch (Exception e) { throw new RuntimeException(e); }
+ }
+ }
+
@Override
protected void runChild(FrameworkMethod arg0, RunNotifier arg1) {
if (VERBOSE) {
Index: lucene/src/test-framework/java/org/apache/lucene/util/LuceneTestCase.java
===================================================================
--- lucene/src/test-framework/java/org/apache/lucene/util/LuceneTestCase.java (revision 1210031)
+++ lucene/src/test-framework/java/org/apache/lucene/util/LuceneTestCase.java (working copy)
@@ -148,8 +148,12 @@
public static final int TEST_ITER_MIN = Integer.parseInt(System.getProperty("tests.iter.min", Integer.toString(TEST_ITER)));
/** Get the random seed for tests */
public static final String TEST_SEED = System.getProperty("tests.seed", "random");
- /** whether or not nightly tests should run */
+ /** whether or not @nightly tests should run */
public static final boolean TEST_NIGHTLY = Boolean.parseBoolean(System.getProperty("tests.nightly", "false"));
+ /** whether or not @weekly tests should run */
+ public static final boolean TEST_WEEKLY = Boolean.parseBoolean(System.getProperty("tests.weekly", "false"));
+ /** whether or not @slow tests should run */
+ public static final boolean TEST_SLOW = Boolean.parseBoolean(System.getProperty("tests.slow", "false"));
/** the line file used by LineFileDocs */
public static final String TEST_LINE_DOCS_FILE = System.getProperty("tests.linedocsfile", "europarl.lines.txt.gz");
/** whether or not to clean threads between test invocations: "false", "perMethod", "perClass" */
@@ -1350,6 +1354,22 @@
public @interface Nightly {}
/**
+ * Annotation for tests that should only be run during weekly builds
+ */
+ @Documented
+ @Inherited
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Weekly{}
+
+ /**
+ * Annotation for tests that are slow and should be run only when specifically asked to run
+ */
+ @Documented
+ @Inherited
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Slow{}
+
+ /**
* Annotation for test classes that should only use codecs that are not memory expensive (avoid SimpleText, MemoryCodec).
*/
@Documented