Here's an example demonstrating what i mean. enable the SOP with
-Dtests.jvms=1 (like hudson does) and tail -f the tests log
then make the change in how we compute 'randomVal' for codec selection
and run again:
Index: lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
===================================================================
--- lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
(revision
1327235)
+++ lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
(working
copy)
@@ -405,7 +405,7 @@
PREFLEX_IMPERSONATION_IS_ACTIVE = false;
savedCodec = Codec.getDefault();
final Codec codec;
- int randomVal = random().nextInt(10);
+ int randomVal = new Random(random().nextLong() ^
getTestClass().getSimpleName().hashCode()).nextInt(10);
if ("Lucene3x".equals(TEST_CODEC) || ("random".equals(TEST_CODEC)
&& randomVal < 2)) { // preflex-only setup
codec = Codec.forName("Lucene3x");
@@ -436,6 +436,7 @@
}
Codec.setDefault(codec);
+ System.out.println("codec=" + codec);
savedLocale = Locale.getDefault();
On Tue, Apr 17, 2012 at 4:13 PM, Robert Muir <[email protected]> wrote:
> I see: [junit4] <JUnit4> says hello. Random seed: A773AE0846178A0
>
> at the start of the JVM. does this mean that all tests run with the
> same initial seed?
>
> For example looking at tests, it seems it does, e.g. in a test run all
> my tests will run with the same codec for example.
> (see https://builds.apache.org/job/Lucene-trunk/1897/console, many
> assumes for PreFlex)
>
> From a coverage perspective, if this is the case, its not good because
> it means we don't get good mixed coverage of the different codecs...
> So you could easily make a change that breaks some codec horribly and
> not know, unless you do many 'ant test' runs.
>
> Can we fix the random to maybe initialize based on this seed + a hash
> of the class name itself?
>
> --
> lucidimagination.com
--
lucidimagination.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]