aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@oath.com>2022-04-06 12:18:08 +0000
committerHåvard Pettersen <havardpe@oath.com>2022-04-08 13:45:13 +0000
commit9fbcf76d088740aacf535e6482f86c833cfae871 (patch)
treec62dcd0f9cdcee9876b37c60f741958c14147f80 /searchlib/src/tests
parent69454cef2fe53694eb5541e5f622a4e973c081bf (diff)
remove FastOS_Application
fixup (per application): - maybe ignore SIGPIPE - wire argc/argv untangle Vespa Test Framework strip down deprecated TestApp
Diffstat (limited to 'searchlib/src/tests')
-rw-r--r--searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp20
-rw-r--r--searchlib/src/tests/bitvector/bitvectorbenchmark.cpp18
-rw-r--r--searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp20
-rw-r--r--searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp28
-rw-r--r--searchlib/src/tests/postinglistbm/postinglistbm.cpp17
-rw-r--r--searchlib/src/tests/transactionlogstress/translogstress.cpp18
6 files changed, 62 insertions, 59 deletions
diff --git a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp
index 4a690a28cc8..abdcd27b09a 100644
--- a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp
+++ b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp
@@ -5,7 +5,7 @@
#include <vespa/searchlib/attribute/attributeguard.h>
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/fastos/thread.h>
-#include <vespa/fastos/app.h>
+#include <vespa/vespalib/util/signalhandler.h>
#include <iostream>
#include <fstream>
#include "attributesearcher.h"
@@ -29,7 +29,7 @@ namespace search {
using AttributePtr = AttributeVector::SP;
using DocId = AttributeVector::DocId;
-class AttributeBenchmark : public FastOS_Application
+class AttributeBenchmark
{
private:
class Config {
@@ -135,7 +135,7 @@ public:
delete _threadPool;
}
}
- int Main() override;
+ int main(int argc, char **argv);
};
@@ -460,7 +460,7 @@ AttributeBenchmark::usage()
}
int
-AttributeBenchmark::Main()
+AttributeBenchmark::main(int argc, char **argv)
{
Config dc;
dc._numDocs = 50000;
@@ -488,7 +488,7 @@ AttributeBenchmark::Main()
int opt;
bool optError = false;
- while ((opt = getopt(_argc, _argv, "n:u:v:s:q:p:r:c:l:h:i:a:e:S:E:D:L:bRPtw")) != -1) {
+ while ((opt = getopt(argc, argv, "n:u:v:s:q:p:r:c:l:h:i:a:e:S:E:D:L:bRPtw")) != -1) {
switch (opt) {
case 'n':
dc._numDocs = atoi(optarg);
@@ -562,12 +562,12 @@ AttributeBenchmark::Main()
}
}
- if (_argc != (optind + 1) || optError) {
+ if (argc != (optind + 1) || optError) {
usage();
return -1;
}
- dc._attribute = vespalib::string(_argv[optind]);
+ dc._attribute = vespalib::string(argv[optind]);
_threadPool = new FastOS_ThreadPool(256000);
@@ -662,9 +662,9 @@ AttributeBenchmark::Main()
}
}
-int main(int argc, char ** argv)
-{
+int main(int argc, char **argv) {
+ vespalib::SignalHandler::PIPE.ignore();
search::AttributeBenchmark myapp;
- return myapp.Entry(argc, argv);
+ return myapp.main(argc, argv);
}
diff --git a/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp b/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp
index e140814a5ad..26b0ccff656 100644
--- a/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp
+++ b/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp
@@ -1,7 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/log/log.h>
#include <vespa/searchlib/common/bitvector.h>
-#include <vespa/fastos/app.h>
+#include <vespa/vespalib/util/signalhandler.h>
#include <iostream>
#include <string>
#include <vector>
@@ -12,7 +12,7 @@ LOG_SETUP("bitvectorbenchmark");
namespace search {
-class BitVectorBenchmark : public FastOS_Application
+class BitVectorBenchmark
{
private:
std::vector<BitVector *> _bv;
@@ -27,7 +27,7 @@ private:
public:
BitVectorBenchmark();
~BitVectorBenchmark();
- int Main() override;
+ int main(int argc, char **argv);
};
BitVectorBenchmark::BitVectorBenchmark() :
@@ -164,13 +164,13 @@ void BitVectorBenchmark::testOrSpeed2()
}
}
-int BitVectorBenchmark::Main()
+int BitVectorBenchmark::main(int argc, char **argv)
{
std::string operation;
size_t numBits(8*1000000);
int opt;
bool optError = false;
- while ((opt = getopt(_argc, _argv, "n:t:")) != -1) {
+ while ((opt = getopt(argc, argv, "n:t:")) != -1) {
switch (opt) {
case 'n':
numBits = strtoll(optarg, NULL, 10);
@@ -184,7 +184,7 @@ int BitVectorBenchmark::Main()
}
}
- if ((_argc != optind ) || optError) {
+ if ((argc != optind ) || optError) {
usage();
return -1;
}
@@ -217,9 +217,9 @@ int BitVectorBenchmark::Main()
}
}
-int main(int argc, char ** argv)
-{
+int main(int argc, char ** argv) {
+ vespalib::SignalHandler::PIPE.ignore();
search::BitVectorBenchmark myapp;
- return myapp.Entry(argc, argv);
+ return myapp.main(argc, argv);
}
diff --git a/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp b/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp
index aa5f9a13e7d..47725d7306d 100644
--- a/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp
+++ b/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp
@@ -20,7 +20,7 @@
#include <vespa/vespalib/util/time.h>
#include <openssl/evp.h>
#include <vespa/fastos/file.h>
-#include <vespa/fastos/app.h>
+#include <vespa/vespalib/util/signalhandler.h>
#include <unistd.h>
#include <vespa/log/log.h>
LOG_SETUP("fieldwriter_test");
@@ -104,7 +104,7 @@ makeWordString(uint64_t wordNum)
}
-class FieldWriterTest : public FastOS_Application
+class FieldWriterTest
{
private:
bool _verbose;
@@ -122,7 +122,7 @@ private:
public:
FieldWriterTest();
~FieldWriterTest();
- int Main() override;
+ int main(int argc, char **argv);
};
@@ -664,15 +664,15 @@ testFieldWriterVariantsWithHighLids(FakeWordSet &wordSet, uint32_t docIdLimit,
}
int
-FieldWriterTest::Main()
+FieldWriterTest::main(int argc, char **argv)
{
int c;
- if (_argc > 0) {
- DummyFileHeaderContext::setCreator(_argv[0]);
+ if (argc > 0) {
+ DummyFileHeaderContext::setCreator(argv[0]);
}
- while ((c = getopt(_argc, _argv, "c:d:vw:")) != -1) {
+ while ((c = getopt(argc, argv, "c:d:vw:")) != -1) {
switch(c) {
case 'c':
_commonDocFreq = atoi(optarg);
@@ -718,11 +718,11 @@ FieldWriterTest::Main()
} // namespace fieldwriter
int
-main(int argc, char **argv)
-{
+main(int argc, char **argv) {
+ vespalib::SignalHandler::PIPE.ignore();
fieldwriter::FieldWriterTest app;
setvbuf(stdout, nullptr, _IOLBF, 32_Ki);
app._rnd.srand48(32);
- return app.Entry(argc, argv);
+ return app.main(argc, argv);
}
diff --git a/searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp b/searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp
index 05fdf4b70f9..f1729f21f39 100644
--- a/searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp
+++ b/searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp
@@ -14,7 +14,7 @@
#include <vespa/searchlib/diskindex/pagedict4file.h>
#include <vespa/searchlib/diskindex/pagedict4randread.h>
#include <vespa/searchlib/common/tunefileinfo.h>
-#include <vespa/fastos/app.h>
+#include <vespa/vespalib/util/signalhandler.h>
#include <sstream>
#include <vespa/log/log.h>
@@ -51,7 +51,7 @@ using Writer = search::diskindex::test::PageDict4MemWriter;
using SeqReader = search::diskindex::test::PageDict4MemSeqReader;
using RandReader = search::diskindex::test::PageDict4MemRandReader;
-class PageDict4TestApp : public FastOS_Application
+class PageDict4TestApp
{
public:
vespalib::Rand48 _rnd;
@@ -61,7 +61,7 @@ public:
bool _lastWordForcedCommon;
void usage();
- int Main() override;
+ int main(int argc, char **argv);
void testWords();
PageDict4TestApp()
: _rnd(),
@@ -83,20 +83,20 @@ PageDict4TestApp::usage()
int
-PageDict4TestApp::Main()
+PageDict4TestApp::main(int argc, char **argv)
{
- if (_argc > 0) {
- DummyFileHeaderContext::setCreator(_argv[0]);
+ if (argc > 0) {
+ DummyFileHeaderContext::setCreator(argv[0]);
}
_rnd.srand48(32);
- for (int32_t i = 1; i < _argc; ++i) {
- if (strcmp(_argv[i], "stress") == 0)
+ for (int32_t i = 1; i < argc; ++i) {
+ if (strcmp(argv[i], "stress") == 0)
_stress = true;
- if (strcmp(_argv[i], "emptyword") == 0)
+ if (strcmp(argv[i], "emptyword") == 0)
_emptyWord = true;
- if (strcmp(_argv[i], "firstwordforcedcommon") == 0)
+ if (strcmp(argv[i], "firstwordforcedcommon") == 0)
_firstWordForcedCommon = true;
- if (strcmp(_argv[i], "lastwordforcedcommon") == 0)
+ if (strcmp(argv[i], "lastwordforcedcommon") == 0)
_lastWordForcedCommon = true;
}
testWords();
@@ -690,4 +690,8 @@ PageDict4TestApp::testWords()
#endif
}
-FASTOS_MAIN(PageDict4TestApp);
+int main(int argc, char **argv) {
+ vespalib::SignalHandler::PIPE.ignore();
+ PageDict4TestApp app;
+ return app.main(argc, argv);
+}
diff --git a/searchlib/src/tests/postinglistbm/postinglistbm.cpp b/searchlib/src/tests/postinglistbm/postinglistbm.cpp
index d0552958611..6155ef88ef3 100644
--- a/searchlib/src/tests/postinglistbm/postinglistbm.cpp
+++ b/searchlib/src/tests/postinglistbm/postinglistbm.cpp
@@ -1,7 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "stress_runner.h"
-#include <vespa/fastos/app.h>
+#include <vespa/vespalib/util/signalhandler.h>
#include <vespa/searchlib/common/bitvector.h>
#include <vespa/searchlib/common/resultset.h>
#include <vespa/searchlib/index/docidandfeatures.h>
@@ -28,7 +28,7 @@ using namespace search::fakedata;
namespace postinglistbm {
-class PostingListBM : public FastOS_Application {
+class PostingListBM {
private:
uint32_t _numDocs;
uint32_t _commonDocFreq;
@@ -49,7 +49,7 @@ public:
public:
PostingListBM();
~PostingListBM();
- int Main() override;
+ int main(int argc, char **argv);
};
void
@@ -108,14 +108,14 @@ PostingListBM::PostingListBM()
PostingListBM::~PostingListBM() = default;
int
-PostingListBM::Main()
+PostingListBM::main(int argc, char **argv)
{
int c;
bool hasElements = false;
bool hasElementWeights = false;
- while ((c = getopt(_argc, _argv, "C:c:m:r:d:l:s:t:o:uw:T:q")) != -1) {
+ while ((c = getopt(argc, argv, "C:c:m:r:d:l:s:t:o:uw:T:q")) != -1) {
switch(c) {
case 'C':
_skipCommonPairsRate = atoi(optarg);
@@ -226,12 +226,11 @@ PostingListBM::Main()
}
-int
-main(int argc, char **argv)
-{
+int main(int argc, char **argv) {
+ vespalib::SignalHandler::PIPE.ignore();
postinglistbm::PostingListBM app;
setvbuf(stdout, nullptr, _IOLBF, 32_Ki);
app._rnd.srand48(32);
- return app.Entry(argc, argv);
+ return app.main(argc, argv);
}
diff --git a/searchlib/src/tests/transactionlogstress/translogstress.cpp b/searchlib/src/tests/transactionlogstress/translogstress.cpp
index cfd2138f2e8..9988f3e171a 100644
--- a/searchlib/src/tests/transactionlogstress/translogstress.cpp
+++ b/searchlib/src/tests/transactionlogstress/translogstress.cpp
@@ -8,7 +8,7 @@
#include <vespa/searchlib/util/runnable.h>
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/fnet/transport.h>
-#include <vespa/fastos/app.h>
+#include <vespa/vespalib/util/signalhandler.h>
#include <iostream>
#include <sstream>
#include <thread>
@@ -563,7 +563,7 @@ ControllerThread::doRun()
//-----------------------------------------------------------------------------
// TransLogStress
//-----------------------------------------------------------------------------
-class TransLogStress : public FastOS_Application
+class TransLogStress
{
private:
class Config {
@@ -593,7 +593,7 @@ private:
void usage();
public:
- int Main() override;
+ int main(int argc, char **argv);
};
void
@@ -623,7 +623,7 @@ TransLogStress::usage()
}
int
-TransLogStress::Main()
+TransLogStress::main(int argc, char **argv)
{
std::string tlsSpec("tcp/localhost:17897");
std::string domain("translogstress");
@@ -645,7 +645,7 @@ TransLogStress::Main()
int opt;
bool optError = false;
- while ((opt = getopt(_argc, _argv, "d:p:t:f:s:v:c:e:g:i:a:b:h")) != -1) {
+ while ((opt = getopt(argc, argv, "d:p:t:f:s:v:c:e:g:i:a:b:h")) != -1) {
switch (opt) {
case 'd':
_cfg.domainPartSize = atol(optarg);
@@ -692,7 +692,7 @@ TransLogStress::Main()
printConfig();
std::this_thread::sleep_for(sleepTime);
- if (_argc != optind || optError) {
+ if (argc != optind || optError) {
usage();
return -1;
}
@@ -758,8 +758,8 @@ TransLogStress::Main()
}
-int main(int argc, char ** argv)
-{
+int main(int argc, char **argv) {
+ vespalib::SignalHandler::PIPE.ignore();
search::transactionlog::TransLogStress myApp;
- return myApp.Entry(argc, argv);
+ return myApp.main(argc, argv);
}