From 24fcd80a37babadcc0153071b8ff19aca1a13f7b Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Wed, 24 Nov 2021 08:20:04 +0100 Subject: [PATCH] LUCENE-10168: Only test N-2 codecs on nightly runs. (#466) In order for tests to keep running fast, this annotates all tests of N-2 codecs with `@Nightly`. To keep good coverage of releases, the smoke tester is now configured to run nightly tests. --- dev-tools/scripts/smokeTestRelease.py | 6 + .../backward_codecs/lucene70/IndexedDISI.java | 326 ------------------ .../lucene50/TestBlockPostingsFormat.java | 2 + .../lucene50/TestBlockPostingsFormat2.java | 2 + .../lucene50/TestBlockPostingsFormat3.java | 2 + .../backward_codecs/lucene50/TestForUtil.java | 2 + .../lucene50/TestLucene50CompoundFormat.java | 3 +- .../lucene50/TestLucene50LiveDocsFormat.java | 2 + .../TestLucene50StoredFieldsFormat.java | 2 + ...ne50StoredFieldsFormatHighCompression.java | 2 + ...cene50StoredFieldsFormatMergeInstance.java | 3 + .../TestLucene50TermVectorsFormat.java | 2 + .../TestLucene60FieldInfosFormat.java | 2 + .../lucene60/TestLucene60PointsFormat.java | 2 + .../lucene70/TestIndexedDISI.java | 252 -------------- .../TestLucene70SegmentInfoFormat.java | 2 + ...estCompressionLucene80DocValuesFormat.java | 2 + .../TestBestSpeedLucene80DocValuesFormat.java | 2 + .../lucene80/TestDocValuesCompression.java | 2 + .../lucene80/TestIndexedDISI.java | 2 + .../lucene80/TestLucene80NormsFormat.java | 2 + .../TestLucene80NormsFormatMergeInstance.java | 3 + .../lucene84/TestForDeltaUtil.java | 2 + .../backward_codecs/lucene84/TestForUtil.java | 2 + .../lucene84/TestLucene84PostingsFormat.java | 2 + .../lucene84/TestPForUtil.java | 2 + .../lucene86/TestLucene86PointsFormat.java | 2 + .../TestLucene86SegmentInfoFormat.java | 3 +- .../TestLucene87StoredFieldsFormat.java | 2 + ...ne87StoredFieldsFormatHighCompression.java | 2 + ...cene87StoredFieldsFormatMergeInstance.java | 3 + .../packed/TestLegacyDirectMonotonic.java | 2 + .../packed/TestLegacyDirectPacked.java | 2 + .../packed/TestLegacyPackedInts.java | 2 + .../store/EndiannessReverserTestCase.java | 2 + ...tEndiannessReverserCheckSumIndexInput.java | 2 + .../TestEndiannessReverserIndexInput.java | 2 + .../TestBackwardsCompatibility.java | 13 +- .../index/BaseCompoundFormatTestCase.java | 1 + 39 files changed, 86 insertions(+), 585 deletions(-) delete mode 100644 lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene70/IndexedDISI.java delete mode 100644 lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene70/TestIndexedDISI.java diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py index 4e98dd4600b..04bfc136c77 100755 --- a/dev-tools/scripts/smokeTestRelease.py +++ b/dev-tools/scripts/smokeTestRelease.py @@ -1129,6 +1129,12 @@ def smokeTest(java, baseURL, gitRevision, version, tmpDir, isSigned, local_keys, # disable flakey tests for smoke-tester runs: testArgs = '-Dtests.badapples=false %s' % testArgs + # Tests annotated @Nightly are more resource-intensive but often cover + # important code paths. They're disabled by default to preserve a good + # developer experience, but we enable them for smoke tests where we want good + # coverage. + testArgs = '-Dtests.nigthly=true %s' % testArgs + if FORCE_CLEAN: if os.path.exists(tmpDir): raise RuntimeError('temp dir %s exists; please remove first' % tmpDir) diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene70/IndexedDISI.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene70/IndexedDISI.java deleted file mode 100644 index fcefdd609dc..00000000000 --- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene70/IndexedDISI.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.lucene.backward_codecs.lucene70; - -import java.io.DataInput; -import java.io.IOException; -import org.apache.lucene.search.DocIdSetIterator; -import org.apache.lucene.store.IndexInput; -import org.apache.lucene.store.IndexOutput; -import org.apache.lucene.util.BitSetIterator; -import org.apache.lucene.util.FixedBitSet; -import org.apache.lucene.util.RoaringDocIdSet; - -/** - * Disk-based implementation of a {@link DocIdSetIterator} which can return the index of the current - * document, i.e. the ordinal of the current document among the list of documents that this iterator - * can return. This is useful to implement sparse doc values by only having to encode values for - * documents that actually have a value. - * - *

Implementation-wise, this {@link DocIdSetIterator} is inspired of {@link RoaringDocIdSet - * roaring bitmaps} and encodes ranges of {@code 65536} documents independently and picks between 3 - * encodings depending on the density of the range: - * - *

- * - *

Only ranges that contain at least one value are encoded. - * - *

This implementation uses 6 bytes per document in the worst-case, which happens in the case - * that all ranges contain exactly one document. - * - * @lucene.internal - */ -final class IndexedDISI extends DocIdSetIterator { - - static final int MAX_ARRAY_LENGTH = (1 << 12) - 1; - - private static void flush(int block, FixedBitSet buffer, int cardinality, IndexOutput out) - throws IOException { - assert block >= 0 && block < 65536; - out.writeShort((short) block); - assert cardinality > 0 && cardinality <= 65536; - out.writeShort((short) (cardinality - 1)); - if (cardinality > MAX_ARRAY_LENGTH) { - if (cardinality != 65536) { // all docs are set - for (long word : buffer.getBits()) { - out.writeLong(word); - } - } - } else { - BitSetIterator it = new BitSetIterator(buffer, cardinality); - for (int doc = it.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = it.nextDoc()) { - out.writeShort((short) doc); - } - } - } - - static void writeBitSet(DocIdSetIterator it, IndexOutput out) throws IOException { - int i = 0; - final FixedBitSet buffer = new FixedBitSet(1 << 16); - int prevBlock = -1; - for (int doc = it.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = it.nextDoc()) { - final int block = doc >>> 16; - if (prevBlock != -1 && block != prevBlock) { - flush(prevBlock, buffer, i, out); - buffer.clear(0, buffer.length()); - prevBlock = block; - i = 0; - } - buffer.set(doc & 0xFFFF); - i++; - prevBlock = block; - } - if (i > 0) { - flush(prevBlock, buffer, i, out); - buffer.clear(0, buffer.length()); - } - // NO_MORE_DOCS is stored explicitly - buffer.set(DocIdSetIterator.NO_MORE_DOCS & 0xFFFF); - flush(DocIdSetIterator.NO_MORE_DOCS >>> 16, buffer, 1, out); - } - - /** The slice that stores the {@link DocIdSetIterator}. */ - private final IndexInput slice; - - private final long cost; - - IndexedDISI(IndexInput in, long offset, long length, long cost) throws IOException { - this(in.slice("docs", offset, length), cost); - } - - // This constructor allows to pass the slice directly in case it helps reuse - // see eg. Lucene70 norms producer's merge instance - IndexedDISI(IndexInput slice, long cost) throws IOException { - this.slice = slice; - this.cost = cost; - } - - private int block = -1; - private long blockEnd; - private int nextBlockIndex = -1; - Method method; - - private int doc = -1; - private int index = -1; - - // SPARSE variables - boolean exists; - - // DENSE variables - private long word; - private int wordIndex = -1; - // number of one bits encountered so far, including those of `word` - private int numberOfOnes; - - // ALL variables - private int gap; - - @Override - public int docID() { - return doc; - } - - @Override - public int advance(int target) throws IOException { - final int targetBlock = target & 0xFFFF0000; - if (block < targetBlock) { - advanceBlock(targetBlock); - } - if (block == targetBlock) { - if (method.advanceWithinBlock(this, target)) { - return doc; - } - readBlockHeader(); - } - boolean found = method.advanceWithinBlock(this, block); - assert found; - return doc; - } - - public boolean advanceExact(int target) throws IOException { - final int targetBlock = target & 0xFFFF0000; - if (block < targetBlock) { - advanceBlock(targetBlock); - } - boolean found = block == targetBlock && method.advanceExactWithinBlock(this, target); - this.doc = target; - return found; - } - - private void advanceBlock(int targetBlock) throws IOException { - do { - slice.seek(blockEnd); - readBlockHeader(); - } while (block < targetBlock); - } - - private void readBlockHeader() throws IOException { - block = Short.toUnsignedInt(slice.readShort()) << 16; - assert block >= 0; - final int numValues = 1 + Short.toUnsignedInt(slice.readShort()); - index = nextBlockIndex; - nextBlockIndex = index + numValues; - if (numValues <= MAX_ARRAY_LENGTH) { - method = Method.SPARSE; - blockEnd = slice.getFilePointer() + (numValues << 1); - } else if (numValues == 65536) { - method = Method.ALL; - blockEnd = slice.getFilePointer(); - gap = block - index - 1; - } else { - method = Method.DENSE; - blockEnd = slice.getFilePointer() + (1 << 13); - wordIndex = -1; - numberOfOnes = index + 1; - } - } - - @Override - public int nextDoc() throws IOException { - return advance(doc + 1); - } - - public int index() { - return index; - } - - @Override - public long cost() { - return cost; - } - - enum Method { - SPARSE { - @Override - boolean advanceWithinBlock(IndexedDISI disi, int target) throws IOException { - final int targetInBlock = target & 0xFFFF; - // TODO: binary search - for (; disi.index < disi.nextBlockIndex; ) { - int doc = Short.toUnsignedInt(disi.slice.readShort()); - disi.index++; - if (doc >= targetInBlock) { - disi.doc = disi.block | doc; - disi.exists = true; - return true; - } - } - return false; - } - - @Override - boolean advanceExactWithinBlock(IndexedDISI disi, int target) throws IOException { - final int targetInBlock = target & 0xFFFF; - // TODO: binary search - if (target == disi.doc) { - return disi.exists; - } - for (; disi.index < disi.nextBlockIndex; ) { - int doc = Short.toUnsignedInt(disi.slice.readShort()); - disi.index++; - if (doc >= targetInBlock) { - if (doc != targetInBlock) { - disi.index--; - disi.slice.seek(disi.slice.getFilePointer() - Short.BYTES); - break; - } - disi.exists = true; - return true; - } - } - disi.exists = false; - return false; - } - }, - DENSE { - @Override - boolean advanceWithinBlock(IndexedDISI disi, int target) throws IOException { - final int targetInBlock = target & 0xFFFF; - final int targetWordIndex = targetInBlock >>> 6; - for (int i = disi.wordIndex + 1; i <= targetWordIndex; ++i) { - disi.word = disi.slice.readLong(); - disi.numberOfOnes += Long.bitCount(disi.word); - } - disi.wordIndex = targetWordIndex; - - long leftBits = disi.word >>> target; - if (leftBits != 0L) { - disi.doc = target + Long.numberOfTrailingZeros(leftBits); - disi.index = disi.numberOfOnes - Long.bitCount(leftBits); - return true; - } - - while (++disi.wordIndex < 1024) { - disi.word = disi.slice.readLong(); - if (disi.word != 0) { - disi.index = disi.numberOfOnes; - disi.numberOfOnes += Long.bitCount(disi.word); - disi.doc = disi.block | (disi.wordIndex << 6) | Long.numberOfTrailingZeros(disi.word); - return true; - } - } - return false; - } - - @Override - boolean advanceExactWithinBlock(IndexedDISI disi, int target) throws IOException { - final int targetInBlock = target & 0xFFFF; - final int targetWordIndex = targetInBlock >>> 6; - for (int i = disi.wordIndex + 1; i <= targetWordIndex; ++i) { - disi.word = disi.slice.readLong(); - disi.numberOfOnes += Long.bitCount(disi.word); - } - disi.wordIndex = targetWordIndex; - - long leftBits = disi.word >>> target; - disi.index = disi.numberOfOnes - Long.bitCount(leftBits); - return (leftBits & 1L) != 0; - } - }, - ALL { - @Override - boolean advanceWithinBlock(IndexedDISI disi, int target) throws IOException { - disi.doc = target; - disi.index = target - disi.gap; - return true; - } - - @Override - boolean advanceExactWithinBlock(IndexedDISI disi, int target) throws IOException { - disi.index = target - disi.gap; - return true; - } - }; - - /** - * Advance to the first doc from the block that is equal to or greater than {@code target}. - * Return true if there is such a doc and false otherwise. - */ - abstract boolean advanceWithinBlock(IndexedDISI disi, int target) throws IOException; - - /** - * Advance the iterator exactly to the position corresponding to the given {@code target} and - * return whether this document exists. - */ - abstract boolean advanceExactWithinBlock(IndexedDISI disi, int target) throws IOException; - } -} diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestBlockPostingsFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestBlockPostingsFormat.java index dfc48061ea4..3bc364b320a 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestBlockPostingsFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestBlockPostingsFormat.java @@ -39,9 +39,11 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.store.IOContext; import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.TestUtil; /** Tests BlockPostingsFormat */ +@Nightly // N-2 formats are only tested on nightly runs public class TestBlockPostingsFormat extends BasePostingsFormatTestCase { private final Codec codec = TestUtil.alwaysPostingsFormat(new Lucene50RWPostingsFormat()); diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestBlockPostingsFormat2.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestBlockPostingsFormat2.java index f84de51e005..cc3dc608e53 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestBlockPostingsFormat2.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestBlockPostingsFormat2.java @@ -29,9 +29,11 @@ import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.store.Directory; import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.TestUtil; /** Tests special cases of BlockPostingsFormat */ +@Nightly // N-2 formats are only tested on nightly runs public class TestBlockPostingsFormat2 extends LuceneTestCase { Directory dir; RandomIndexWriter iw; diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestBlockPostingsFormat3.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestBlockPostingsFormat3.java index 71b3c82a397..2cfbec6fcff 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestBlockPostingsFormat3.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestBlockPostingsFormat3.java @@ -47,12 +47,14 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.English; import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.automaton.AutomatonTestUtil; import org.apache.lucene.util.automaton.CompiledAutomaton; import org.apache.lucene.util.automaton.RegExp; /** Tests partial enumeration (only pulling a subset of the indexed data) */ +@Nightly // N-2 formats are only tested on nightly runs public class TestBlockPostingsFormat3 extends LuceneTestCase { private final int MAXDOC = TEST_NIGHTLY ? Lucene50PostingsFormat.BLOCK_SIZE * 20 : Lucene50PostingsFormat.BLOCK_SIZE * 3; diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestForUtil.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestForUtil.java index 4293586dd36..4513778bc6d 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestForUtil.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestForUtil.java @@ -30,8 +30,10 @@ import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; import org.apache.lucene.util.ArrayUtil; import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.packed.PackedInts; +@Nightly // N-2 formats are only tested on nightly runs public class TestForUtil extends LuceneTestCase { public void testEncodeDecode() throws IOException { diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50CompoundFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50CompoundFormat.java index de9f72cfec2..7fd2128072a 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50CompoundFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50CompoundFormat.java @@ -19,9 +19,10 @@ package org.apache.lucene.backward_codecs.lucene50; import org.apache.lucene.backward_codecs.lucene87.Lucene87RWCodec; import org.apache.lucene.codecs.Codec; import org.apache.lucene.index.BaseCompoundFormatTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene50CompoundFormat extends BaseCompoundFormatTestCase { - ; @Override protected Codec getCodec() { diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50LiveDocsFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50LiveDocsFormat.java index 5cd1bc038a1..f8ee50a5bf4 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50LiveDocsFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50LiveDocsFormat.java @@ -19,7 +19,9 @@ package org.apache.lucene.backward_codecs.lucene50; import org.apache.lucene.backward_codecs.lucene86.Lucene86RWCodec; import org.apache.lucene.codecs.Codec; import org.apache.lucene.index.BaseLiveDocsFormatTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene50LiveDocsFormat extends BaseLiveDocsFormatTestCase { @Override diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50StoredFieldsFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50StoredFieldsFormat.java index c6286b17265..935929c8978 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50StoredFieldsFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50StoredFieldsFormat.java @@ -19,7 +19,9 @@ package org.apache.lucene.backward_codecs.lucene50; import org.apache.lucene.backward_codecs.lucene86.Lucene86RWCodec; import org.apache.lucene.codecs.Codec; import org.apache.lucene.index.BaseStoredFieldsFormatTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene50StoredFieldsFormat extends BaseStoredFieldsFormatTestCase { @Override protected Codec getCodec() { diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50StoredFieldsFormatHighCompression.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50StoredFieldsFormatHighCompression.java index cd51b0f1303..89a34e1e644 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50StoredFieldsFormatHighCompression.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50StoredFieldsFormatHighCompression.java @@ -27,7 +27,9 @@ import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.store.Directory; +import org.apache.lucene.util.LuceneTestCase.Nightly; +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene50StoredFieldsFormatHighCompression extends BaseStoredFieldsFormatTestCase { @Override protected Codec getCodec() { diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50StoredFieldsFormatMergeInstance.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50StoredFieldsFormatMergeInstance.java index 461e1e48962..3ddd3c69ee5 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50StoredFieldsFormatMergeInstance.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50StoredFieldsFormatMergeInstance.java @@ -16,7 +16,10 @@ */ package org.apache.lucene.backward_codecs.lucene50; +import org.apache.lucene.util.LuceneTestCase.Nightly; + /** Test the merge instance of the Lucene50 stored fields format. */ +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene50StoredFieldsFormatMergeInstance extends TestLucene50StoredFieldsFormat { @Override diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50TermVectorsFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50TermVectorsFormat.java index 4c0f868f2f0..39a8b1a9f20 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50TermVectorsFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50TermVectorsFormat.java @@ -19,7 +19,9 @@ package org.apache.lucene.backward_codecs.lucene50; import org.apache.lucene.backward_codecs.lucene87.Lucene87RWCodec; import org.apache.lucene.codecs.Codec; import org.apache.lucene.index.BaseTermVectorsFormatTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene50TermVectorsFormat extends BaseTermVectorsFormatTestCase { @Override diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/TestLucene60FieldInfosFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/TestLucene60FieldInfosFormat.java index 0db5b326175..0099e5dd67d 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/TestLucene60FieldInfosFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/TestLucene60FieldInfosFormat.java @@ -19,7 +19,9 @@ package org.apache.lucene.backward_codecs.lucene60; import org.apache.lucene.backward_codecs.lucene84.Lucene84RWCodec; import org.apache.lucene.codecs.Codec; import org.apache.lucene.index.BaseFieldInfoFormatTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene60FieldInfosFormat extends BaseFieldInfoFormatTestCase { @Override protected Codec getCodec() { diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/TestLucene60PointsFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/TestLucene60PointsFormat.java index d3d28262506..793ddcdd06d 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/TestLucene60PointsFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/TestLucene60PointsFormat.java @@ -33,10 +33,12 @@ import org.apache.lucene.index.PointValues; import org.apache.lucene.index.PointValues.IntersectVisitor; import org.apache.lucene.index.PointValues.Relation; import org.apache.lucene.store.Directory; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.bkd.BKDConfig; /** Tests Lucene60PointsFormat */ +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene60PointsFormat extends BasePointsFormatTestCase { private final Codec codec; private final int maxPointsInLeafNode; diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene70/TestIndexedDISI.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene70/TestIndexedDISI.java deleted file mode 100644 index cd7d5b1e0fa..00000000000 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene70/TestIndexedDISI.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.lucene.backward_codecs.lucene70; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import org.apache.lucene.backward_codecs.store.EndiannessReverserUtil; -import org.apache.lucene.search.DocIdSetIterator; -import org.apache.lucene.store.Directory; -import org.apache.lucene.store.IOContext; -import org.apache.lucene.store.IndexInput; -import org.apache.lucene.store.IndexOutput; -import org.apache.lucene.util.BitSetIterator; -import org.apache.lucene.util.FixedBitSet; -import org.apache.lucene.util.LuceneTestCase; -import org.apache.lucene.util.TestUtil; - -public class TestIndexedDISI extends LuceneTestCase { - - public void testEmpty() throws IOException { - int maxDoc = TestUtil.nextInt(random(), 1, 100000); - FixedBitSet set = new FixedBitSet(maxDoc); - try (Directory dir = newDirectory()) { - doTest(set, dir); - } - } - - public void testOneDoc() throws IOException { - int maxDoc = TestUtil.nextInt(random(), 1, 100000); - FixedBitSet set = new FixedBitSet(maxDoc); - set.set(random().nextInt(maxDoc)); - try (Directory dir = newDirectory()) { - doTest(set, dir); - } - } - - public void testTwoDocs() throws IOException { - int maxDoc = TestUtil.nextInt(random(), 1, 100000); - FixedBitSet set = new FixedBitSet(maxDoc); - set.set(random().nextInt(maxDoc)); - set.set(random().nextInt(maxDoc)); - try (Directory dir = newDirectory()) { - doTest(set, dir); - } - } - - public void testAllDocs() throws IOException { - int maxDoc = TestUtil.nextInt(random(), 1, 100000); - FixedBitSet set = new FixedBitSet(maxDoc); - set.set(1, maxDoc); - try (Directory dir = newDirectory()) { - doTest(set, dir); - } - } - - public void testHalfFull() throws IOException { - int maxDoc = TestUtil.nextInt(random(), 1, 100000); - FixedBitSet set = new FixedBitSet(maxDoc); - for (int i = random().nextInt(2); i < maxDoc; i += TestUtil.nextInt(random(), 1, 3)) { - set.set(i); - } - try (Directory dir = newDirectory()) { - doTest(set, dir); - } - } - - public void testDocRange() throws IOException { - try (Directory dir = newDirectory()) { - for (int iter = 0; iter < 10; ++iter) { - int maxDoc = TestUtil.nextInt(random(), 1, 1000000); - FixedBitSet set = new FixedBitSet(maxDoc); - final int start = random().nextInt(maxDoc); - final int end = TestUtil.nextInt(random(), start + 1, maxDoc); - set.set(start, end); - doTest(set, dir); - } - } - } - - public void testSparseDenseBoundary() throws IOException { - try (Directory dir = newDirectory()) { - FixedBitSet set = new FixedBitSet(200000); - int start = 65536 + random().nextInt(100); - - // we set MAX_ARRAY_LENGTH bits so the encoding will be sparse - set.set(start, start + IndexedDISI.MAX_ARRAY_LENGTH); - long length; - try (IndexOutput out = - EndiannessReverserUtil.createOutput(dir, "sparse", IOContext.DEFAULT)) { - IndexedDISI.writeBitSet(new BitSetIterator(set, IndexedDISI.MAX_ARRAY_LENGTH), out); - length = out.getFilePointer(); - } - try (IndexInput in = EndiannessReverserUtil.openInput(dir, "sparse", IOContext.DEFAULT)) { - IndexedDISI disi = new IndexedDISI(in, 0L, length, IndexedDISI.MAX_ARRAY_LENGTH); - assertEquals(start, disi.nextDoc()); - assertEquals(IndexedDISI.Method.SPARSE, disi.method); - } - doTest(set, dir); - - // now we set one more bit so the encoding will be dense - set.set(start + IndexedDISI.MAX_ARRAY_LENGTH + random().nextInt(100)); - try (IndexOutput out = EndiannessReverserUtil.createOutput(dir, "bar", IOContext.DEFAULT)) { - IndexedDISI.writeBitSet(new BitSetIterator(set, IndexedDISI.MAX_ARRAY_LENGTH + 1), out); - length = out.getFilePointer(); - } - try (IndexInput in = EndiannessReverserUtil.openInput(dir, "bar", IOContext.DEFAULT)) { - IndexedDISI disi = new IndexedDISI(in, 0L, length, IndexedDISI.MAX_ARRAY_LENGTH + 1); - assertEquals(start, disi.nextDoc()); - assertEquals(IndexedDISI.Method.DENSE, disi.method); - } - doTest(set, dir); - } - } - - public void testOneDocMissing() throws IOException { - int maxDoc = TestUtil.nextInt(random(), 1, 1000000); - FixedBitSet set = new FixedBitSet(maxDoc); - set.set(0, maxDoc); - set.clear(random().nextInt(maxDoc)); - try (Directory dir = newDirectory()) { - doTest(set, dir); - } - } - - public void testFewMissingDocs() throws IOException { - try (Directory dir = newDirectory()) { - int numIters = atLeast(10); - for (int iter = 0; iter < numIters; ++iter) { - int maxDoc = TestUtil.nextInt(random(), 1, 100000); - FixedBitSet set = new FixedBitSet(maxDoc); - set.set(0, maxDoc); - final int numMissingDocs = TestUtil.nextInt(random(), 2, 1000); - for (int i = 0; i < numMissingDocs; ++i) { - set.clear(random().nextInt(maxDoc)); - } - doTest(set, dir); - } - } - } - - public void testRandom() throws IOException { - try (Directory dir = newDirectory()) { - int numIters = atLeast(3); - for (int i = 0; i < numIters; ++i) { - doTestRandom(dir); - } - } - } - - private void doTestRandom(Directory dir) throws IOException { - List docs = new ArrayList<>(); - final int maxStep = TestUtil.nextInt(random(), 1, 1 << TestUtil.nextInt(random(), 2, 20)); - final int numDocs = - TestUtil.nextInt(random(), 1, Math.min(100000, Integer.MAX_VALUE / maxStep)); - for (int doc = -1, i = 0; i < numDocs; ++i) { - doc += TestUtil.nextInt(random(), 1, maxStep); - docs.add(doc); - } - final int maxDoc = docs.get(docs.size() - 1) + TestUtil.nextInt(random(), 1, 100); - - FixedBitSet set = new FixedBitSet(maxDoc); - for (int doc : docs) { - set.set(doc); - } - - doTest(set, dir); - } - - private void doTest(FixedBitSet set, Directory dir) throws IOException { - final int cardinality = set.cardinality(); - long length; - try (IndexOutput out = EndiannessReverserUtil.createOutput(dir, "foo", IOContext.DEFAULT)) { - IndexedDISI.writeBitSet(new BitSetIterator(set, cardinality), out); - length = out.getFilePointer(); - } - - try (IndexInput in = EndiannessReverserUtil.openInput(dir, "foo", IOContext.DEFAULT)) { - IndexedDISI disi = new IndexedDISI(in, 0L, length, cardinality); - BitSetIterator disi2 = new BitSetIterator(set, cardinality); - int i = 0; - for (int doc = disi2.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = disi2.nextDoc()) { - assertEquals(doc, disi.nextDoc()); - assertEquals(i++, disi.index()); - } - assertEquals(DocIdSetIterator.NO_MORE_DOCS, disi.nextDoc()); - } - - for (int step : new int[] {1, 10, 100, 1000, 10000, 100000}) { - try (IndexInput in = EndiannessReverserUtil.openInput(dir, "foo", IOContext.DEFAULT)) { - IndexedDISI disi = new IndexedDISI(in, 0L, length, cardinality); - BitSetIterator disi2 = new BitSetIterator(set, cardinality); - int index = -1; - while (true) { - int target = disi2.docID() + step; - int doc; - do { - doc = disi2.nextDoc(); - index++; - } while (doc < target); - assertEquals(doc, disi.advance(target)); - if (doc == DocIdSetIterator.NO_MORE_DOCS) { - break; - } - assertEquals(index, disi.index()); - } - } - } - - for (int step : new int[] {10, 100, 1000, 10000, 100000}) { - try (IndexInput in = EndiannessReverserUtil.openInput(dir, "foo", IOContext.DEFAULT)) { - IndexedDISI disi = new IndexedDISI(in, 0L, length, cardinality); - BitSetIterator disi2 = new BitSetIterator(set, cardinality); - int index = -1; - for (int target = 0; target < set.length(); ) { - target += TestUtil.nextInt(random(), 0, step); - int doc = disi2.docID(); - while (doc < target) { - doc = disi2.nextDoc(); - index++; - } - - boolean exists = disi.advanceExact(target); - assertEquals(doc == target, exists); - if (exists) { - assertEquals(index, disi.index()); - } else if (random().nextBoolean()) { - assertEquals(doc, disi.nextDoc()); - assertEquals(index, disi.index()); - target = doc; - } - } - } - } - - dir.deleteFile("foo"); - } -} diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene70/TestLucene70SegmentInfoFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene70/TestLucene70SegmentInfoFormat.java index 9a50ab7714f..ed68ef982d7 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene70/TestLucene70SegmentInfoFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene70/TestLucene70SegmentInfoFormat.java @@ -20,8 +20,10 @@ package org.apache.lucene.backward_codecs.lucene70; import org.apache.lucene.backward_codecs.lucene84.Lucene84RWCodec; import org.apache.lucene.codecs.Codec; import org.apache.lucene.index.BaseSegmentInfoFormatTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.Version; +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene70SegmentInfoFormat extends BaseSegmentInfoFormatTestCase { @Override diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestBestCompressionLucene80DocValuesFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestBestCompressionLucene80DocValuesFormat.java index 78bb84850dd..59dc7f97740 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestBestCompressionLucene80DocValuesFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestBestCompressionLucene80DocValuesFormat.java @@ -17,9 +17,11 @@ package org.apache.lucene.backward_codecs.lucene80; import org.apache.lucene.codecs.Codec; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.TestUtil; /** Tests Lucene80DocValuesFormat */ +@Nightly // N-2 formats are only tested on nightly runs public class TestBestCompressionLucene80DocValuesFormat extends BaseLucene80DocValuesFormatTestCase { private final Codec codec = diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestBestSpeedLucene80DocValuesFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestBestSpeedLucene80DocValuesFormat.java index 283c42f1c1a..47723f5fecd 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestBestSpeedLucene80DocValuesFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestBestSpeedLucene80DocValuesFormat.java @@ -17,9 +17,11 @@ package org.apache.lucene.backward_codecs.lucene80; import org.apache.lucene.codecs.Codec; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.TestUtil; /** Tests Lucene80DocValuesFormat */ +@Nightly // N-2 formats are only tested on nightly runs public class TestBestSpeedLucene80DocValuesFormat extends BaseLucene80DocValuesFormatTestCase { private final Codec codec = TestUtil.alwaysDocValuesFormat( diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestDocValuesCompression.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestDocValuesCompression.java index 1d601640777..8dcfbc2b5dc 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestDocValuesCompression.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestDocValuesCompression.java @@ -39,8 +39,10 @@ import org.apache.lucene.index.SortedSetDocValues; import org.apache.lucene.store.Directory; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.TestUtil; +@Nightly // N-2 formats are only tested on nightly runs public class TestDocValuesCompression extends LuceneTestCase { private final Codec bestSpeed = TestUtil.alwaysDocValuesFormat( diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestIndexedDISI.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestIndexedDISI.java index d5f0bc03e06..7f42398f352 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestIndexedDISI.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestIndexedDISI.java @@ -29,9 +29,11 @@ import org.apache.lucene.util.BitSet; import org.apache.lucene.util.BitSetIterator; import org.apache.lucene.util.FixedBitSet; import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.SparseFixedBitSet; import org.apache.lucene.util.TestUtil; +@Nightly // N-2 formats are only tested on nightly runs public class TestIndexedDISI extends LuceneTestCase { public void testEmpty() throws IOException { diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestLucene80NormsFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestLucene80NormsFormat.java index f46037f087c..bb51f100080 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestLucene80NormsFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestLucene80NormsFormat.java @@ -19,8 +19,10 @@ package org.apache.lucene.backward_codecs.lucene80; import org.apache.lucene.backward_codecs.lucene87.Lucene87RWCodec; import org.apache.lucene.codecs.Codec; import org.apache.lucene.index.BaseNormsFormatTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; /** Tests Lucene80NormsFormat */ +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene80NormsFormat extends BaseNormsFormatTestCase { private final Codec codec = new Lucene87RWCodec(); diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestLucene80NormsFormatMergeInstance.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestLucene80NormsFormatMergeInstance.java index eaa173804cb..f93d7e1f57f 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestLucene80NormsFormatMergeInstance.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/TestLucene80NormsFormatMergeInstance.java @@ -16,7 +16,10 @@ */ package org.apache.lucene.backward_codecs.lucene80; +import org.apache.lucene.util.LuceneTestCase.Nightly; + /** Test the merge instance of the Lucene80 norms format. */ +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene80NormsFormatMergeInstance extends TestLucene80NormsFormat { @Override diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestForDeltaUtil.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestForDeltaUtil.java index 2a36971e9af..b36ca0f45a6 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestForDeltaUtil.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestForDeltaUtil.java @@ -26,9 +26,11 @@ import org.apache.lucene.store.IOContext; import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.packed.PackedInts; +@Nightly // N-2 formats are only tested on nightly runs public class TestForDeltaUtil extends LuceneTestCase { public void testEncodeDecode() throws IOException { diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestForUtil.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestForUtil.java index 9ec7d00a13d..04145cff1b6 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestForUtil.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestForUtil.java @@ -27,9 +27,11 @@ import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; import org.apache.lucene.util.ArrayUtil; import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.packed.PackedInts; +@Nightly // N-2 formats are only tested on nightly runs public class TestForUtil extends LuceneTestCase { public void testEncodeDecode() throws IOException { diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestLucene84PostingsFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestLucene84PostingsFormat.java index 821ad32be20..0521203755b 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestLucene84PostingsFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestLucene84PostingsFormat.java @@ -39,8 +39,10 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.store.IOContext; import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.TestUtil; +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene84PostingsFormat extends BasePostingsFormatTestCase { private final Codec codec = TestUtil.alwaysPostingsFormat(new Lucene84RWPostingsFormat()); diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestPForUtil.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestPForUtil.java index 1bfad8b760d..02b88091302 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestPForUtil.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/TestPForUtil.java @@ -27,9 +27,11 @@ import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; import org.apache.lucene.util.ArrayUtil; import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.packed.PackedInts; +@Nightly // N-2 formats are only tested on nightly runs public class TestPForUtil extends LuceneTestCase { public void testEncodeDecode() throws IOException { diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene86/TestLucene86PointsFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene86/TestLucene86PointsFormat.java index 20a0de3a32f..9d7678df4b1 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene86/TestLucene86PointsFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene86/TestLucene86PointsFormat.java @@ -39,9 +39,11 @@ import org.apache.lucene.index.PointValues.Relation; import org.apache.lucene.index.SegmentReadState; import org.apache.lucene.index.SegmentWriteState; import org.apache.lucene.store.Directory; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.bkd.BKDConfig; +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene86PointsFormat extends BasePointsFormatTestCase { private final Codec codec; diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene86/TestLucene86SegmentInfoFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene86/TestLucene86SegmentInfoFormat.java index e013fdfc1cb..bc2b5c6db8f 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene86/TestLucene86SegmentInfoFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene86/TestLucene86SegmentInfoFormat.java @@ -20,9 +20,10 @@ package org.apache.lucene.backward_codecs.lucene86; import org.apache.lucene.backward_codecs.lucene87.Lucene87RWCodec; import org.apache.lucene.codecs.Codec; import org.apache.lucene.index.BaseSegmentInfoFormatTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.Version; -@SuppressWarnings("deprecation") +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene86SegmentInfoFormat extends BaseSegmentInfoFormatTestCase { @Override diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/TestLucene87StoredFieldsFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/TestLucene87StoredFieldsFormat.java index 469d1547339..4a11b40bb73 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/TestLucene87StoredFieldsFormat.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/TestLucene87StoredFieldsFormat.java @@ -18,7 +18,9 @@ package org.apache.lucene.backward_codecs.lucene87; import org.apache.lucene.codecs.Codec; import org.apache.lucene.index.BaseStoredFieldsFormatTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene87StoredFieldsFormat extends BaseStoredFieldsFormatTestCase { @Override protected Codec getCodec() { diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/TestLucene87StoredFieldsFormatHighCompression.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/TestLucene87StoredFieldsFormatHighCompression.java index 68023138245..d197e0c2cd9 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/TestLucene87StoredFieldsFormatHighCompression.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/TestLucene87StoredFieldsFormatHighCompression.java @@ -25,7 +25,9 @@ import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.store.Directory; +import org.apache.lucene.util.LuceneTestCase.Nightly; +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene87StoredFieldsFormatHighCompression extends BaseStoredFieldsFormatTestCase { @Override protected Codec getCodec() { diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/TestLucene87StoredFieldsFormatMergeInstance.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/TestLucene87StoredFieldsFormatMergeInstance.java index 282f2278bfd..c9dab93dd90 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/TestLucene87StoredFieldsFormatMergeInstance.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/TestLucene87StoredFieldsFormatMergeInstance.java @@ -16,7 +16,10 @@ */ package org.apache.lucene.backward_codecs.lucene87; +import org.apache.lucene.util.LuceneTestCase.Nightly; + /** Test the merge instance of the Lucene87 stored fields format. */ +@Nightly // N-2 formats are only tested on nightly runs public class TestLucene87StoredFieldsFormatMergeInstance extends TestLucene87StoredFieldsFormat { @Override diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/packed/TestLegacyDirectMonotonic.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/packed/TestLegacyDirectMonotonic.java index 1f55d255169..cfc6aa2a0c8 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/packed/TestLegacyDirectMonotonic.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/packed/TestLegacyDirectMonotonic.java @@ -29,8 +29,10 @@ import org.apache.lucene.store.IndexOutput; import org.apache.lucene.util.ArrayUtil; import org.apache.lucene.util.LongValues; import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.TestUtil; +@Nightly // N-2 formats are only tested on nightly runs public class TestLegacyDirectMonotonic extends LuceneTestCase { public void testValidation() { diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/packed/TestLegacyDirectPacked.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/packed/TestLegacyDirectPacked.java index dca7293a620..a8ee6fe1c8f 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/packed/TestLegacyDirectPacked.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/packed/TestLegacyDirectPacked.java @@ -25,8 +25,10 @@ import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; import org.apache.lucene.util.LongValues; import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.TestUtil; +@Nightly // N-2 formats are only tested on nightly runs public class TestLegacyDirectPacked extends LuceneTestCase { /** simple encode/decode */ diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/packed/TestLegacyPackedInts.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/packed/TestLegacyPackedInts.java index ed406e4dcd6..1dc0be458b2 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/packed/TestLegacyPackedInts.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/packed/TestLegacyPackedInts.java @@ -23,11 +23,13 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; import org.apache.lucene.util.RamUsageTester; import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.packed.PackedInts; import org.apache.lucene.util.packed.PackedInts.Reader; +@Nightly // N-2 formats are only tested on nightly runs public class TestLegacyPackedInts extends LuceneTestCase { public void testPackedInts() throws IOException { diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/store/EndiannessReverserTestCase.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/store/EndiannessReverserTestCase.java index 93c2063d4d1..a0d1b3c06db 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/store/EndiannessReverserTestCase.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/store/EndiannessReverserTestCase.java @@ -23,7 +23,9 @@ import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; import org.apache.lucene.store.RandomAccessInput; import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.LuceneTestCase.Nightly; +@Nightly // N-2 formats are only tested on nightly runs public abstract class EndiannessReverserTestCase extends LuceneTestCase { protected abstract IndexInput getEndiannessReverserInput( diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/store/TestEndiannessReverserCheckSumIndexInput.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/store/TestEndiannessReverserCheckSumIndexInput.java index 345fd0aa7a2..8e3f6486eda 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/store/TestEndiannessReverserCheckSumIndexInput.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/store/TestEndiannessReverserCheckSumIndexInput.java @@ -21,7 +21,9 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.store.IOContext; import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; +import org.apache.lucene.util.LuceneTestCase.Nightly; +@Nightly // N-2 formats are only tested on nightly runs public class TestEndiannessReverserCheckSumIndexInput extends EndiannessReverserTestCase { @Override diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/store/TestEndiannessReverserIndexInput.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/store/TestEndiannessReverserIndexInput.java index 8de2ef9db6e..6e7f0c0884f 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/store/TestEndiannessReverserIndexInput.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/store/TestEndiannessReverserIndexInput.java @@ -21,7 +21,9 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.store.IOContext; import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; +import org.apache.lucene.util.LuceneTestCase.Nightly; +@Nightly // N-2 formats are only tested on nightly runs public class TestEndiannessReverserIndexInput extends EndiannessReverserTestCase { @Override diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java index ff6b55cea4b..fcb79ad9b7b 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java @@ -1015,11 +1015,13 @@ public class TestBackwardsCompatibility extends LuceneTestCase { searchIndex(oldIndexDirs.get(name), name, Version.MIN_SUPPORTED_MAJOR); } - for (String name : binarySupportedNames) { - Path oldIndexDir = createTempDir(name); - TestUtil.unzip(getDataInputStream("unsupported." + name + ".zip"), oldIndexDir); - try (BaseDirectoryWrapper dir = newFSDirectory(oldIndexDir)) { - searchIndex(dir, name, MIN_BINARY_SUPPORTED_MAJOR); + if (TEST_NIGHTLY) { + for (String name : binarySupportedNames) { + Path oldIndexDir = createTempDir(name); + TestUtil.unzip(getDataInputStream("unsupported." + name + ".zip"), oldIndexDir); + try (BaseDirectoryWrapper dir = newFSDirectory(oldIndexDir)) { + searchIndex(dir, name, MIN_BINARY_SUPPORTED_MAJOR); + } } } } @@ -2080,6 +2082,7 @@ public class TestBackwardsCompatibility extends LuceneTestCase { } } + @Nightly public void testReadNMinusTwoCommit() throws IOException { for (String name : binarySupportedNames) { Path oldIndexDir = createTempDir(name); diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompoundFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompoundFormatTestCase.java index cb207554b43..46fab1cbe95 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompoundFormatTestCase.java +++ b/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompoundFormatTestCase.java @@ -165,6 +165,7 @@ public abstract class BaseCompoundFormatTestCase extends BaseIndexFileFormatTest } // LUCENE-5724: actually test we play nice with NRTCachingDir and massive file + @Slow public void testLargeCFS() throws IOException { final String testfile = "_123.test"; IOContext context = new IOContext(new FlushInfo(0, 512 * 1024 * 1024));