mirror of https://github.com/apache/lucene.git
speedups for the slowest tests
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1674704 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ea83cc6678
commit
39da139934
|
@ -28,6 +28,7 @@ import org.apache.lucene.util.BytesRef;
|
|||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.LineFileDocs;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||
import org.apache.lucene.util.TestUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -36,6 +37,7 @@ import java.util.Random;
|
|||
/**
|
||||
* Compares one codec against another
|
||||
*/
|
||||
@Slow
|
||||
public class TestDuelingCodecs extends LuceneTestCase {
|
||||
Directory leftDir;
|
||||
IndexReader leftReader;
|
||||
|
|
|
@ -879,14 +879,25 @@ public class TestLRUQueryCache extends LuceneTestCase {
|
|||
doc.add(f);
|
||||
w.addDocument(doc);
|
||||
IndexReader reader = w.getReader();
|
||||
|
||||
final int maxSize;
|
||||
final long maxRamBytesUsed;
|
||||
final int iters;
|
||||
|
||||
if (TEST_NIGHTLY) {
|
||||
maxSize = TestUtil.nextInt(random(), 1, 10000);
|
||||
maxRamBytesUsed = TestUtil.nextLong(random(), 1, 5000000);
|
||||
iters = atLeast(20000);
|
||||
} else {
|
||||
maxSize = TestUtil.nextInt(random(), 1, 1000);
|
||||
maxRamBytesUsed = TestUtil.nextLong(random(), 1, 500000);
|
||||
iters = atLeast(2000);
|
||||
}
|
||||
|
||||
final int maxSize = TestUtil.nextInt(random(), 1, 10000);
|
||||
final long maxRamBytesUsed = TestUtil.nextLong(random(), 1, 5000000);
|
||||
final LRUQueryCache queryCache = new LRUQueryCache(maxSize, maxRamBytesUsed);
|
||||
IndexSearcher uncachedSearcher = null;
|
||||
IndexSearcher cachedSearcher = null;
|
||||
|
||||
final int iters = atLeast(20000);
|
||||
for (int i = 0; i < iters; ++i) {
|
||||
if (i == 0 || random().nextInt(100) == 1) {
|
||||
reader.close();
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.apache.lucene.store.Directory;
|
|||
import org.apache.lucene.util.BitDocIdSet;
|
||||
import org.apache.lucene.util.Bits;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
|
||||
import org.apache.lucene.util.TestUtil;
|
||||
import org.apache.lucene.util.automaton.Automata;
|
||||
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
||||
|
@ -50,6 +51,7 @@ import org.junit.BeforeClass;
|
|||
* {@link #assertSameSet(Query, Query)} and
|
||||
* {@link #assertSubsetOf(Query, Query)}
|
||||
*/
|
||||
@SuppressCodecs("SimpleText")
|
||||
public abstract class SearchEquivalenceTestBase extends LuceneTestCase {
|
||||
protected static IndexSearcher s1, s2;
|
||||
protected static Directory directory;
|
||||
|
@ -72,7 +74,7 @@ public abstract class SearchEquivalenceTestBase extends LuceneTestCase {
|
|||
doc.add(field);
|
||||
|
||||
// index some docs
|
||||
int numDocs = atLeast(1000);
|
||||
int numDocs = TEST_NIGHTLY ? atLeast(1000) : atLeast(100);
|
||||
for (int i = 0; i < numDocs; i++) {
|
||||
id.setStringValue(Integer.toString(i));
|
||||
field.setStringValue(randomFieldContents());
|
||||
|
@ -244,7 +246,7 @@ public abstract class SearchEquivalenceTestBase extends LuceneTestCase {
|
|||
assertSubsetOf(q1, q2, null);
|
||||
|
||||
// test with some filters (this will sometimes cause advance'ing enough to test it)
|
||||
int numFilters = atLeast(10);
|
||||
int numFilters = TEST_NIGHTLY ? atLeast(10) : atLeast(3);
|
||||
for (int i = 0; i < numFilters; i++) {
|
||||
Filter filter = randomFilter();
|
||||
// incorporate the filter in different ways.
|
||||
|
@ -298,7 +300,7 @@ public abstract class SearchEquivalenceTestBase extends LuceneTestCase {
|
|||
|
||||
assertSameScores(q1, q2, null);
|
||||
// also test with some filters to test advancing
|
||||
int numFilters = atLeast(10);
|
||||
int numFilters = TEST_NIGHTLY ? atLeast(10) : atLeast(3);
|
||||
for (int i = 0; i < numFilters; i++) {
|
||||
Filter filter = randomFilter();
|
||||
// incorporate the filter in different ways.
|
||||
|
|
|
@ -1057,7 +1057,12 @@ public abstract class BaseDirectoryTestCase extends LuceneTestCase {
|
|||
public void testSliceOfSlice() throws Exception {
|
||||
Directory dir = getDirectory(createTempDir("sliceOfSlice"));
|
||||
IndexOutput output = dir.createOutput("bytes", newIOContext(random()));
|
||||
int num = TestUtil.nextInt(random(), 50, 2500);
|
||||
final int num;
|
||||
if (TEST_NIGHTLY) {
|
||||
num = TestUtil.nextInt(random(), 250, 2500);
|
||||
} else {
|
||||
num = TestUtil.nextInt(random(), 50, 250);
|
||||
}
|
||||
byte bytes[] = new byte[num];
|
||||
random().nextBytes(bytes);
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
|
|
Loading…
Reference in New Issue