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 /messagebus_test | |
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 'messagebus_test')
-rw-r--r-- | messagebus_test/src/tests/error/cpp-client.cpp | 11 | ||||
-rw-r--r-- | messagebus_test/src/tests/error/cpp-server.cpp | 18 | ||||
-rw-r--r-- | messagebus_test/src/tests/errorcodes/dumpcodes.cpp | 11 | ||||
-rw-r--r-- | messagebus_test/src/tests/speed/cpp-client.cpp | 11 | ||||
-rw-r--r-- | messagebus_test/src/tests/speed/cpp-server.cpp | 18 | ||||
-rw-r--r-- | messagebus_test/src/tests/trace/cpp-server.cpp | 19 |
6 files changed, 34 insertions, 54 deletions
diff --git a/messagebus_test/src/tests/error/cpp-client.cpp b/messagebus_test/src/tests/error/cpp-client.cpp index 365032536cc..f9ab29efc20 100644 --- a/messagebus_test/src/tests/error/cpp-client.cpp +++ b/messagebus_test/src/tests/error/cpp-client.cpp @@ -8,19 +8,19 @@ #include <vespa/messagebus/network/rpcnetworkparams.h> #include <vespa/messagebus/testlib/receptor.h> #include <thread> -#include <vespa/fastos/app.h> +#include <vespa/vespalib/util/signalhandler.h> using namespace mbus; using namespace std::chrono_literals; -class App : public FastOS_Application +class App { public: - int Main() override; + int main(int argc, char **argv); }; int -App::Main() +App::main(int, char **) { RPCMessageBus mb(ProtocolSet().add(std::make_shared<SimpleProtocol>()), RPCNetworkParams(config::ConfigUri("file:slobrok.cfg")) @@ -65,6 +65,7 @@ App::Main() } int main(int argc, char **argv) { + vespalib::SignalHandler::PIPE.ignore(); App app; - return app.Entry(argc, argv); + return app.main(argc, argv); } diff --git a/messagebus_test/src/tests/error/cpp-server.cpp b/messagebus_test/src/tests/error/cpp-server.cpp index e6be163a366..cbf07bd5f20 100644 --- a/messagebus_test/src/tests/error/cpp-server.cpp +++ b/messagebus_test/src/tests/error/cpp-server.cpp @@ -8,7 +8,7 @@ #include <vespa/messagebus/errorcode.h> #include <vespa/vespalib/util/time.h> #include <thread> -#include <vespa/fastos/app.h> +#include <vespa/vespalib/util/signalhandler.h> using namespace mbus; @@ -42,15 +42,8 @@ Server::handleMessage(Message::UP msg) { _session->reply(std::move(reply)); } -class App : public FastOS_Application -{ -public: - int Main() override; -}; - -int -App::Main() -{ +int main(int, char **) { + vespalib::SignalHandler::PIPE.ignore(); RPCMessageBus mb(ProtocolSet().add(std::make_shared<SimpleProtocol>()), RPCNetworkParams(config::ConfigUri("file:slobrok.cfg")) .setIdentity(Identity("server/cpp")), @@ -61,8 +54,3 @@ App::Main() } return 0; } - -int main(int argc, char **argv) { - App app; - return app.Entry(argc, argv); -} diff --git a/messagebus_test/src/tests/errorcodes/dumpcodes.cpp b/messagebus_test/src/tests/errorcodes/dumpcodes.cpp index 3aef46dbb4c..102262d97bf 100644 --- a/messagebus_test/src/tests/errorcodes/dumpcodes.cpp +++ b/messagebus_test/src/tests/errorcodes/dumpcodes.cpp @@ -1,15 +1,15 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/messagebus/errorcode.h> -#include <vespa/fastos/app.h> +#include <vespa/vespalib/util/signalhandler.h> using namespace mbus; -class App : public FastOS_Application +class App { public: void dump(const std::string &desc, uint32_t value); - int Main() override; + int main(int argc, char **argv); }; void @@ -20,7 +20,7 @@ App::dump(const std::string &desc, uint32_t value) } int -App::Main() +App::main(int, char **) { dump("NONE", ErrorCode::NONE); @@ -62,6 +62,7 @@ App::Main() } int main(int argc, char **argv) { + vespalib::SignalHandler::PIPE.ignore(); App app; - return app.Entry(argc, argv); + return app.main(argc, argv); } diff --git a/messagebus_test/src/tests/speed/cpp-client.cpp b/messagebus_test/src/tests/speed/cpp-client.cpp index d8ba5d85169..bfd2faf735e 100644 --- a/messagebus_test/src/tests/speed/cpp-client.cpp +++ b/messagebus_test/src/tests/speed/cpp-client.cpp @@ -9,7 +9,7 @@ #include <vespa/messagebus/testlib/simplereply.h> #include <vespa/vespalib/util/time.h> #include <thread> -#include <vespa/fastos/app.h> +#include <vespa/vespalib/util/signalhandler.h> using namespace mbus; using namespace std::chrono_literals; @@ -84,14 +84,14 @@ Client::handleReply(Reply::UP reply) { send(); } -class App : public FastOS_Application +class App { public: - int Main() override; + int main(int argc, char **argv); }; int -App::Main() +App::main(int, char **) { auto retryPolicy = std::make_shared<RetryTransientErrorsPolicy>(); retryPolicy->setBaseDelay(0.1); @@ -133,10 +133,11 @@ App::Main() } int main(int argc, char **argv) { + vespalib::SignalHandler::PIPE.ignore(); fprintf(stderr, "started '%s'\n", argv[0]); fflush(stderr); App app; - int r = app.Entry(argc, argv); + int r = app.main(argc, argv); fprintf(stderr, "stopping '%s'\n", argv[0]); fflush(stderr); return r; diff --git a/messagebus_test/src/tests/speed/cpp-server.cpp b/messagebus_test/src/tests/speed/cpp-server.cpp index 20a72596182..aee6c5ed96d 100644 --- a/messagebus_test/src/tests/speed/cpp-server.cpp +++ b/messagebus_test/src/tests/speed/cpp-server.cpp @@ -8,7 +8,7 @@ #include <vespa/messagebus/network/rpcnetworkparams.h> #include <vespa/vespalib/util/time.h> #include <thread> -#include <vespa/fastos/app.h> +#include <vespa/vespalib/util/signalhandler.h> using namespace mbus; @@ -49,15 +49,8 @@ Server::handleMessage(Message::UP msg) { } } -class App : public FastOS_Application -{ -public: - int Main() override; -}; - -int -App::Main() -{ +int main(int, char **) { + vespalib::SignalHandler::PIPE.ignore(); RPCMessageBus mb(ProtocolSet().add(std::make_shared<SimpleProtocol>()), RPCNetworkParams(config::ConfigUri("file:slobrok.cfg")) .setIdentity(Identity("server/cpp")), @@ -68,8 +61,3 @@ App::Main() } return 0; } - -int main(int argc, char **argv) { - App app; - return app.Entry(argc, argv); -} diff --git a/messagebus_test/src/tests/trace/cpp-server.cpp b/messagebus_test/src/tests/trace/cpp-server.cpp index b8b20e8e621..f151286edf0 100644 --- a/messagebus_test/src/tests/trace/cpp-server.cpp +++ b/messagebus_test/src/tests/trace/cpp-server.cpp @@ -7,7 +7,7 @@ #include <vespa/messagebus/emptyreply.h> #include <vespa/vespalib/util/time.h> #include <thread> -#include <vespa/fastos/app.h> +#include <vespa/vespalib/util/signalhandler.h> using namespace mbus; @@ -56,24 +56,24 @@ Server::handleReply(Reply::UP reply) { _session->forward(std::move(reply)); } -class App : public FastOS_Application +class App { public: - int Main() override; + int main(int argc, char **argv); }; int -App::Main() +App::main(int argc, char **argv) { - if (_argc != 2) { - fprintf(stderr, "usage: %s <service-prefix>\n", _argv[0]); + if (argc != 2) { + fprintf(stderr, "usage: %s <service-prefix>\n", argv[0]); return 1; } RPCMessageBus mb(ProtocolSet().add(std::make_shared<SimpleProtocol>()), RPCNetworkParams(config::ConfigUri("file:slobrok.cfg")) - .setIdentity(Identity(_argv[1])), + .setIdentity(Identity(argv[1])), config::ConfigUri("file:routing.cfg")); - Server server(mb.getMessageBus(), _argv[1]); + Server server(mb.getMessageBus(), argv[1]); while (true) { std::this_thread::sleep_for(1s); } @@ -81,6 +81,7 @@ App::Main() } int main(int argc, char **argv) { + vespalib::SignalHandler::PIPE.ignore(); App app; - return app.Entry(argc, argv); + return app.main(argc, argv); } |