Apache Lucene open-source search software
configure this from build.xml instead of o.a.solr hack
Robert Muircb1514dec785
diff --git a/lucene/common-build.xml b/lucene/common-build.xmlindex d5de15ed735..74252f504be 100644--- a/lucene/common-build.xml+++ b/lucene/common-build.xml@@ -511,6 +511,8 @@<sysproperty key="tests.seed" value="${tests.seed}"/><!-- set the Version that tests should run against --><sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>+ <!-- for lucene we can be strict, and we don't want false fails even across methods -->+ <sysproperty key="tests.cleanthreads" value="perMethod"/><!-- logging config file --><sysproperty key="java.util.logging.config.file" value="${tests.loggingfile}"/><!-- set whether or not nightly tests should run -->diff --git a/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java b/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.javaindex 130b5e02fb4..b56aaf2e4d5 100644--- a/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java+++ b/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java@@ -148,6 +148,8 @@ public abstract class LuceneTestCase extends Assert {public static final boolean TEST_NIGHTLY = Boolean.parseBoolean(System.getProperty("tests.nightly", "false"));/** the line file used by LineFileDocs */public static final String TEST_LINE_DOCS_FILE = System.getProperty("tests.linedocsfile", "europarl.lines.txt.gz");+ /** whether or not to clean threads between test invocations: "false", "perMethod", "perClass" */+ public static final String TEST_CLEAN_THREADS = System.getProperty("tests.cleanthreads", "perClass");private static final Pattern codecWithParam = Pattern.compile("(.*)\\(\\s*(\\d+)\\s*\\)");@@ -342,10 +344,12 @@ public abstract class LuceneTestCase extends Assert {@AfterClasspublic static void afterClassLuceneTestCaseJ4() {- int rogueThreads = threadCleanup("test class");- if (rogueThreads > 0) {- // TODO: fail here once the leaks are fixed.- System.err.println("RESOURCE LEAK: test class left " + rogueThreads + " thread(s) running");+ if (! "false".equals(TEST_CLEAN_THREADS)) {+ int rogueThreads = threadCleanup("test class");+ if (rogueThreads > 0) {+ // TODO: fail here once the leaks are fixed.+ System.err.println("RESOURCE LEAK: test class left " + rogueThreads + " thread(s) running");+ }}String codecDescription;CodecProvider cp = CodecProvider.getDefault();@@ -490,7 +494,7 @@ public abstract class LuceneTestCase extends Assert {assertTrue("ensure your setUp() calls super.setUp()!!!", setup);setup = false;BooleanQuery.setMaxClauseCount(savedBoolMaxClauseCount);- if (!getClass().getName().startsWith("org.apache.solr")) {+ if ("perMethod".equals(TEST_CLEAN_THREADS)) {int rogueThreads = threadCleanup("test method: '" + getName() + "'");if (rogueThreads > 0) {System.err.println("RESOURCE LEAK: test method: '" + getName()