lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1062797 - /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
Date Mon, 24 Jan 2011 14:30:49 GMT
Author: rmuir
Date: Mon Jan 24 14:30:48 2011
New Revision: 1062797

URL: http://svn.apache.org/viewvc?rev=1062797&view=rev
Log:
improve seed compatibility across trunk/3x

Modified:
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java?rev=1062797&r1=1062796&r2=1062797&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
Mon Jan 24 14:30:48 2011
@@ -212,6 +212,12 @@ public abstract class LuceneTestCase ext
     staticSeed = "random".equals(TEST_SEED) ? seedRand.nextLong() : TwoLongs.fromString(TEST_SEED).l1;
     random.setSeed(staticSeed);
     stores = Collections.synchronizedMap(new IdentityHashMap<MockDirectoryWrapper,StackTraceElement[]>());
+    // this code consumes randoms where 4.0's lucenetestcase would: to make seeds work across
both branches.
+    // TODO: doesn't completely work, because what if we get mockrandom codec?!
+    if (random.nextInt(4) != 0) {
+      random.nextInt(); // consume RandomCodecProvider's seed.
+    }
+    // end compatibility random-consumption
     savedLocale = Locale.getDefault();
     locale = TEST_LOCALE.equals("random") ? randomLocale(random) : localeForName(TEST_LOCALE);
     Locale.setDefault(locale);



Mime
View raw message