summaryrefslogtreecommitdiffstats
path: root/searchsummary
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 /searchsummary
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 'searchsummary')
-rw-r--r--searchsummary/src/tests/docsumformat/docsum-pack.cpp15
-rw-r--r--searchsummary/src/tests/docsummary/positionsdfw_test.cpp14
-rw-r--r--searchsummary/src/tests/extractkeywords/extractkeywordstest.cpp19
-rw-r--r--searchsummary/src/tests/extractkeywords/extractkeywordstest.h6
4 files changed, 25 insertions, 29 deletions
diff --git a/searchsummary/src/tests/docsumformat/docsum-pack.cpp b/searchsummary/src/tests/docsumformat/docsum-pack.cpp
index a80c030ef6e..ed1ba23017c 100644
--- a/searchsummary/src/tests/docsumformat/docsum-pack.cpp
+++ b/searchsummary/src/tests/docsumformat/docsum-pack.cpp
@@ -5,7 +5,7 @@
#include <vespa/searchsummary/docsummary/resultconfig.h>
#include <vespa/searchsummary/docsummary/resultpacker.h>
#include <vespa/vespalib/util/size_literals.h>
-#include <vespa/fastos/app.h>
+#include <vespa/vespalib/util/signalhandler.h>
#include <vespa/log/log.h>
LOG_SETUP("docsum-pack");
@@ -15,7 +15,7 @@ using namespace search::docsummary;
void FastS_block_usr2() {}
-class MyApp : public FastOS_Application
+class MyApp
{
private:
bool _rc;
@@ -47,7 +47,7 @@ public:
void TestFailOrder();
void TestBasicInplace();
- int Main() override;
+ int main(int argc, char **argv);
};
MyApp::MyApp()
@@ -337,7 +337,7 @@ MyApp::TestBasicInplace()
}
int
-MyApp::Main()
+MyApp::main(int, char **)
{
_rc = true;
_cnt = 0;
@@ -373,9 +373,8 @@ MyApp::Main()
return (_rc ? 0 : 1);
}
-int
-main(int argc, char **argv)
-{
+int main(int argc, char **argv) {
+ vespalib::SignalHandler::PIPE.ignore();
MyApp myapp;
- return myapp.Entry(argc, argv);
+ return myapp.main(argc, argv);
}
diff --git a/searchsummary/src/tests/docsummary/positionsdfw_test.cpp b/searchsummary/src/tests/docsummary/positionsdfw_test.cpp
index b9469ca2102..11f0d0eb6d6 100644
--- a/searchsummary/src/tests/docsummary/positionsdfw_test.cpp
+++ b/searchsummary/src/tests/docsummary/positionsdfw_test.cpp
@@ -113,7 +113,7 @@ struct MyGetDocsumsStateCallback : GetDocsumsStateCallback {
};
template <typename AttrType>
-void checkWritePositionField(Test &test, AttrType &attr,
+void checkWritePositionField(AttrType &attr,
uint32_t doc_id, const vespalib::string &expect_json) {
for (AttributeVector::DocId i = 0; i < doc_id + 1; ) {
attr.addDoc(i);
@@ -143,16 +143,16 @@ void checkWritePositionField(Test &test, AttrType &attr,
writer->insertField(doc_id, &state, res_type, inserter);
test::SlimeValue expected(expect_json);
- test.EXPECT_EQUAL(expected.slime, target);
+ EXPECT_EQUAL(expected.slime, target);
}
void Test::requireThat2DPositionFieldIsWritten() {
SingleInt64ExtAttribute attr("foo");
- checkWritePositionField(*this, attr, 0x3e, "{x:6,y:7,latlong:'N0.000007;E0.000006'}");
- checkWritePositionField(*this, attr, 007, "{x:-1,y:-1,latlong:'S0.000001;W0.000001'}");
- checkWritePositionField(*this, attr, 0x42, "{x:0,y:-1,latlong:'S0.000001;E0.000000'}");
- checkWritePositionField(*this, attr, 0x17, "{x:-16711935,y:16711935,latlong:'N16.711935;W16.711935'}");
- checkWritePositionField(*this, attr, 42, "null");
+ checkWritePositionField(attr, 0x3e, "{x:6,y:7,latlong:'N0.000007;E0.000006'}");
+ checkWritePositionField(attr, 007, "{x:-1,y:-1,latlong:'S0.000001;W0.000001'}");
+ checkWritePositionField(attr, 0x42, "{x:0,y:-1,latlong:'S0.000001;E0.000000'}");
+ checkWritePositionField(attr, 0x17, "{x:-16711935,y:16711935,latlong:'N16.711935;W16.711935'}");
+ checkWritePositionField(attr, 42, "null");
}
} // namespace
diff --git a/searchsummary/src/tests/extractkeywords/extractkeywordstest.cpp b/searchsummary/src/tests/extractkeywords/extractkeywordstest.cpp
index 42000b3e235..724cf338497 100644
--- a/searchsummary/src/tests/extractkeywords/extractkeywordstest.cpp
+++ b/searchsummary/src/tests/extractkeywords/extractkeywordstest.cpp
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "extractkeywordstest.h"
+#include <vespa/vespalib/util/signalhandler.h>
#include <vespa/searchsummary/docsummary/keywordextractor.h>
#include "simplequerystack.h"
#include <vespa/vespalib/util/size_literals.h>
@@ -9,7 +10,7 @@
#define NUMTESTS 5
int
-ExtractKeywordsTest::Main()
+ExtractKeywordsTest::main(int argc, char **argv)
{
int doTest[NUMTESTS];
int low, high, accnum, num;
@@ -18,18 +19,18 @@ ExtractKeywordsTest::Main()
int multiplier = 1;
bool failed = false;
- if (_argc == 1)
- return Usage(_argv[0]);
+ if (argc == 1)
+ return Usage(argv[0]);
// default initialize to not run any tests.
for (int n = 0; n < NUMTESTS; n++)
doTest[n] = 0;
// parse the command line arguments
- for (int i = 1; i < _argc; i++) {
+ for (int i = 1; i < argc; i++) {
low = 0;
high = NUMTESTS - 1;
- char *p = _argv[i];
+ char *p = argv[i];
// Check if a multiplier is specified
if (*p == '*') {
@@ -287,10 +288,8 @@ ExtractKeywordsTest::Usage(char *progname)
return EXIT_FAILURE;
}
-int
-main(int argc, char** argv)
-{
+int main(int argc, char** argv) {
+ vespalib::SignalHandler::PIPE.ignore();
ExtractKeywordsTest tester;
- return tester.Entry(argc, argv);
+ return tester.main(argc, argv);
}
-
diff --git a/searchsummary/src/tests/extractkeywords/extractkeywordstest.h b/searchsummary/src/tests/extractkeywords/extractkeywordstest.h
index 2e07717821a..6bd07d8a111 100644
--- a/searchsummary/src/tests/extractkeywords/extractkeywordstest.h
+++ b/searchsummary/src/tests/extractkeywords/extractkeywordstest.h
@@ -2,11 +2,9 @@
#pragma once
-#include <vespa/fastos/app.h>
-
namespace search::docsummary { class KeywordExtractor; }
-class ExtractKeywordsTest : public FastOS_Application
+class ExtractKeywordsTest
{
private:
ExtractKeywordsTest(const ExtractKeywordsTest &);
@@ -14,7 +12,6 @@ private:
search::docsummary::KeywordExtractor *_extractor;
- int Main() override;
int Usage(char *progname);
bool ShowResult(int testNo, const char *actual, const char *correct);
bool RunTest(int i, bool verify);
@@ -23,5 +20,6 @@ public:
ExtractKeywordsTest()
: _extractor(nullptr)
{}
+ int main(int argc, char **argv);
};