Index: solr/contrib/clustering/build.xml
===================================================================
--- solr/contrib/clustering/build.xml (revision 1035388)
+++ solr/contrib/clustering/build.xml (working copy)
@@ -116,6 +116,8 @@
+
+
Index: solr/contrib/extraction/build.xml
===================================================================
--- solr/contrib/extraction/build.xml (revision 1035388)
+++ solr/contrib/extraction/build.xml (working copy)
@@ -117,6 +117,8 @@
+
+
Index: solr/contrib/dataimporthandler/build.xml
===================================================================
--- solr/contrib/dataimporthandler/build.xml (revision 1035388)
+++ solr/contrib/dataimporthandler/build.xml (working copy)
@@ -168,6 +168,8 @@
+
+
@@ -226,6 +228,8 @@
+
+
Index: solr/contrib/analysis-extras/build.xml
===================================================================
--- solr/contrib/analysis-extras/build.xml (revision 1035388)
+++ solr/contrib/analysis-extras/build.xml (working copy)
@@ -148,6 +148,8 @@
+
+
Index: solr/common-build.xml
===================================================================
--- solr/common-build.xml (revision 1035388)
+++ solr/common-build.xml (working copy)
@@ -61,6 +61,7 @@
+
Index: solr/build.xml
===================================================================
--- solr/build.xml (revision 1035388)
+++ solr/build.xml (working copy)
@@ -436,6 +436,8 @@
+
+
Index: lucene/common-build.xml
===================================================================
--- lucene/common-build.xml (revision 1035388)
+++ lucene/common-build.xml (working copy)
@@ -72,6 +72,7 @@
+
@@ -462,7 +463,9 @@
-
+
+
+
Index: lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
===================================================================
--- lucene/src/test/org/apache/lucene/util/LuceneTestCase.java (revision 1035388)
+++ lucene/src/test/org/apache/lucene/util/LuceneTestCase.java (working copy)
@@ -63,6 +63,10 @@
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -152,6 +156,8 @@
static final int TEST_ITER = Integer.parseInt(System.getProperty("tests.iter", "1"));
/** Get the random seed for tests */
static final String TEST_SEED = System.getProperty("tests.seed", "random");
+ /** whether or not nightly tests should run */
+ static final int TEST_NIGHTLY = Integer.parseInt(System.getProperty("tests.nightly", "0"));
private static final Pattern codecWithParam = Pattern.compile("(.*)\\(\\s*(\\d+)\\s*\\)");
@@ -843,6 +849,14 @@
private String name = "";
+ /**
+ * Annotation for tests that should only be run during nightly builds.
+ */
+ @Documented
+ @Inherited
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Nightly {}
+
/** optionally filters the tests to be run by TEST_METHOD */
public static class LuceneTestCaseRunner extends BlockJUnit4ClassRunner {
private List testMethods;
@@ -856,7 +870,7 @@
for (Method m : getTestClass().getJavaClass().getMethods()) {
// check if the current test's class has methods annotated with @Ignore
final Ignore ignored = m.getAnnotation(Ignore.class);
- if (ignored != null) {
+ if (ignored != null && !m.getName().equals("alwaysIgnoredTestMethod")) {
System.err.println("NOTE: Ignoring test method '" + m.getName() + "': " + ignored.value());
}
// add methods starting with "test"
@@ -872,6 +886,34 @@
testMethods.add(new FrameworkMethod(m));
}
}
+
+ if (testMethods.isEmpty()) {
+ throw new RuntimeException("No runnable methods!");
+ }
+
+ if (TEST_NIGHTLY == 0) {
+ 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) {}
+ }
+ }
return testMethods;
}
@@ -901,4 +943,7 @@
}
}
}
+
+ @Ignore("just a hack")
+ public void alwaysIgnoredTestMethod() {}
}