Skip to content

Apache Lucene open-source search software

Catching up with trunk.

Dawid Weiss943f0cab2675
diff --cc lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
index bc640edabef,246571b530c..e22d7cfc4a8
--- a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
@@@ -246,13 -248,6 +248,13 @@@ public abstract class LuceneTestCase ex
/** @see #ignoreAfterMaxFailures*/
public static final String SYSPROP_FAILFAST = "tests.failfast";
+
+ /**
+ * If true, enables assertions on writing to system streams.
+ *
- * @see TestRuleDisallowSysouts
++ * @see TestRuleLimitSysouts
+ */
+ public static final String SYSPROP_SYSOUTS = "tests.sysouts";
/**
* Annotation for tests that should only be run during nightly builds.
@@@ -353,21 -348,6 +355,21 @@@
public String bugUrl() default "None";
}
+ /**
+ * Marks any suite which is known to print to {@link System#out} or {@link System#err},
+ * even when {@link #VERBOSE} is disabled.
+ *
- * @see TestRuleDisallowSysouts
++ * @see TestRuleLimitSysouts
+ */
+ @Documented
+ @Inherited
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE)
+ public @interface SuppressSysoutChecks {
+ /** Point to JIRA entry. */
+ public String bugUrl();
+ }
+
// -----------------------------------------------------------------
// Truly immutable fields and constants, initialized once and valid
// for all suites ever since.
@@@ -382,7 -362,7 +384,7 @@@
/**
* True if and only if tests are run in verbose mode. If this flag is false
- * tests are not expected to print any messages. Enforced with {@link TestRuleDisallowSysouts}.
- * tests are not expected to print any messages.
++ * tests are not expected to print any messages. Enforced with {@link TestRuleLimitSysouts}.
*/
public static final boolean VERBOSE = systemPropertyAsBoolean("tests.verbose", false);
@@@ -535,15 -513,6 +537,15 @@@
new TestRuleIgnoreAfterMaxFailures(maxFailures));
ignoreAfterMaxFailures = TestRuleDelegate.of(ignoreAfterMaxFailuresDelegate);
}
+
+ /**
+ * Try to capture streams early so that other classes don't have a chance to steal references
+ * to them (as is the case with ju.logging handlers).
+ */
+ static {
- TestRuleDisallowSysouts.checkCaptureStreams();
++ TestRuleLimitSysouts.checkCaptureStreams();
+ Logger.getGlobal().getHandlers();
+ }
/**
* Temporarily substitute the global {@link TestRuleIgnoreAfterMaxFailures}. See
@@@ -578,7 -547,6 +580,7 @@@
.around(ignoreAfterMaxFailures)
.around(suiteFailureMarker = new TestRuleMarkFailure())
.around(new TestRuleAssertionsRequired())
- .around(new TestRuleDisallowSysouts(suiteFailureMarker))
++ .around(new TestRuleLimitSysouts(suiteFailureMarker))
.around(new TemporaryFilesCleanupRule())
.around(new StaticFieldsInvariantRule(STATIC_LEAK_THRESHOLD, true) {
@Override