Apache Lucene open-source search software
LUCENE-6432: add SuppressReproduceLine
Robert Muir44a97f67b752
diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.javaindex e425256c340..ca1ce974a54 100644--- a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java+++ b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java@@ -344,6 +344,16 @@ public abstract class LuceneTestCase extends Assert {public String bugUrl();}+ /**+ * Suppress the default {@code reproduce with: ant test...}+ * Your own listener can be added as needed for your build.+ */+ @Documented+ @Inherited+ @Retention(RetentionPolicy.RUNTIME)+ @Target(ElementType.TYPE)+ public @interface SuppressReproduceLine {}+// -----------------------------------------------------------------// Truly immutable fields and constants, initialized once and valid// for all suites ever since.diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.java b/lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.javaindex dc7d3bfdf69..d3fbcecf02c 100644--- a/lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.java+++ b/lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.java@@ -57,6 +57,9 @@ public final class RunListenerPrintReproduceInfo extends RunListener {/** A marker to print full env. diagnostics after the suite. */private boolean printDiagnosticsAfterClass;++ /** true if we should skip the reproduce string (diagnostics are independent) */+ private boolean suppressReproduceLine;@Override@@ -66,6 +69,7 @@ public final class RunListenerPrintReproduceInfo extends RunListener {scope = LifecycleScope.SUITE;Class<?> targetClass = RandomizedContext.current().getTargetClass();+ suppressReproduceLine = targetClass.isAnnotationPresent(LuceneTestCase.SuppressReproduceLine.class);testClassesRun.add(targetClass.getSimpleName());}@@ -142,6 +146,9 @@ public final class RunListenerPrintReproduceInfo extends RunListener {}private void reportAdditionalFailureInfo(final String testName) {+ if (suppressReproduceLine) {+ return;+ }if (TEST_LINE_DOCS_FILE.endsWith(JENKINS_LARGE_LINE_DOCS_FILE)) {System.err.println("NOTE: download the large Jenkins line-docs file by running " +"'ant get-jenkins-line-docs' in the lucene directory.");