diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-03-09 13:35:46 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-03-09 13:35:46 +0100 |
commit | 27821c298d6f61b025e400812cdd71871c1e3982 (patch) | |
tree | 377a8ae20b41f46631db2098c1b8eb41f477bce9 /searchlib/src | |
parent | 7f3e8265707321bf3156e2fe4d4f6e56d17ed557 (diff) |
Deinline destructorsi and use -Winline gcc option.
Diffstat (limited to 'searchlib/src')
24 files changed, 364 insertions, 322 deletions
diff --git a/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp b/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp index 62b337bfc59..5ed1b62bfb0 100644 --- a/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp +++ b/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp @@ -73,14 +73,8 @@ struct Fixture { std::shared_ptr<ImportedAttributeVector> imported_attr; std::shared_ptr<MockGidToLidMapperFactory> mapper_factory; - Fixture() - : target_attr(create_single_attribute<IntegerAttribute>(BasicType::INT32)), - reference_attr(create_reference_attribute()), - imported_attr(create_attribute_vector_from_members()), - mapper_factory(std::make_shared<MockGidToLidMapperFactory>()) - { - reference_attr->setGidToLidMapperFactory(mapper_factory); - } + Fixture(); + ~Fixture(); void map_reference(DocId from_lid, GlobalId via_gid, DocId to_lid) { assert(from_lid < reference_attr->getNumDocs()); @@ -178,6 +172,17 @@ struct Fixture { } }; +Fixture::Fixture() + : target_attr(create_single_attribute<IntegerAttribute>(BasicType::INT32)), + reference_attr(create_reference_attribute()), + imported_attr(create_attribute_vector_from_members()), + mapper_factory(std::make_shared<MockGidToLidMapperFactory>()) +{ + reference_attr->setGidToLidMapperFactory(mapper_factory); +} + +Fixture::~Fixture() {} + template <typename AttrValueType, typename PredicateType> void assert_multi_value_matches(const Fixture& f, DocId lid, diff --git a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp index f5b12d5c74c..a780cbbd229 100644 --- a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp @@ -79,17 +79,11 @@ class MyAttributeManager : public IAttributeManager { AttributeVector::SP _other; public: - MyAttributeManager(MyAttributeManager && rhs) : - IAttributeManager(), - _attribute_vector(std::move(rhs._attribute_vector)), - _other(std::move(rhs._other)) - { - } - explicit MyAttributeManager(AttributeVector *attr) - : _attribute_vector(attr), _other() {} + MyAttributeManager(MyAttributeManager && rhs); + explicit MyAttributeManager(AttributeVector *attr); - explicit MyAttributeManager(AttributeVector::SP attr) - : _attribute_vector(attr), _other() {} + explicit MyAttributeManager(AttributeVector::SP attr); + ~MyAttributeManager(); void set_other(AttributeVector::SP attr) { _other = attr; @@ -143,11 +137,8 @@ struct Result { std::vector<Hit> hits; vespalib::string iterator_dump; - Result(size_t est_hits_in, bool est_empty_in) - : est_hits(est_hits_in), est_empty(est_empty_in), - has_minmax(false), min_weight(0), max_weight(0), - wand_hits(0), wand_initial_threshold(0), wand_boost_factor(0.0), - hits(), iterator_dump() {} + Result(size_t est_hits_in, bool est_empty_in); + ~Result(); void set_minmax(int32_t min, int32_t max) { has_minmax = true; @@ -156,6 +147,31 @@ struct Result { } }; +Result::Result(size_t est_hits_in, bool est_empty_in) + : est_hits(est_hits_in), est_empty(est_empty_in), has_minmax(false), min_weight(0), max_weight(0), wand_hits(0), + wand_initial_threshold(0), wand_boost_factor(0.0), hits(), iterator_dump() +{} + +Result::~Result() {} + + +MyAttributeManager::MyAttributeManager(MyAttributeManager && rhs) + : IAttributeManager(), + _attribute_vector(std::move(rhs._attribute_vector)), + _other(std::move(rhs._other)) +{} +MyAttributeManager::MyAttributeManager(AttributeVector *attr) + : _attribute_vector(attr), + _other() +{} + +MyAttributeManager::MyAttributeManager(AttributeVector::SP attr) + : _attribute_vector(std::move(attr)), + _other() +{} + +MyAttributeManager::~MyAttributeManager() {} + void extract_posting_info(Result &result, const PostingInfo *postingInfo) { if (postingInfo != NULL) { const MinMaxPostingInfo *minMax = dynamic_cast<const MinMaxPostingInfo *>(postingInfo); diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp index 138e406c988..32da1743343 100644 --- a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp +++ b/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp @@ -61,7 +61,8 @@ using fef::TermFieldMatchDataPosition; class DocSet : public std::set<uint32_t> { public: - DocSet() : std::set<uint32_t>() {} + DocSet(); + ~DocSet(); DocSet(const uint32_t *b, const uint32_t *e) : std::set<uint32_t>(b, e) {} DocSet & put(const uint32_t &v) { insert(v); @@ -69,6 +70,9 @@ public: } }; +DocSet::DocSet() : std::set<uint32_t>() {} +DocSet::~DocSet() {} + template <typename V, typename T> class PostingList { @@ -78,7 +82,8 @@ private: DocSet _hits; public: - PostingList(V & vec, T value) : _vec(&vec), _value(value), _hits() {} + PostingList(V & vec, T value); + ~PostingList(); const V & getAttribute() const { return *_vec; } V & getAttribute() { return *_vec; } const T & getValue() const { return _value; } @@ -87,6 +92,12 @@ public: uint32_t getHitCount() const { return _hits.size(); } }; +template <typename V, typename T> +PostingList<V, T>::PostingList(V & vec, T value) : _vec(&vec), _value(value), _hits() {} + +template <typename V, typename T> +PostingList<V, T>::~PostingList() {} + class DocRange { public: @@ -608,20 +619,8 @@ void SearchContextTest::testSearch(const ConfigMap & cfgs) { template<typename T, typename A> class Verifier : public search::test::SearchIteratorVerifier { public: - Verifier(T key, const vespalib::string & keyAsString, const vespalib::string & name, const Config & cfg) : - _attribute(AttributeFactory::createAttribute(name + "-initrange", cfg)), - _sc() - { - SearchContextTest::addDocs(*_attribute, getDocIdLimit()); - for (uint32_t doc : getExpectedDocIds()) { - EXPECT_TRUE(nullptr != dynamic_cast<A *>(_attribute.get())); - EXPECT_TRUE(dynamic_cast<A *>(_attribute.get())->update(doc, key)); - } - _attribute->commit(true); - _sc = SearchContextTest::getSearch(*_attribute, keyAsString); - ASSERT_TRUE(_sc->valid()); - _sc->fetchPostings(true); - } + Verifier(T key, const vespalib::string & keyAsString, const vespalib::string & name, const Config & cfg); + ~Verifier(); SearchIterator::UP create(bool strict) const override { return _sc->createIterator(&_dummy, strict); } @@ -632,6 +631,25 @@ private: }; template<typename T, typename A> +Verifier<T, A>::Verifier(T key, const vespalib::string & keyAsString, const vespalib::string & name, const Config & cfg) + :_attribute(AttributeFactory::createAttribute(name + "-initrange", cfg)), + _sc() +{ + SearchContextTest::addDocs(*_attribute, getDocIdLimit()); + for (uint32_t doc : getExpectedDocIds()) { + EXPECT_TRUE(nullptr != dynamic_cast<A *>(_attribute.get())); + EXPECT_TRUE(dynamic_cast<A *>(_attribute.get())->update(doc, key)); + } + _attribute->commit(true); + _sc = SearchContextTest::getSearch(*_attribute, keyAsString); + ASSERT_TRUE(_sc->valid()); + _sc->fetchPostings(true); +} + +template<typename T, typename A> +Verifier<T, A>::~Verifier() {} + +template<typename T, typename A> void SearchContextTest::testSearchIterator(T key, const vespalib::string &keyAsString, const ConfigMap &cfgs) { for (const auto & cfg : cfgs) { diff --git a/searchlib/src/tests/btree/btreeaggregation_test.cpp b/searchlib/src/tests/btree/btreeaggregation_test.cpp index 51ff66367a1..aa3ee432df5 100644 --- a/searchlib/src/tests/btree/btreeaggregation_test.cpp +++ b/searchlib/src/tests/btree/btreeaggregation_test.cpp @@ -205,11 +205,8 @@ public: MTree _tree; MRTree _rtree; - MockTree() - : _tree(), - _rtree() - { - } + MockTree(); + ~MockTree(); void @@ -240,6 +237,12 @@ public: }; +MockTree::MockTree() + : _tree(), + _rtree() +{} +MockTree::~MockTree() {} + class MyTreeForceApplyStore : public MyTreeStore { public: diff --git a/searchlib/src/tests/diskindex/diskindex/diskindex_test.cpp b/searchlib/src/tests/diskindex/diskindex/diskindex_test.cpp index da8f8bb4abe..55d72f3aa58 100644 --- a/searchlib/src/tests/diskindex/diskindex/diskindex_test.cpp +++ b/searchlib/src/tests/diskindex/diskindex/diskindex_test.cpp @@ -68,9 +68,8 @@ public: class Verifier : public SearchIteratorVerifier { public: - Verifier(FakePosting::SP fp) : - _fp(std::move(fp)) - { } + Verifier(FakePosting::SP fp); + ~Verifier(); SearchIterator::UP create(bool strict) const override { (void) strict; return SearchIterator::UP(_fp->createIterator(_tfmda)); @@ -80,6 +79,11 @@ private: FakePosting::SP _fp; }; + Verifier::Verifier(FakePosting::SP fp) : + _fp(std::move(fp)) + { } + Verifier::~Verifier() {} + void Test::requireThatSearchIteratorsConforms() { diff --git a/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp b/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp index afc0d428ee7..d3cebd9944d 100644 --- a/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp +++ b/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp @@ -163,29 +163,18 @@ public: bool dynamicK, uint32_t numWordIds, uint32_t docIdLimit); - - virtual void - checkPoint(void) override; - - void - earlyOpen(void); - - void - lateOpen(void); - - void - open(void); - - void - close(void); - - void - writeCheckPoint(void); - - void - readCheckPoint(bool first); + ~WrappedFieldWriter(); + + void checkPoint() override; + void earlyOpen(); + void lateOpen(); + void open(); + void close(); + void writeCheckPoint(); + void readCheckPoint(bool first); }; +WrappedFieldWriter::~WrappedFieldWriter() {} WrappedFieldWriter::WrappedFieldWriter(const vespalib::string &namepref, bool dynamicK, diff --git a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp index d58d7cc5cf8..3f42464ffe5 100644 --- a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp +++ b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp @@ -435,21 +435,8 @@ makeDoc(const DocumentTypeRepo &repo, uint32_t i, bool extra_field) class VisitCacheStore { public: - VisitCacheStore() : - _myDir("visitcache"), - _repo(makeDocTypeRepoConfig()), - _config(DocumentStore::Config(CompressionConfig::LZ4, 1000000, 0).allowVisitCaching(true), - LogDataStore::Config(50000, 0.2, 3.0, 0.2, 1, true,CompressionConfig::LZ4, - WriteableFileChunk::Config(CompressionConfig(), 16384))), - _fileHeaderContext(), - _executor(_config.getLogConfig().getNumThreads(), 128*1024), - _tlSyncer(), - _datastore(_executor, _myDir.getDir(), _config, - GrowStrategy(), TuneFileSummary(), - _fileHeaderContext, _tlSyncer, NULL), - _inserted(), - _serial(1) - { } + VisitCacheStore(); + ~VisitCacheStore(); IDocumentStore & getStore() { return _datastore; } void write(uint32_t id) { write(id, makeDoc(_repo, id, true)); @@ -481,19 +468,8 @@ public: private: class VerifyVisitor : public IDocumentVisitor { public: - VerifyVisitor(VisitCacheStore & vcs, std::vector<uint32_t> lids, bool allowCaching) : - _vcs(vcs), - _expected(), - _actual(), - _allowVisitCaching(allowCaching) - { - for (uint32_t lid : lids) { - _expected.insert(lid); - } - } - ~VerifyVisitor() { - EXPECT_EQUAL(_expected.size(), _actual.size()); - } + VerifyVisitor(VisitCacheStore & vcs, std::vector<uint32_t> lids, bool allowCaching); + ~VerifyVisitor(); void visit(uint32_t lid, Document::UP doc) override { EXPECT_TRUE(_expected.find(lid) != _expected.end()); EXPECT_TRUE(_actual.find(lid) == _actual.end()); @@ -518,6 +494,34 @@ private: SerialNum _serial; }; +VisitCacheStore::VerifyVisitor::VerifyVisitor(VisitCacheStore & vcs, std::vector<uint32_t> lids, bool allowCaching) + : _vcs(vcs), _expected(), _actual(), _allowVisitCaching(allowCaching) +{ + for (uint32_t lid : lids) { + _expected.insert(lid); + } +} +VisitCacheStore::VerifyVisitor::~VerifyVisitor() { + EXPECT_EQUAL(_expected.size(), _actual.size()); +} + +VisitCacheStore::VisitCacheStore() : + _myDir("visitcache"), + _repo(makeDocTypeRepoConfig()), + _config(DocumentStore::Config(CompressionConfig::LZ4, 1000000, 0).allowVisitCaching(true), + LogDataStore::Config(50000, 0.2, 3.0, 0.2, 1, true,CompressionConfig::LZ4, + WriteableFileChunk::Config(CompressionConfig(), 16384))), + _fileHeaderContext(), + _executor(_config.getLogConfig().getNumThreads(), 128*1024), + _tlSyncer(), + _datastore(_executor, _myDir.getDir(), _config, + GrowStrategy(), TuneFileSummary(), + _fileHeaderContext, _tlSyncer, NULL), + _inserted(), + _serial(1) +{ } +VisitCacheStore::~VisitCacheStore() {} + void verifyCacheStats(CacheStats cs, size_t hits, size_t misses, size_t elements, size_t memory_used) { EXPECT_EQUAL(hits, cs.hits); diff --git a/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp b/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp index 963f4a58bb0..70e1d481a6c 100644 --- a/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp +++ b/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp @@ -21,20 +21,24 @@ struct SetupResult { RankingExpressionBlueprint rank; DummyDependencyHandler deps; bool setup_ok; - SetupResult(const TypeMap &object_inputs, - const vespalib::string &expression) - : index_env(), rank(), deps(rank), setup_ok(false) - { - rank.setName("self"); - index_env.getProperties().add("self.rankingScript", expression); - for (const auto &input: object_inputs) { - deps.define_object_input(input.first, ValueType::from_spec(input.second)); - } - setup_ok = rank.setup(index_env, {}); - EXPECT_TRUE(!deps.accept_type_mismatch); - } + SetupResult(const TypeMap &object_inputs, const vespalib::string &expression); + ~SetupResult(); }; +SetupResult::SetupResult(const TypeMap &object_inputs, + const vespalib::string &expression) + : index_env(), rank(), deps(rank), setup_ok(false) +{ + rank.setName("self"); + index_env.getProperties().add("self.rankingScript", expression); + for (const auto &input: object_inputs) { + deps.define_object_input(input.first, ValueType::from_spec(input.second)); + } + setup_ok = rank.setup(index_env, {}); + EXPECT_TRUE(!deps.accept_type_mismatch); +} +SetupResult::~SetupResult() {} + void verify_output_type(const TypeMap &object_inputs, const vespalib::string &expression, const FeatureType &expect) { diff --git a/searchlib/src/tests/fef/termfieldmodel/termfieldmodel_test.cpp b/searchlib/src/tests/fef/termfieldmodel/termfieldmodel_test.cpp index be55d64c182..86b5304e28c 100644 --- a/searchlib/src/tests/fef/termfieldmodel/termfieldmodel_test.cpp +++ b/searchlib/src/tests/fef/termfieldmodel/termfieldmodel_test.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("termfieldmodel_test"); + #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/searchlib/fef/fef.h> #include <vespa/searchlib/queryeval/searchiterator.h> @@ -18,13 +16,17 @@ struct State { TermFieldMatchData *f7; TermFieldMatchDataArray array; - State() : term(), md(), f3(0), f5(0), f7(0), array() {} + State(); + ~State(); void setArray(TermFieldMatchDataArray value) { array = value; } }; +State::State() : term(), md(), f3(0), f5(0), f7(0), array() {} +State::~State() {} + void testInvalidId() { const TermFieldMatchData empty; using search::queryeval::SearchIterator; diff --git a/searchlib/src/tests/grouping/grouping_test.cpp b/searchlib/src/tests/grouping/grouping_test.cpp index 28c0c080826..10fa3267c09 100644 --- a/searchlib/src/tests/grouping/grouping_test.cpp +++ b/searchlib/src/tests/grouping/grouping_test.cpp @@ -112,7 +112,8 @@ private: AggregationContext &operator=(const AggregationContext &); public: - AggregationContext() : _attrMan(), _result(), _attrCtx(_attrMan.createContext()) {} + AggregationContext(); + ~AggregationContext(); ResultBuilder &result() { return _result; } void add(AttributeVector::SP attr) { _attrMan.add(attr); @@ -122,6 +123,9 @@ public: } }; +AggregationContext::AggregationContext() : _attrMan(), _result(), _attrCtx(_attrMan.createContext()) {} +AggregationContext::~AggregationContext() {} + //----------------------------------------------------------------------------- class Test : public TestApp diff --git a/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp b/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp index b7136741a4c..4b65477224d 100644 --- a/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp +++ b/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp @@ -114,7 +114,8 @@ private: AggregationContext &operator=(const AggregationContext &); public: - AggregationContext() : _attrMan(), _result(), _attrCtx(_attrMan.createContext()) {} + AggregationContext(); + ~AggregationContext(); ResultBuilder &result() { return _result; } void add(AttributeVector::SP attr) { _attrMan.add(attr); @@ -124,6 +125,11 @@ public: } }; + +AggregationContext::AggregationContext() + : _attrMan(), _result(), _attrCtx(_attrMan.createContext()) +{} +AggregationContext::~AggregationContext() {} //----------------------------------------------------------------------------- class Test : public TestApp diff --git a/searchlib/src/tests/groupingengine/groupingengine_test.cpp b/searchlib/src/tests/groupingengine/groupingengine_test.cpp index 96963d6e320..4b2cf6a708a 100644 --- a/searchlib/src/tests/groupingengine/groupingengine_test.cpp +++ b/searchlib/src/tests/groupingengine/groupingengine_test.cpp @@ -114,7 +114,8 @@ private: AggregationContext &operator=(const AggregationContext &); public: - AggregationContext() : _attrMan(), _result(), _attrCtx(_attrMan.createContext()) {} + AggregationContext(); + ~AggregationContext(); ResultBuilder &result() { return _result; } void add(AttributeVector::SP attr) { _attrMan.add(attr); @@ -124,6 +125,9 @@ public: } }; +AggregationContext::AggregationContext() : _attrMan(), _result(), _attrCtx(_attrMan.createContext()) {} +AggregationContext::~AggregationContext() {} + //----------------------------------------------------------------------------- class Test : public TestApp diff --git a/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp b/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp index bc9822bf7f0..4ef2e4e3617 100644 --- a/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp +++ b/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp @@ -733,17 +733,8 @@ TEST_F("requireThatFeaturesAreInPostingLists", Fixture) class Verifier : public SearchIteratorVerifier { public: - Verifier(const Schema & schema) : - _tfmd(), - _dictionary(schema) - { - WrapInserter inserter(_dictionary, 0); - inserter.word("a"); - for (uint32_t docId : getExpectedDocIds()) { - inserter.add(docId); - } - inserter.flush(); - } + Verifier(const Schema & schema); + ~Verifier(); SearchIterator::UP create(bool strict) const override { (void) strict; @@ -757,6 +748,20 @@ private: Dictionary _dictionary; }; + +Verifier::Verifier(const Schema & schema) + : _tfmd(), + _dictionary(schema) +{ + WrapInserter inserter(_dictionary, 0); + inserter.word("a"); + for (uint32_t docId : getExpectedDocIds()) { + inserter.add(docId); + } + inserter.flush(); +} +Verifier::~Verifier() {} + TEST_F("require that postingiterator conforms", Fixture) { Verifier verifier(f.getSchema()); verifier.verify(); diff --git a/searchlib/src/tests/memoryindex/memoryindex/memoryindex_test.cpp b/searchlib/src/tests/memoryindex/memoryindex/memoryindex_test.cpp index 57e638d26a5..a1302d7de78 100644 --- a/searchlib/src/tests/memoryindex/memoryindex/memoryindex_test.cpp +++ b/searchlib/src/tests/memoryindex/memoryindex/memoryindex_test.cpp @@ -54,17 +54,8 @@ struct Index { uint32_t docid; std::string currentField; - Index(const Setup &setup) - : schema(setup.schema), - _executor(1, 128 * 1024), - _invertThreads(2), - _pushThreads(2), - index(schema, _invertThreads, _pushThreads), - builder(schema), - docid(1), - currentField() - { - } + Index(const Setup &setup); + ~Index(); void closeField() { if (!currentField.empty()) { builder.endField(); @@ -111,6 +102,19 @@ private: Index &operator=(const Index &index); }; + +Index::Index(const Setup &setup) + : schema(setup.schema), + _executor(1, 128 * 1024), + _invertThreads(2), + _pushThreads(2), + index(schema, _invertThreads, _pushThreads), + builder(schema), + docid(1), + currentField() +{ +} +Index::~Index() {} //----------------------------------------------------------------------------- std::string toString(SearchIterator & search) diff --git a/searchlib/src/tests/nearsearch/nearsearch_test.cpp b/searchlib/src/tests/nearsearch/nearsearch_test.cpp index 9942bcecd4a..8a20a6a27f8 100644 --- a/searchlib/src/tests/nearsearch/nearsearch_test.cpp +++ b/searchlib/src/tests/nearsearch/nearsearch_test.cpp @@ -34,12 +34,8 @@ private: std::set<uint32_t> _data; public: - MyTerm(const std::set<uint32_t> &doc, - const std::set<uint32_t> &pos) - : _docs(doc), - _data(pos) - { - } + MyTerm(const std::set<uint32_t> &doc, const std::set<uint32_t> &pos); + ~MyTerm(); search::queryeval::Blueprint::UP make_blueprint(uint32_t fieldId, search::fef::TermFieldHandle handle) const @@ -62,6 +58,12 @@ public: } }; +MyTerm::MyTerm(const std::set<uint32_t> &doc, const std::set<uint32_t> &pos) + : _docs(doc), + _data(pos) +{} +MyTerm::~MyTerm() {} + class MyQuery { private: std::vector<MyTerm*> _terms; @@ -69,12 +71,8 @@ private: uint32_t _window; public: - MyQuery(bool ordered, uint32_t window) : - _terms(), - _ordered(ordered), - _window(window) { - // empty - } + MyQuery(bool ordered, uint32_t window); + ~MyQuery(); MyQuery &addTerm(MyTerm &term) { _terms.push_back(&term); @@ -98,6 +96,13 @@ public: } }; +MyQuery::MyQuery(bool ordered, uint32_t window) + : _terms(), + _ordered(ordered), + _window(window) +{} +MyQuery::~MyQuery() {} + //////////////////////////////////////////////////////////////////////////////// // // Setup diff --git a/searchlib/src/tests/queryeval/booleanmatchiteratorwrapper/booleanmatchiteratorwrapper_test.cpp b/searchlib/src/tests/queryeval/booleanmatchiteratorwrapper/booleanmatchiteratorwrapper_test.cpp index e11bec31868..bd92acaa799 100644 --- a/searchlib/src/tests/queryeval/booleanmatchiteratorwrapper/booleanmatchiteratorwrapper_test.cpp +++ b/searchlib/src/tests/queryeval/booleanmatchiteratorwrapper/booleanmatchiteratorwrapper_test.cpp @@ -121,6 +121,7 @@ TEST("mostly everything") { class Verifier : public search::test::SearchIteratorVerifier { public: + ~Verifier(); SearchIterator::UP create(bool strict) const override { return std::make_unique<BooleanMatchIteratorWrapper>(createIterator(getExpectedDocIds(), strict), _tfmda);; } @@ -128,6 +129,8 @@ private: mutable TermFieldMatchDataArray _tfmda; }; +Verifier::~Verifier() {} + TEST("Test that boolean wrapper iterators adheres to SearchIterator requirements") { Verifier searchIteratorVerifier; searchIteratorVerifier.verify(); diff --git a/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp b/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp index 2339a88be5a..d82565a9ec7 100644 --- a/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp +++ b/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp @@ -87,12 +87,8 @@ struct WandTestSpec : public WandSpec MatchParams matchParams; WandTestSpec(uint32_t scoresToTrack, uint32_t scoresAdjustFrequency = 1, - score_t scoreThreshold = 0, double thresholdBoostFactor = 1) - : WandSpec(), - heap(scoresToTrack), - rootMatchData(), - matchParams(heap, scoreThreshold, thresholdBoostFactor, scoresAdjustFrequency) - {} + score_t scoreThreshold = 0, double thresholdBoostFactor = 1); + ~WandTestSpec(); SearchIterator *create() { MatchData::UP childrenMatchData = createMatchData(); MatchData *tmp = childrenMatchData.get(); @@ -104,6 +100,18 @@ struct WandTestSpec : public WandSpec } }; +template <typename HeapType> +WandTestSpec<HeapType>::WandTestSpec(uint32_t scoresToTrack, uint32_t scoresAdjustFrequency, + score_t scoreThreshold, double thresholdBoostFactor) + : WandSpec(), + heap(scoresToTrack), + rootMatchData(), + matchParams(heap, scoreThreshold, thresholdBoostFactor, scoresAdjustFrequency) +{} + +template <typename HeapType> +WandTestSpec<HeapType>::~WandTestSpec() {} + typedef WandTestSpec<TestHeap> WandSpecWithTestHeap; typedef WandTestSpec<SharedWeakAndPriorityQueue> WandSpecWithRealHeap; @@ -403,7 +411,8 @@ struct BlueprintFixtureBase { WandBlueprintSpec spec; FakeSearchable searchable; - BlueprintFixtureBase() : spec(), searchable() {} + BlueprintFixtureBase(); + ~BlueprintFixtureBase(); Blueprint::UP blueprint(const search::query::Node &term) { return spec.blueprint(searchable, "field", term); } @@ -418,6 +427,9 @@ struct BlueprintFixtureBase } }; +BlueprintFixtureBase::BlueprintFixtureBase() : spec(), searchable() {} +BlueprintFixtureBase::~BlueprintFixtureBase() {} + struct BlueprintHitsFixture : public BlueprintFixtureBase { FakeResult createResult(size_t hits) { diff --git a/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp b/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp index 85fce4a8215..6f87f6befb0 100644 --- a/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp +++ b/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp @@ -105,17 +105,8 @@ private: bool _strict; public: - PhraseSearchTest(bool expiredDoom=false) : - _requestContext(nullptr, expiredDoom ? 0 : std::numeric_limits<int64_t>::max()), - _index(), - _phrase_fs(field, fieldId, phrase_handle), - _phrase(_phrase_fs, _requestContext), - _children(), - _md(MatchData::makeTestInstance(100, 10)), - _order(), - _pos(1), - _strict(false) - {} + PhraseSearchTest(bool expiredDoom=false); + ~PhraseSearchTest(); TermFieldHandle childHandle(uint32_t idx) const { return (10 * idx + 11); } @@ -186,6 +177,19 @@ public: } }; +PhraseSearchTest::PhraseSearchTest(bool expiredDoom) + : _requestContext(nullptr, expiredDoom ? 0 : std::numeric_limits<int64_t>::max()), + _index(), + _phrase_fs(field, fieldId, phrase_handle), + _phrase(_phrase_fs, _requestContext), + _children(), + _md(MatchData::makeTestInstance(100, 10)), + _order(), + _pos(1), + _strict(false) +{} +PhraseSearchTest::~PhraseSearchTest() {} + void Test::requireThatIteratorFindsSimplePhrase(bool useBlueprint) { PhraseSearchTest test; test.addTerm("foo", 0).addTerm("bar", 1); diff --git a/searchlib/src/tests/queryeval/sourceblender/sourceblender.cpp b/searchlib/src/tests/queryeval/sourceblender/sourceblender.cpp index 9f5faca2668..f6446c4b5cb 100644 --- a/searchlib/src/tests/queryeval/sourceblender/sourceblender.cpp +++ b/searchlib/src/tests/queryeval/sourceblender/sourceblender.cpp @@ -143,16 +143,8 @@ using search::test::SearchIteratorVerifier; class Verifier : public SearchIteratorVerifier { public: - Verifier() : - _indexes(3), - _selector(getDocIdLimit()) - { - for (uint32_t docId : getExpectedDocIds()) { - const size_t indexId = docId % _indexes.size(); - _selector.set(docId, indexId); - _indexes[indexId].push_back(docId); - } - } + Verifier(); + ~Verifier(); SearchIterator::UP create(bool strict) const override { return SearchIterator::UP(SourceBlenderSearch::create(_selector.createIterator(), createChildren(strict), @@ -171,6 +163,18 @@ private: MySelector _selector; }; +Verifier::Verifier() : + _indexes(3), + _selector(getDocIdLimit()) +{ + for (uint32_t docId : getExpectedDocIds()) { + const size_t indexId = docId % _indexes.size(); + _selector.set(docId, indexId); + _indexes[indexId].push_back(docId); + } +} +Verifier::~Verifier() {} + TEST("Test that source blender iterator adheres to SearchIterator requirements") { Verifier searchIteratorVerifier; searchIteratorVerifier.verify(); diff --git a/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp b/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp index 70e087f7c49..5a3ddc04295 100644 --- a/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp +++ b/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp @@ -81,6 +81,7 @@ struct MyBlueprint : SimpleLeafBlueprint { setEstimate(HitEstimate(hits.size(), hits.empty())); set_allow_termwise_eval(allow_termwise_eval); } + ~MyBlueprint(); SearchIterator::UP createLeafSearch(const fef::TermFieldMatchDataArray &, bool strict) const override { @@ -88,6 +89,8 @@ struct MyBlueprint : SimpleLeafBlueprint { } }; +MyBlueprint::~MyBlueprint() {} + struct MyOr : OrBlueprint { bool use_my_value; bool my_value; diff --git a/searchlib/src/tests/ranksetup/ranksetup_test.cpp b/searchlib/src/tests/ranksetup/ranksetup_test.cpp index fd34e030d33..ba676ac8e2a 100644 --- a/searchlib/src/tests/ranksetup/ranksetup_test.cpp +++ b/searchlib/src/tests/ranksetup/ranksetup_test.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("ranksetup_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <map> @@ -98,14 +96,20 @@ private: RankProgram::UP _secondPhaseProgram; public: - RankExecutor(const vespalib::string &initRank, - const vespalib::string &finalRank, const RankEnvironment &rankEnv) : - _initRank(initRank), _finalRank(finalRank), _rankEnv(rankEnv), _layout(), - _rs(), _firstPhaseProgram(), _secondPhaseProgram() {} + RankExecutor(const vespalib::string &initRank, const vespalib::string &finalRank, const RankEnvironment &rankEnv); + ~RankExecutor(); bool setup(); RankResult execute(uint32_t docId = 1); }; +RankExecutor::RankExecutor(const vespalib::string &initRank, const vespalib::string &finalRank, + const RankEnvironment &rankEnv) + : _initRank(initRank), _finalRank(finalRank), _rankEnv(rankEnv), _layout(), + _rs(), _firstPhaseProgram(), _secondPhaseProgram() +{} + +RankExecutor::~RankExecutor() {} + bool RankExecutor::setup() { @@ -158,17 +162,21 @@ private: RankProgram::UP _rankProgram; public: - FeatureDumper(const RankEnvironment & rankEnv) : - _rankEnv(rankEnv), - _setup(_rankEnv.factory(), _rankEnv.indexEnvironment()), - _layout(), - _rankProgram() {} + FeatureDumper(const RankEnvironment & rankEnv); + ~FeatureDumper(); void addDumpFeature(const vespalib::string &name); void configure(); bool setup(); RankResult dump(); }; +FeatureDumper::FeatureDumper(const RankEnvironment & rankEnv) + : _rankEnv(rankEnv), + _setup(_rankEnv.factory(), _rankEnv.indexEnvironment()), + _layout(), + _rankProgram() +{} +FeatureDumper::~FeatureDumper() {} void FeatureDumper::addDumpFeature(const vespalib::string &name) { diff --git a/searchlib/src/tests/transactionlogstress/translogstress.cpp b/searchlib/src/tests/transactionlogstress/translogstress.cpp index 1e569f8791a..c11aa62cd21 100644 --- a/searchlib/src/tests/transactionlogstress/translogstress.cpp +++ b/searchlib/src/tests/transactionlogstress/translogstress.cpp @@ -206,13 +206,19 @@ private: public: FeederThread(const std::string & tlsSpec, const std::string & domain, - const EntryGenerator & generator, uint32_t feedRate, size_t packetSize) : - _tlsSpec(tlsSpec), _domain(domain), _client(tlsSpec), _session(), - _generator(generator), _feedRate(feedRate), _packet(packetSize), _current(1), _lastCommited(1), _timer() {} + const EntryGenerator & generator, uint32_t feedRate, size_t packetSize); + ~FeederThread(); virtual void doRun(); SerialNumRange getRange() const { return SerialNumRange(1, _lastCommited); } }; +FeederThread::FeederThread(const std::string & tlsSpec, const std::string & domain, + const EntryGenerator & generator, uint32_t feedRate, size_t packetSize) + : _tlsSpec(tlsSpec), _domain(domain), _client(tlsSpec), _session(), + _generator(generator), _feedRate(feedRate), _packet(packetSize), _current(1), _lastCommited(1), _timer() +{} +FeederThread::~FeederThread() {} + void FeederThread::commitPacket() { @@ -543,20 +549,8 @@ private: public: ControllerThread(const std::string & tlsSpec, const std::string & domain, const EntryGenerator & generator, uint32_t numSubscribers, uint32_t numVisitors, - uint64_t visitorInterval, uint64_t pruneInterval) : - _tlsSpec(tlsSpec), _domain(domain), _client(tlsSpec.c_str()), _session(), - _generator(generator), _subscribers(), _visitors(), _rndVisitors(), _visitorInterval(visitorInterval), - _pruneInterval(pruneInterval), _pruneTimer(), _begin(0), _end(0), _count(0) - { - for (uint32_t i = 0; i < numSubscribers; ++i) { - _subscribers.push_back(std::shared_ptr<SubscriberAgent> - (new SubscriberAgent(tlsSpec, domain, generator, 0, i, true))); - } - - for (uint32_t i = 0; i < numVisitors; ++i) { - _visitors.push_back(std::shared_ptr<VisitorAgent>(new VisitorAgent(tlsSpec, domain, generator, i, true))); - } - } + uint64_t visitorInterval, uint64_t pruneInterval); + ~ControllerThread(); void startSubscribers(); uint32_t runningVisitors(); std::vector<std::shared_ptr<SubscriberAgent> > & getSubscribers() { return _subscribers; } @@ -565,6 +559,23 @@ public: }; +ControllerThread::ControllerThread(const std::string & tlsSpec, const std::string & domain, + const EntryGenerator & generator, uint32_t numSubscribers, uint32_t numVisitors, + uint64_t visitorInterval, uint64_t pruneInterval) + : _tlsSpec(tlsSpec), _domain(domain), _client(tlsSpec.c_str()), _session(), + _generator(generator), _subscribers(), _visitors(), _rndVisitors(), _visitorInterval(visitorInterval), + _pruneInterval(pruneInterval), _pruneTimer(), _begin(0), _end(0), _count(0) +{ + for (uint32_t i = 0; i < numSubscribers; ++i) { + _subscribers.push_back(std::make_shared<SubscriberAgent>(tlsSpec, domain, generator, 0, i, true)); + } + + for (uint32_t i = 0; i < numVisitors; ++i) { + _visitors.push_back(std::make_shared<VisitorAgent>(tlsSpec, domain, generator, i, true)); + } +} +ControllerThread::~ControllerThread() {} + void ControllerThread::getStatus() { diff --git a/searchlib/src/tests/util/bufferwriter/bufferwriter_test.cpp b/searchlib/src/tests/util/bufferwriter/bufferwriter_test.cpp index 95e4db95e03..a20cdb1e8eb 100644 --- a/searchlib/src/tests/util/bufferwriter/bufferwriter_test.cpp +++ b/searchlib/src/tests/util/bufferwriter/bufferwriter_test.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("bufferwriter_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/stllike/string.h> #include <vespa/searchlib/util/bufferwriter.h> @@ -12,8 +9,7 @@ LOG_SETUP("bufferwriter_test"); namespace search { -namespace -{ +namespace { class StoreBufferWriter : public BufferWriter { @@ -25,15 +21,11 @@ public: static constexpr size_t BUFFER_SIZE = 262144; StoreBufferWriter(); + ~StoreBufferWriter(); - virtual ~StoreBufferWriter() = default; - - virtual void flush() override; - + void flush() override; size_t getBytesWritten() const { return _bytesWritten; } - std::vector<char> getSingleBuffer() const; - }; @@ -47,6 +39,8 @@ StoreBufferWriter::StoreBufferWriter() setup(&_buf[0], _buf.size()); } +StoreBufferWriter::~StoreBufferWriter() {} + void StoreBufferWriter::flush() { diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakeword.h b/searchlib/src/vespa/searchlib/test/fakedata/fakeword.h index 8814bd9cf7e..23fc4ee9863 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakeword.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakeword.h @@ -12,27 +12,18 @@ #include <vespa/searchlib/diskindex/fieldreader.h> #include <vespa/searchlib/diskindex/fieldwriter.h> -namespace search -{ +namespace search { -namespace fakedata -{ +namespace fakedata { class CheckPointCallback { public: - CheckPointCallback(void) - { - } - - virtual - ~CheckPointCallback(void) - { - } + CheckPointCallback() {} + virtual ~CheckPointCallback() {} - virtual void - checkPoint(void) = 0; + virtual void checkPoint() = 0; }; /* @@ -52,16 +43,14 @@ public: int32_t _elementWeight; uint32_t _elementLen; - inline bool - operator<(const DocWordPosFeature &rhs) const - { + bool operator<(const DocWordPosFeature &rhs) const { if (_elementId != rhs._elementId) return _elementId < rhs._elementId; return _wordPos < rhs._wordPos; } - DocWordPosFeature(void); - ~DocWordPosFeature(void); + DocWordPosFeature(); + ~DocWordPosFeature(); }; typedef std::vector<DocWordPosFeature> DocWordPosFeatureList; @@ -69,8 +58,8 @@ public: class DocWordCollapsedFeature { public: - DocWordCollapsedFeature(void); - ~DocWordCollapsedFeature(void); + DocWordCollapsedFeature(); + ~DocWordCollapsedFeature(); }; class DocWordFeature @@ -81,8 +70,8 @@ public: uint32_t _positions; uint32_t _accPositions; // accumulated positions for previous words - DocWordFeature(void); - ~DocWordFeature(void); + DocWordFeature(); + ~DocWordFeature(); }; typedef std::vector<DocWordFeature> DocWordFeatureList; @@ -93,57 +82,32 @@ public: uint32_t _random; int32_t _ref; - Randomizer(void) - : _random(0), - _ref(0) - { - } + Randomizer() : _random(0), _ref(0) {} - bool - operator<(const Randomizer &rhs) const - { + bool operator<(const Randomizer &rhs) const { if (_random != rhs._random) return _random < rhs._random; return _ref < rhs._ref; } - bool - operator==(const Randomizer &rhs) const - { + bool operator==(const Randomizer &rhs) const { return _random == rhs._random && _ref == rhs._ref; } - bool - isExtra(void) const - { - return _ref < 0; - } - - bool - isRemove(void) const - { - return isExtra() && (_ref & 1) == 0; - } - - uint32_t - extraIdx(void) const - { - return (~_ref) >> 1; - } + bool isExtra() const { return _ref < 0; } + bool isRemove() const { return isExtra() && (_ref & 1) == 0; } + uint32_t extraIdx() const { return (~_ref) >> 1; } }; class RandomizedWriter { public: - virtual - ~RandomizedWriter(void); + virtual~RandomizedWriter(); - virtual void - add(uint32_t wordIdx, index::DocIdAndFeatures &features) = 0; + virtual void add(uint32_t wordIdx, index::DocIdAndFeatures &features) = 0; - virtual void - remove(uint32_t wordIdx, uint32_t docId) = 0; + virtual void remove(uint32_t wordIdx, uint32_t docId) = 0; }; class RandomizedReader @@ -156,10 +120,8 @@ public: std::vector<Randomizer>::const_iterator _re; index::DocIdAndPosOccFeatures _features; public: - RandomizedReader(void); - - void - read(void); + RandomizedReader(); + void read(); void write(RandomizedWriter &writer) @@ -174,11 +136,7 @@ public: } } - bool - isValid(void) const - { - return _valid; - } + bool isValid() const { return _valid; } bool operator<(const RandomizedReader &rhs) const { @@ -189,9 +147,7 @@ public: return _wordIdx < rhs._wordIdx; } - void - setup(const FakeWord *fw, - uint32_t wordIdx); + void setup(const FakeWord *fw, uint32_t wordIdx); }; DocWordFeatureList _postings; @@ -215,8 +171,7 @@ public: uint32_t docIdLimit, uint32_t tempWordDocs); - void - setupRandomizer(search::Rand48 &rnd); + void setupRandomizer(search::Rand48 &rnd); const DocWordFeature & getDocWordFeature(const Randomizer &r) const @@ -283,7 +238,7 @@ public: const PosOccFieldsParams &fieldsParams, uint32_t packedIndex); - ~FakeWord(void); + ~FakeWord(); bool validate(search::queryeval::SearchIterator *iterator, @@ -296,9 +251,7 @@ public: const fef::TermFieldMatchDataArray &matchData, bool verbose) const; - bool - validate(search::queryeval::SearchIterator *iterator, - bool verbose) const; + bool validate(search::queryeval::SearchIterator *iterator, bool verbose) const; bool validate(std::shared_ptr<search::diskindex::FieldReader> &fieldReader, @@ -309,11 +262,8 @@ public: uint32_t checkPointInterval, CheckPointCallback *const checkPointCallback) const; - void - validate(const std::vector<uint32_t> &docIds) const; - - void - validate(const BitVector &bv) const; + void validate(const std::vector<uint32_t> &docIds) const; + void validate(const BitVector &bv) const; bool dump(std::shared_ptr<search::diskindex::FieldWriter> &fieldWriter, @@ -322,31 +272,11 @@ public: uint32_t checkPointInterval, CheckPointCallback *checkPointCallback) const; - const std::string &getName(void) const - { - return _name; - } - - uint32_t - getDocIdLimit(void) const - { - return _docIdLimit; - } - - const PosOccFieldsParams & - getFieldsParams(void) const - { - return _fieldsParams; - } - - uint32_t - getPackedIndex(void) const - { - return _packedIndex; - } - - void - addDocIdBias(uint32_t docIdBias); + const std::string &getName() const { return _name; } + uint32_t getDocIdLimit() const { return _docIdLimit; } + const PosOccFieldsParams &getFieldsParams() const { return _fieldsParams; } + uint32_t getPackedIndex() const { return _packedIndex; } + void addDocIdBias(uint32_t docIdBias); }; } // namespace fakedata |