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 2015/04/17 13:25:13 UTC

svn commit: r1674278 - in /lucene/dev/branches/branch_5x: ./ lucene/ lucene/test-framework/ lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.java

Author: rmuir
Date: Fri Apr 17 11:25:12 2015
New Revision: 1674278

URL: http://svn.apache.org/r1674278
Log:
LUCENE-6432: add SuppressReproduceLine

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/lucene/   (props changed)
    lucene/dev/branches/branch_5x/lucene/test-framework/   (props changed)
    lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
    lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.java

Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1674278&r1=1674277&r2=1674278&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java Fri Apr 17 11:25:12 2015
@@ -345,6 +345,16 @@ public abstract class LuceneTestCase ext
     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.

Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.java?rev=1674278&r1=1674277&r2=1674278&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.java (original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.java Fri Apr 17 11:25:12 2015
@@ -57,6 +57,9 @@ public final class RunListenerPrintRepro
 
   /** 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 RunListenerPrintRepro
     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 RunListenerPrintRepro
   }
 
   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.");