LUCENE-6432: add SuppressReproduceLine

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1674277 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2015-04-17 11:21:21 +00:00
parent 538f90225e
commit 44a97f67b7
2 changed files with 17 additions and 0 deletions

View File

@ -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.

View File

@ -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.");