diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-02-01 10:48:57 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-02-01 10:48:57 +0000 |
commit | 988fdfac3c51423aa4dd360693cfec7c985fcfb5 (patch) | |
tree | 07b0e45294b3504e9bf3ee9b6a9927b055beb4c4 | |
parent | 99516f7e415a6d48f5b33bd6297ed3cff695fda8 (diff) |
Deinline destructors in metrics, fnet, jrt_test logd
-rw-r--r-- | fnet/src/tests/frt/rpc/invoke.cpp | 126 | ||||
-rw-r--r-- | jrt_test/src/tests/rpc-error/test-errors.cpp | 4 | ||||
-rw-r--r-- | logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp | 29 | ||||
-rw-r--r-- | logd/src/tests/watcher/watcher_test.cpp | 18 | ||||
-rw-r--r-- | metrics/src/tests/metricmanagertest.cpp | 29 |
5 files changed, 112 insertions, 94 deletions
diff --git a/fnet/src/tests/frt/rpc/invoke.cpp b/fnet/src/tests/frt/rpc/invoke.cpp index e69513aa980..38f260dd202 100644 --- a/fnet/src/tests/frt/rpc/invoke.cpp +++ b/fnet/src/tests/frt/rpc/invoke.cpp @@ -90,69 +90,11 @@ private: vespalib::Stash _echo_stash; FRT_Values _echo_args; - EchoTest(const EchoTest &); - EchoTest &operator=(const EchoTest &); - public: - EchoTest(FRT_Supervisor *supervisor) - : _echo_stash(), - _echo_args(_echo_stash) - { - FRT_ReflectionBuilder rb(supervisor); - rb.DefineMethod("echo", "*", "*", - FRT_METHOD(EchoTest::RPC_Echo), this); - - FRT_Values *args = &_echo_args; - args->EnsureFree(16); - - args->AddInt8(8); - uint8_t *pt_int8 = args->AddInt8Array(3); - pt_int8[0] = 1; - pt_int8[1] = 2; - pt_int8[2] = 3; - - args->AddInt16(16); - uint16_t *pt_int16 = args->AddInt16Array(3); - pt_int16[0] = 2; - pt_int16[1] = 4; - pt_int16[2] = 6; - - args->AddInt32(32); - uint32_t *pt_int32 = args->AddInt32Array(3); - pt_int32[0] = 4; - pt_int32[1] = 8; - pt_int32[2] = 12; - - args->AddInt64(64); - uint64_t *pt_int64 = args->AddInt64Array(3); - pt_int64[0] = 8; - pt_int64[1] = 16; - pt_int64[2] = 24; - - args->AddFloat(32.5); - float *pt_float = args->AddFloatArray(3); - pt_float[0] = 0.25; - pt_float[1] = 0.5; - pt_float[2] = 0.75; - - args->AddDouble(64.5); - double *pt_double = args->AddDoubleArray(3); - pt_double[0] = 0.1; - pt_double[1] = 0.2; - pt_double[2] = 0.3; - - args->AddString("string"); - FRT_StringValue *pt_string = args->AddStringArray(3); - args->SetString(&pt_string[0], "str1"); - args->SetString(&pt_string[1], "str2"); - args->SetString(&pt_string[2], "str3"); - - args->AddData("data", 4); - FRT_DataValue *pt_data = args->AddDataArray(3); - args->SetData(&pt_data[0], "dat1", 4); - args->SetData(&pt_data[1], "dat2", 4); - args->SetData(&pt_data[2], "dat3", 4); - } + EchoTest(const EchoTest &) = delete; + EchoTest &operator=(const EchoTest &) = delete; + EchoTest(FRT_Supervisor *supervisor); + ~EchoTest() override; bool prepare_params(FRT_RPCRequest &req) { @@ -178,6 +120,66 @@ public: } }; +EchoTest::~EchoTest() = default; + +EchoTest::EchoTest(FRT_Supervisor *supervisor) + : _echo_stash(), + _echo_args(_echo_stash) +{ + FRT_ReflectionBuilder rb(supervisor); + rb.DefineMethod("echo", "*", "*", FRT_METHOD(EchoTest::RPC_Echo), this); + + FRT_Values *args = &_echo_args; + args->EnsureFree(16); + + args->AddInt8(8); + uint8_t *pt_int8 = args->AddInt8Array(3); + pt_int8[0] = 1; + pt_int8[1] = 2; + pt_int8[2] = 3; + + args->AddInt16(16); + uint16_t *pt_int16 = args->AddInt16Array(3); + pt_int16[0] = 2; + pt_int16[1] = 4; + pt_int16[2] = 6; + + args->AddInt32(32); + uint32_t *pt_int32 = args->AddInt32Array(3); + pt_int32[0] = 4; + pt_int32[1] = 8; + pt_int32[2] = 12; + + args->AddInt64(64); + uint64_t *pt_int64 = args->AddInt64Array(3); + pt_int64[0] = 8; + pt_int64[1] = 16; + pt_int64[2] = 24; + + args->AddFloat(32.5); + float *pt_float = args->AddFloatArray(3); + pt_float[0] = 0.25; + pt_float[1] = 0.5; + pt_float[2] = 0.75; + + args->AddDouble(64.5); + double *pt_double = args->AddDoubleArray(3); + pt_double[0] = 0.1; + pt_double[1] = 0.2; + pt_double[2] = 0.3; + + args->AddString("string"); + FRT_StringValue *pt_string = args->AddStringArray(3); + args->SetString(&pt_string[0], "str1"); + args->SetString(&pt_string[1], "str2"); + args->SetString(&pt_string[2], "str3"); + + args->AddData("data", 4); + FRT_DataValue *pt_data = args->AddDataArray(3); + args->SetData(&pt_data[0], "dat1", 4); + args->SetData(&pt_data[1], "dat2", 4); + args->SetData(&pt_data[2], "dat3", 4); +} //------------------------------------------------------------- struct MyAccessFilter : FRT_RequestAccessFilter { diff --git a/jrt_test/src/tests/rpc-error/test-errors.cpp b/jrt_test/src/tests/rpc-error/test-errors.cpp index 86d699e530e..e64c2abfff6 100644 --- a/jrt_test/src/tests/rpc-error/test-errors.cpp +++ b/jrt_test/src/tests/rpc-error/test-errors.cpp @@ -12,6 +12,8 @@ private: FRT_Target *target; public: + TestErrors(); + ~TestErrors() override; void init(const char *spec) { client = & server.supervisor(); target = client->GetTarget(spec); @@ -31,6 +33,8 @@ public: int Main() override; }; +TestErrors::TestErrors() = default; +TestErrors::~TestErrors() = default; void TestErrors::testNoError() diff --git a/logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp b/logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp index f5349face36..6fa56dfe5c4 100644 --- a/logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp +++ b/logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp @@ -42,19 +42,8 @@ struct RpcServer : public FRT_Invokable { bool reply_with_proto_response; public: - RpcServer() - : server(), - request_count(0), - messages(), - reply_with_error(false), - reply_with_proto_response(true) - { - FRT_ReflectionBuilder builder(&server.supervisor()); - builder.DefineMethod("vespa.logserver.archiveLogMessages", "bix", "bix", - FRT_METHOD(RpcServer::rpc_archive_log_messages), this); - server.supervisor().Listen(0); - } - ~RpcServer() = default; + RpcServer(); + ~RpcServer() override; int get_listen_port() { return server.supervisor().GetListenPort(); } @@ -81,6 +70,20 @@ public: } }; +RpcServer::RpcServer() + : server(), + request_count(0), + messages(), + reply_with_error(false), + reply_with_proto_response(true) +{ + FRT_ReflectionBuilder builder(&server.supervisor()); + builder.DefineMethod("vespa.logserver.archiveLogMessages", "bix", "bix", + FRT_METHOD(RpcServer::rpc_archive_log_messages), this); + server.supervisor().Listen(0); +} +RpcServer::~RpcServer() = default; + std::string make_log_line(const std::string& level, const std::string& payload) { diff --git a/logd/src/tests/watcher/watcher_test.cpp b/logd/src/tests/watcher/watcher_test.cpp index 55ba720c0cb..fa8c2ffe932 100644 --- a/logd/src/tests/watcher/watcher_test.cpp +++ b/logd/src/tests/watcher/watcher_test.cpp @@ -61,14 +61,8 @@ struct DummyForwarder : public Forwarder { std::mutex lock; std::condition_variable cond; std::vector<std::string> lines; - DummyForwarder() - : Forwarder(), - lock(), - cond(), - lines() - { - } - ~DummyForwarder() override = default; + DummyForwarder(); + ~DummyForwarder() override; void forwardLine(std::string_view log_line) override { std::lock_guard guard(lock); lines.emplace_back(log_line); @@ -87,6 +81,14 @@ struct DummyForwarder : public Forwarder { } }; +DummyForwarder::DummyForwarder() + : Forwarder(), + lock(), + cond(), + lines() +{ } +DummyForwarder::~DummyForwarder() = default; + struct WatcherFixture { DummyForwarder fwd; diff --git a/metrics/src/tests/metricmanagertest.cpp b/metrics/src/tests/metricmanagertest.cpp index 615baeccf43..604e9c46b80 100644 --- a/metrics/src/tests/metricmanagertest.cpp +++ b/metrics/src/tests/metricmanagertest.cpp @@ -898,13 +898,17 @@ struct NestedDimensionTestMetricSet : MetricSet { DimensionTestMetricSet nestedSet; - NestedDimensionTestMetricSet() - : MetricSet("outer", {{"fancy", "stuff"}}, ""), - nestedSet(this) - { - } + NestedDimensionTestMetricSet(); + ~NestedDimensionTestMetricSet(); }; +NestedDimensionTestMetricSet::NestedDimensionTestMetricSet() + : MetricSet("outer", {{"fancy", "stuff"}}, ""), + nestedSet(this) +{ +} +NestedDimensionTestMetricSet::~NestedDimensionTestMetricSet() = default; + } TEST_F(MetricManagerTest, json_output_can_nest_dimensions_from_multiple_metric_sets) @@ -933,13 +937,16 @@ struct DimensionOverridableTestMetricSet : MetricSet { DoubleValueMetric val; - DimensionOverridableTestMetricSet(const std::string& dimValue, - MetricSet* owner = nullptr) - : MetricSet("temp", {{"foo", dimValue}}, "", owner), - val("val", {}, "val desc", this) - { } + DimensionOverridableTestMetricSet(const std::string& dimValue, MetricSet* owner = nullptr); + ~DimensionOverridableTestMetricSet() override; }; +DimensionOverridableTestMetricSet::DimensionOverridableTestMetricSet(const std::string& dimValue, MetricSet* owner) + : MetricSet("temp", {{"foo", dimValue}}, "", owner), + val("val", {}, "val desc", this) +{ } +DimensionOverridableTestMetricSet::~DimensionOverridableTestMetricSet() = default; + struct SameNamesTestMetricSet : MetricSet { DimensionOverridableTestMetricSet set1; @@ -954,7 +961,7 @@ SameNamesTestMetricSet::SameNamesTestMetricSet() set1("bar", this), set2("baz", this) { } -SameNamesTestMetricSet::~SameNamesTestMetricSet() { } +SameNamesTestMetricSet::~SameNamesTestMetricSet() = default; } |