diff options
author | Håvard Pettersen <havardpe@oath.com> | 2022-04-06 12:18:08 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2022-04-08 13:45:13 +0000 |
commit | 9fbcf76d088740aacf535e6482f86c833cfae871 (patch) | |
tree | c62dcd0f9cdcee9876b37c60f741958c14147f80 /juniper | |
parent | 69454cef2fe53694eb5541e5f622a4e973c081bf (diff) |
remove FastOS_Application
fixup (per application):
- maybe ignore SIGPIPE
- wire argc/argv
untangle Vespa Test Framework
strip down deprecated TestApp
Diffstat (limited to 'juniper')
-rw-r--r-- | juniper/src/test/SrcTestSuite.cpp | 17 | ||||
-rw-r--r-- | juniper/src/test/auxTestApp.cpp | 17 | ||||
-rw-r--r-- | juniper/src/test/matchobjectTestApp.cpp | 25 | ||||
-rw-r--r-- | juniper/src/test/mcandTestApp.cpp | 25 | ||||
-rw-r--r-- | juniper/src/test/queryparserTestApp.cpp | 24 | ||||
-rw-r--r-- | juniper/src/test/testenv.cpp | 10 | ||||
-rw-r--r-- | juniper/src/test/testenv.h | 3 |
7 files changed, 32 insertions, 89 deletions
diff --git a/juniper/src/test/SrcTestSuite.cpp b/juniper/src/test/SrcTestSuite.cpp index c26e73341d5..1fcaa6e29de 100644 --- a/juniper/src/test/SrcTestSuite.cpp +++ b/juniper/src/test/SrcTestSuite.cpp @@ -28,24 +28,11 @@ SrcTestSuite::SrcTestSuite() : AddTest(new AuxTest()); } -/** - * The SrcTestSuiteApp class holds the main body for running the - * SrcTestSuite class. - * - * @author Knut Omang - */ -class SrcTestSuiteApp : public vespalib::TestApp { -public: - int Main() override; -}; - -int SrcTestSuiteApp::Main() { - juniper::TestEnv te(this, TEST_PATH("../rpclient/testclient.rc").c_str()); +int main(int argc, char **argv) { + juniper::TestEnv te(argc, argv, TEST_PATH("../rpclient/testclient.rc").c_str()); SrcTestSuite suite; suite.Run(); long failures = suite.Report(); suite.Free(); return (int)failures; } - -FASTOS_MAIN(SrcTestSuiteApp); diff --git a/juniper/src/test/auxTestApp.cpp b/juniper/src/test/auxTestApp.cpp index ff942dc19f7..1c85796bb1f 100644 --- a/juniper/src/test/auxTestApp.cpp +++ b/juniper/src/test/auxTestApp.cpp @@ -2,27 +2,16 @@ #include "auxTest.h" #include <vespa/vespalib/testkit/testapp.h> -class AuxTestApp : public vespalib::TestApp -{ -public: - int Main() override; -}; - - - void Usage(char* s) { fprintf(stderr, "Usage: %s [-d debug_level]\n", s); } -int AuxTestApp::Main() -{ - juniper::TestEnv te(this, TEST_PATH("../rpclient/testclient.rc").c_str()); +int main(int argc, char **argv) { + juniper::TestEnv te(argc, argv, TEST_PATH("../rpclient/testclient.rc").c_str()); AuxTest pta; pta.SetStream(&std::cout); - pta.Run(_argc, _argv); + pta.Run(argc, argv); return pta.Report(); } - -FASTOS_MAIN(AuxTestApp); diff --git a/juniper/src/test/matchobjectTestApp.cpp b/juniper/src/test/matchobjectTestApp.cpp index 6a595e07983..7fae5b4c0de 100644 --- a/juniper/src/test/matchobjectTestApp.cpp +++ b/juniper/src/test/matchobjectTestApp.cpp @@ -4,21 +4,10 @@ #include "testenv.h" #include <vespa/vespalib/testkit/testapp.h> -/** - * The MatchObjectTestApp class is the main routine for running the unit - * tests for the MatchObject class in isolation. - * - * @sa MatchObject @author Knut Omang - */ -class MatchObjectTestApp : public vespalib::TestApp { -public: - int Main() override { - juniper::TestEnv te(this, TEST_PATH("../rpclient/testclient.rc").c_str()); - MatchObjectTest test; - test.SetStream(&std::cout); - test.Run(_argc, _argv); - return (int)test.Report(); - } -}; - -FASTOS_MAIN(MatchObjectTestApp); +int main(int argc, char **argv) { + juniper::TestEnv te(argc, argv, TEST_PATH("../rpclient/testclient.rc").c_str()); + MatchObjectTest test; + test.SetStream(&std::cout); + test.Run(argc, argv); + return (int)test.Report(); +} diff --git a/juniper/src/test/mcandTestApp.cpp b/juniper/src/test/mcandTestApp.cpp index 32d2a2e0b92..825dc61da06 100644 --- a/juniper/src/test/mcandTestApp.cpp +++ b/juniper/src/test/mcandTestApp.cpp @@ -3,21 +3,10 @@ #include "mcandTest.h" #include <vespa/vespalib/testkit/testapp.h> -/** - * The MatchCandidateTestApp class is the main routine for running the unit - * tests for the MatchCandidate class in isolation. - * - * @sa MatchCandidate @author Knut Omang - */ -class MatchCandidateTestApp : public vespalib::TestApp { -public: - int Main() override { - juniper::TestEnv te(this, TEST_PATH("../rpclient/testclient.rc").c_str()); - MatchCandidateTest test; - test.SetStream(&std::cout); - test.Run(_argc, _argv); - return (int)test.Report(); - } -}; - -FASTOS_MAIN(MatchCandidateTestApp); +int main(int argc, char **argv) { + juniper::TestEnv te(argc, argv, TEST_PATH("../rpclient/testclient.rc").c_str()); + MatchCandidateTest test; + test.SetStream(&std::cout); + test.Run(argc, argv); + return (int)test.Report(); +} diff --git a/juniper/src/test/queryparserTestApp.cpp b/juniper/src/test/queryparserTestApp.cpp index be0b505ac4f..a2c551a4730 100644 --- a/juniper/src/test/queryparserTestApp.cpp +++ b/juniper/src/test/queryparserTestApp.cpp @@ -4,21 +4,11 @@ #include "testenv.h" #include <vespa/vespalib/testkit/testapp.h> -/** - * The QueryParserTestApp class is the main routine for running the unit - * tests for the QueryParser class in isolation. - * - * @sa QueryParser @author Knut Omang - */ -class QueryParserTestApp : public vespalib::TestApp { -public: - int Main() override { - juniper::TestEnv te(this, TEST_PATH("../rpclient/testclient.rc").c_str()); - QueryParserTest test; - test.SetStream(&std::cout); - test.Run(_argc, _argv); - return (int)test.Report(); - } -}; -FASTOS_MAIN(QueryParserTestApp); +int main(int argc, char **argv) { + juniper::TestEnv te(argc, argv, TEST_PATH("../rpclient/testclient.rc").c_str()); + QueryParserTest test; + test.SetStream(&std::cout); + test.Run(argc, argv); + return (int)test.Report(); +} diff --git a/juniper/src/test/testenv.cpp b/juniper/src/test/testenv.cpp index 2dec01ffe3e..769c24b829c 100644 --- a/juniper/src/test/testenv.cpp +++ b/juniper/src/test/testenv.cpp @@ -16,12 +16,12 @@ Config* TestConfig; Juniper * _Juniper; -TestEnv::TestEnv(FastOS_Application* app, const char* propfile) : +TestEnv::TestEnv(int argc, char **argv, const char* propfile) : _props(), _config(), _juniper(), _wordFolder() { int c; - while ((c = getopt(app->_argc, app->_argv, "d:hcm:")) != EOF) + while ((c = getopt(argc, argv, "d:hcm:")) != EOF) { switch (c) { @@ -40,16 +40,16 @@ TestEnv::TestEnv(FastOS_Application* app, const char* propfile) : break; case 'h': default: - Usage(app->_argv[0]); + Usage(argv[0]); return; } } int expected_args = 0; - if (app->_argc - optind < expected_args) + if (argc - optind < expected_args) { - Usage(app->_argv[0]); + Usage(argv[0]); return; } diff --git a/juniper/src/test/testenv.h b/juniper/src/test/testenv.h index 4435b9157d1..a43f4a11bec 100644 --- a/juniper/src/test/testenv.h +++ b/juniper/src/test/testenv.h @@ -20,7 +20,6 @@ #include <vespa/juniper/mcand.h> #include <vespa/juniper/propreader.h> #include <vespa/juniper/specialtokenregistry.h> -#include <vespa/fastos/app.h> namespace juniper { @@ -28,7 +27,7 @@ namespace juniper class TestEnv { public: - TestEnv(FastOS_Application* app, const char* propfile); + TestEnv(int argc, char **argv, const char* propfile); virtual ~TestEnv(); void Usage(char* s); private: |