summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-08-18 03:02:49 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-08-18 03:02:49 +0200
commit7a4461355f7ee8e5ec71888516cbfd640dd7e110 (patch)
tree5f800152d48de71247177c4fca93fff24dc993ac /searchlib/src/tests
parent15e7bcd9e902407fbe14cf830968f06c9fb5fb89 (diff)
Include only what you need.
Diffstat (limited to 'searchlib/src/tests')
-rw-r--r--searchlib/src/tests/common/foregroundtaskexecutor/foregroundtaskexecutor_test.cpp14
-rw-r--r--searchlib/src/tests/common/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp14
-rw-r--r--searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp36
-rw-r--r--searchlib/src/tests/postinglistbm/postinglistbm.cpp2
-rw-r--r--searchlib/src/tests/sort/uca.cpp9
-rw-r--r--searchlib/src/tests/util/ioerrorhandler/ioerrorhandler_test.cpp1
-rw-r--r--searchlib/src/tests/util/sigbushandler/sigbushandler_test.cpp11
-rw-r--r--searchlib/src/tests/util/statefile/statefile_test.cpp14
8 files changed, 47 insertions, 54 deletions
diff --git a/searchlib/src/tests/common/foregroundtaskexecutor/foregroundtaskexecutor_test.cpp b/searchlib/src/tests/common/foregroundtaskexecutor/foregroundtaskexecutor_test.cpp
index a7b0e90ea1f..0cbd4bd9473 100644
--- a/searchlib/src/tests/common/foregroundtaskexecutor/foregroundtaskexecutor_test.cpp
+++ b/searchlib/src/tests/common/foregroundtaskexecutor/foregroundtaskexecutor_test.cpp
@@ -1,17 +1,16 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP("foregroundtaskexecutor_test");
+
#include <vespa/searchlib/common/foregroundtaskexecutor.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <mutex>
#include <condition_variable>
+#include <unistd.h>
-namespace search
-{
+#include <vespa/log/log.h>
+LOG_SETUP("foregroundtaskexecutor_test");
-namespace common
-{
+namespace search::common {
class Fixture
@@ -117,7 +116,6 @@ TEST_F("require that task with different ids are serialized", Fixture)
}
-} // namespace common
-} // namespace search
+}
TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchlib/src/tests/common/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp b/searchlib/src/tests/common/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp
index 569bff0f6f3..7d158918715 100644
--- a/searchlib/src/tests/common/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp
+++ b/searchlib/src/tests/common/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp
@@ -1,18 +1,17 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP("sequencedtaskexecutor_test");
+
#include <vespa/searchlib/common/sequencedtaskexecutor.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/test/insertion_operators.h>
#include <mutex>
#include <condition_variable>
+#include <unistd.h>
-namespace search
-{
+#include <vespa/log/log.h>
+LOG_SETUP("sequencedtaskexecutor_test");
-namespace common
-{
+namespace search::common {
class Fixture
@@ -236,7 +235,6 @@ TEST_F("require that executeLambda works", Fixture)
}
-} // namespace common
-} // namespace search
+}
TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp b/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp
index 820386f41ce..c926d1c2831 100644
--- a/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp
+++ b/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp
@@ -1010,8 +1010,8 @@ TEST_F("requireThatInversionIsWorking", DictionaryFixture<Fixture>)
LOG(info,
"Before feature compaction: allocElems=%" PRIu64 ", usedElems=%" PRIu64
", deadElems=%" PRIu64 ", holdElems=%" PRIu64
- ", freeBuffers=%" PRIu32 ", activeBuffers=%" PRIu32
- ", holdBuffers=%" PRIu32,
+ ", freeBuffers=%u, activeBuffers=%u"
+ ", holdBuffers=%u",
beforeStats._allocElems,
beforeStats._usedElems,
beforeStats._deadElems,
@@ -1030,8 +1030,8 @@ TEST_F("requireThatInversionIsWorking", DictionaryFixture<Fixture>)
LOG(info,
"During feature compaction: allocElems=%" PRIu64 ", usedElems=%" PRIu64
", deadElems=%" PRIu64 ", holdElems=%" PRIu64
- ", freeBuffers=%" PRIu32 ", activeBuffers=%" PRIu32
- ", holdBuffers=%" PRIu32,
+ ", freeBuffers=%u, activeBuffers=%u"
+ ", holdBuffers=%u",
duringStats._allocElems,
duringStats._usedElems,
duringStats._deadElems,
@@ -1045,8 +1045,8 @@ TEST_F("requireThatInversionIsWorking", DictionaryFixture<Fixture>)
LOG(info,
"After feature compaction: allocElems=%" PRIu64 ", usedElems=%" PRIu64
", deadElems=%" PRIu64 ", holdElems=%" PRIu64
- ", freeBuffers=%" PRIu32 ", activeBuffers=%" PRIu32
- ", holdBuffers=%" PRIu32,
+ ", freeBuffers=%u, activeBuffers=%u"
+ ", holdBuffers=%u",
afterStats._allocElems,
afterStats._usedElems,
afterStats._deadElems,
@@ -1059,14 +1059,12 @@ TEST_F("requireThatInversionIsWorking", DictionaryFixture<Fixture>)
TermFieldMatchDataArray matchData;
matchData.add(&tfmd);
{
- PostingIterator itr(f._d.findFrozen("not", 0), featureStoreRef(f._d, 0),
- 0, matchData);
+ PostingIterator itr(f._d.findFrozen("not", 0), featureStoreRef(f._d, 0), 0, matchData);
itr.initFullRange();
EXPECT_TRUE(itr.isAtEnd());
}
{
- PostingIterator itr(f._d.findFrozen("a", 0), featureStoreRef(f._d, 0),
- 0, matchData);
+ PostingIterator itr(f._d.findFrozen("a", 0), featureStoreRef(f._d, 0), 0, matchData);
itr.initFullRange();
EXPECT_EQUAL(10u, itr.getDocId());
itr.unpack(10);
@@ -1083,33 +1081,27 @@ TEST_F("requireThatInversionIsWorking", DictionaryFixture<Fixture>)
EXPECT_TRUE(itr.isAtEnd());
}
{
- PostingIterator itr(f._d.findFrozen("x", 0), featureStoreRef(f._d, 0),
- 0, matchData);
+ PostingIterator itr(f._d.findFrozen("x", 0), featureStoreRef(f._d, 0), 0, matchData);
itr.initFullRange();
EXPECT_TRUE(itr.isAtEnd());
}
{
- PostingIterator itr(f._d.findFrozen("x", 1), featureStoreRef(f._d, 1),
- 1, matchData);
+ PostingIterator itr(f._d.findFrozen("x", 1), featureStoreRef(f._d, 1), 1, matchData);
itr.initFullRange();
EXPECT_EQUAL(30u, itr.getDocId());
itr.unpack(30);
- EXPECT_EQUAL("{6:2[e=0,w=1,l=6]}",
- toString(tfmd.getIterator(), true, true));
+ EXPECT_EQUAL("{6:2[e=0,w=1,l=6]}", toString(tfmd.getIterator(), true, true));
}
{
- PostingIterator itr(f._d.findFrozen("x", 2), featureStoreRef(f._d, 2),
- 2, matchData);
+ PostingIterator itr(f._d.findFrozen("x", 2), featureStoreRef(f._d, 2), 2, matchData);
itr.initFullRange();
EXPECT_EQUAL(30u, itr.getDocId());
itr.unpack(30);
// weight is hardcoded to 1 for new style il doc array field
- EXPECT_EQUAL("{2:1[e=0,w=1,l=2]}",
- toString(tfmd.getIterator(), true, true));
+ EXPECT_EQUAL("{2:1[e=0,w=1,l=2]}", toString(tfmd.getIterator(), true, true));
}
{
- PostingIterator itr(f._d.findFrozen("x", 3), featureStoreRef(f._d, 3),
- 3, matchData);
+ PostingIterator itr(f._d.findFrozen("x", 3), featureStoreRef(f._d, 3), 3, matchData);
itr.initFullRange();
EXPECT_EQUAL(30u, itr.getDocId());
itr.unpack(30);
diff --git a/searchlib/src/tests/postinglistbm/postinglistbm.cpp b/searchlib/src/tests/postinglistbm/postinglistbm.cpp
index 58341a3458e..3a20af3e00a 100644
--- a/searchlib/src/tests/postinglistbm/postinglistbm.cpp
+++ b/searchlib/src/tests/postinglistbm/postinglistbm.cpp
@@ -13,6 +13,8 @@
#include <vespa/searchlib/index/docidandfeatures.h>
#include <vespa/fastos/app.h>
+#include <vespa/log/log.h>
+
using search::ResultSet;
using search::fef::TermFieldMatchData;
using search::fef::TermFieldMatchDataArray;
diff --git a/searchlib/src/tests/sort/uca.cpp b/searchlib/src/tests/sort/uca.cpp
index 3c55ac3dc31..579f3e7906e 100644
--- a/searchlib/src/tests/sort/uca.cpp
+++ b/searchlib/src/tests/sort/uca.cpp
@@ -1,17 +1,14 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/searchlib/common/sort.h>
#include <vespa/searchlib/common/sortspec.h>
-#include <vespa/searchlib/common/converters.h>
#include <vespa/vespalib/util/array.h>
-#include <memory>
-#include <string>
-#include <vector>
-#include <stdexcept>
#include <unicode/ustring.h>
#include <unicode/coll.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <vespa/log/log.h>
LOG_SETUP("uca_stress");
using icu::Collator;
diff --git a/searchlib/src/tests/util/ioerrorhandler/ioerrorhandler_test.cpp b/searchlib/src/tests/util/ioerrorhandler/ioerrorhandler_test.cpp
index 33d0879220b..f6055376907 100644
--- a/searchlib/src/tests/util/ioerrorhandler/ioerrorhandler_test.cpp
+++ b/searchlib/src/tests/util/ioerrorhandler/ioerrorhandler_test.cpp
@@ -13,6 +13,7 @@
#include <string>
#include <setjmp.h>
#include <dlfcn.h>
+#include <unistd.h>
#include <vespa/log/log.h>
LOG_SETUP("ioerrorhandler_test");
diff --git a/searchlib/src/tests/util/sigbushandler/sigbushandler_test.cpp b/searchlib/src/tests/util/sigbushandler/sigbushandler_test.cpp
index c4c6b616567..c86a1c86dbb 100644
--- a/searchlib/src/tests/util/sigbushandler/sigbushandler_test.cpp
+++ b/searchlib/src/tests/util/sigbushandler/sigbushandler_test.cpp
@@ -1,16 +1,19 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP("sigbushandler_test");
+
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/searchlib/util/statefile.h>
#include <vespa/searchlib/util/sigbushandler.h>
-#include <atomic>
#include <iostream>
#include <fstream>
-#include <string>
#include <vespa/searchlib/test/statefile.h>
#include <vespa/searchlib/test/statestring.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#include <vespa/log/log.h>
+LOG_SETUP("sigbushandler_test");
using namespace search::test::statefile;
using namespace search::test::statestring;
diff --git a/searchlib/src/tests/util/statefile/statefile_test.cpp b/searchlib/src/tests/util/statefile/statefile_test.cpp
index 6480455ab3e..a9f087c773b 100644
--- a/searchlib/src/tests/util/statefile/statefile_test.cpp
+++ b/searchlib/src/tests/util/statefile/statefile_test.cpp
@@ -1,6 +1,5 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP("statefile_test");
+
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/searchlib/util/statefile.h>
@@ -9,15 +8,18 @@ LOG_SETUP("statefile_test");
#include <fstream>
#include <string>
#include <vespa/searchlib/test/statefile.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <vespa/log/log.h>
+LOG_SETUP("statefile_test");
using namespace search::test::statefile;
-namespace search
-{
+namespace search {
-namespace
-{
+namespace {
bool
hasFile(const char *name)