mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2026-11-25 13:11:36 +00:00
test: parameterize the protocol, poller and transfer tests by transport
- Add test::TransportParam with the transport, the expanded shm metadata flag and a name generator for INSTANTIATE_TEST_SUITE_P() - Turn the per-transport TEST() copies into TEST_P() suites; the poller and transfer tests now also run with the expanded shm metadata - Name the multipart suite PushPullMultipart (it shared PushPull) - Discover the tests with NO_PRETTY_VALUES, so the ctest names are Suite.Case/transport - The test names change, e.g. Pair.SingleMsg_MultiThreaded_ipc_shmem is now Pair.SingleMsg_MultiThreaded_ipc/shmem Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <helper/Devices.h>
|
||||
#include <helper/Transport.h>
|
||||
#include <helper/TransportParam.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -19,33 +20,23 @@ namespace
|
||||
using namespace std;
|
||||
using namespace fair::mq::test;
|
||||
|
||||
auto RunPair(string const& transport, string const& extraArgs) -> void
|
||||
using Pair = TransportTest;
|
||||
|
||||
TEST_P(Pair, SingleMsg_MultiThreaded_ipc)
|
||||
{
|
||||
auto const& transport = GetParam().transport;
|
||||
IpcAddress const address("pair");
|
||||
|
||||
auto const results = RunDevices({
|
||||
{"pairleft_" + transport, "name=data,type=pair,method=bind,address=" + address.str()},
|
||||
{"pairright_" + transport, "name=data,type=pair,method=connect,address=" + address.str()},
|
||||
}, RunOptions(transport, extraArgs));
|
||||
}, RunOptions(transport, GetParam().DeviceArgs()));
|
||||
|
||||
for (auto const& result : results) {
|
||||
EXPECT_TRUE(Succeeded(result, transport));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Pair, SingleMsg_MultiThreaded_ipc_zeromq)
|
||||
{
|
||||
RunPair("zeromq", "");
|
||||
}
|
||||
|
||||
TEST(Pair, SingleMsg_MultiThreaded_ipc_shmem)
|
||||
{
|
||||
RunPair("shmem", "");
|
||||
}
|
||||
|
||||
TEST(Pair, SingleMsg_MultiThreaded_ipc_shmem_expanded_metadata)
|
||||
{
|
||||
RunPair("shmem", "--shm-metadata-msg-size 2048");
|
||||
}
|
||||
INSTANTIATE_TEST_SUITE_P(, Pair, AllTransports(), TransportParamName());
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <helper/Devices.h>
|
||||
#include <helper/Transport.h>
|
||||
#include <helper/TransportParam.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -19,8 +20,11 @@ namespace
|
||||
using namespace std;
|
||||
using namespace fair::mq::test;
|
||||
|
||||
auto RunPubSub(string const& transport) -> void
|
||||
using PubSub = TransportTest;
|
||||
|
||||
TEST_P(PubSub, MultiThreaded_ipc)
|
||||
{
|
||||
auto const& transport = GetParam().transport;
|
||||
IpcAddress const data("pub_sub_data");
|
||||
IpcAddress const control("pub_sub_control");
|
||||
|
||||
@@ -31,16 +35,14 @@ auto RunPubSub(string const& transport) -> void
|
||||
+ " name=control,type=pull,method=bind,address=" + control.str()},
|
||||
{"sub_1_" + transport, subChannels},
|
||||
{"sub_2_" + transport, subChannels},
|
||||
}, RunOptions(transport));
|
||||
}, RunOptions(transport, GetParam().DeviceArgs()));
|
||||
|
||||
for (auto const& result : results) {
|
||||
EXPECT_TRUE(Succeeded(result, transport));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(PubSub, zeromq)
|
||||
{
|
||||
RunPubSub("zeromq");
|
||||
}
|
||||
// The shmem transport does not support pub/sub.
|
||||
INSTANTIATE_TEST_SUITE_P(, PubSub, testing::Values(TransportParam("zeromq")), TransportParamName());
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <helper/Devices.h>
|
||||
#include <helper/Transport.h>
|
||||
#include <helper/TransportParam.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -19,33 +20,23 @@ namespace
|
||||
using namespace std;
|
||||
using namespace fair::mq::test;
|
||||
|
||||
auto RunPushPull(string const& transport, string const& extraArgs) -> void
|
||||
using PushPull = TransportTest;
|
||||
|
||||
TEST_P(PushPull, SingleMsg_MultiThreaded_ipc)
|
||||
{
|
||||
auto const& transport = GetParam().transport;
|
||||
IpcAddress const address("push_pull");
|
||||
|
||||
auto const results = RunDevices({
|
||||
{"push_" + transport, "name=data,type=push,method=bind,address=" + address.str()},
|
||||
{"pull_" + transport, "name=data,type=pull,method=connect,address=" + address.str()},
|
||||
}, RunOptions(transport, extraArgs));
|
||||
}, RunOptions(transport, GetParam().DeviceArgs()));
|
||||
|
||||
for (auto const& result : results) {
|
||||
EXPECT_TRUE(Succeeded(result, transport));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(PushPull, SingleMsg_MultiThreaded_ipc_zeromq)
|
||||
{
|
||||
RunPushPull("zeromq", "");
|
||||
}
|
||||
|
||||
TEST(PushPull, SingleMsg_MultiThreaded_ipc_shmem)
|
||||
{
|
||||
RunPushPull("shmem", "");
|
||||
}
|
||||
|
||||
TEST(PushPull, SingleMsg_MultiThreaded_ipc_shmem_expanded_metadata)
|
||||
{
|
||||
RunPushPull("shmem", "--shm-metadata-msg-size 2048");
|
||||
}
|
||||
INSTANTIATE_TEST_SUITE_P(, PushPull, AllTransports(), TransportParamName());
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <fairmq/TransportFactory.h>
|
||||
#include <fairmq/tools/Unique.h>
|
||||
#include <helper/Transport.h>
|
||||
#include <helper/TransportParam.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
@@ -26,14 +27,12 @@ namespace
|
||||
using namespace std;
|
||||
using namespace fair::mq;
|
||||
|
||||
auto RunSingleThreadedMultipart(string const& transport, string const& address1, string const& address2, bool expandedShmMetadata) -> void
|
||||
auto RunSingleThreadedMultipart(test::TransportParam const& param, string const& address1, string const& address2) -> void
|
||||
{
|
||||
|
||||
fair::mq::ProgOptions config;
|
||||
test::Configure(config, tools::Uuid(), expandedShmMetadata);
|
||||
test::Configure(config, tools::Uuid(), param.expandedShmMetadata);
|
||||
|
||||
|
||||
auto factory = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config);
|
||||
auto factory = TransportFactory::CreateTransportFactory(param.transport, tools::Uuid(), &config);
|
||||
|
||||
Channel push1("Push1", "push", factory);
|
||||
ASSERT_TRUE(push1.Bind(address1));
|
||||
@@ -105,15 +104,14 @@ auto RunSingleThreadedMultipart(string const& transport, string const& address1,
|
||||
}
|
||||
}
|
||||
|
||||
auto RunMultiThreadedMultipart(string const& transport, string const& address1, bool expandedShmMetadata) -> void
|
||||
auto RunMultiThreadedMultipart(test::TransportParam const& param, string const& address1) -> void
|
||||
{
|
||||
ProgOptions config;
|
||||
test::Configure(config, tools::Uuid(), expandedShmMetadata);
|
||||
test::Configure(config, tools::Uuid(), param.expandedShmMetadata);
|
||||
config.SetProperty<int>("io-threads", 1);
|
||||
config.SetProperty<size_t>("shm-segment-size", 20000000); // NOLINT
|
||||
|
||||
|
||||
auto factory = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config);
|
||||
auto factory = TransportFactory::CreateTransportFactory(param.transport, tools::Uuid(), &config);
|
||||
|
||||
Channel push1("Push1", "push", factory);
|
||||
ASSERT_TRUE(push1.Bind(address1));
|
||||
@@ -148,70 +146,30 @@ auto RunMultiThreadedMultipart(string const& transport, string const& address1,
|
||||
puller.join();
|
||||
}
|
||||
|
||||
TEST(PushPull, Multipart_SingleThreaded_inproc_zeromq) // NOLINT
|
||||
using PushPullMultipart = test::TransportTest;
|
||||
|
||||
TEST_P(PushPullMultipart, SingleThreaded_inproc) // NOLINT
|
||||
{
|
||||
RunSingleThreadedMultipart("zeromq", "inproc://test1", "inproc://test2", false);
|
||||
RunSingleThreadedMultipart(GetParam(), "inproc://test1", "inproc://test2");
|
||||
}
|
||||
|
||||
TEST(PushPull, Multipart_SingleThreaded_inproc_shmem) // NOLINT
|
||||
{
|
||||
RunSingleThreadedMultipart("shmem", "inproc://test1", "inproc://test2", false);
|
||||
}
|
||||
|
||||
TEST(PushPull, Multipart_SingleThreaded_inproc_shmem_expanded_metadata) // NOLINT
|
||||
{
|
||||
RunSingleThreadedMultipart("shmem", "inproc://test1", "inproc://test2", true);
|
||||
}
|
||||
|
||||
TEST(PushPull, Multipart_SingleThreaded_ipc_zeromq) // NOLINT
|
||||
TEST_P(PushPullMultipart, SingleThreaded_ipc) // NOLINT
|
||||
{
|
||||
test::IpcAddress const address1("multipart_1"), address2("multipart_2");
|
||||
RunSingleThreadedMultipart("zeromq", address1, address2, false);
|
||||
RunSingleThreadedMultipart(GetParam(), address1, address2);
|
||||
}
|
||||
|
||||
TEST(PushPull, Multipart_SingleThreaded_ipc_shmem) // NOLINT
|
||||
TEST_P(PushPullMultipart, MultiThreaded_inproc) // NOLINT
|
||||
{
|
||||
test::IpcAddress const address1("multipart_1"), address2("multipart_2");
|
||||
RunSingleThreadedMultipart("shmem", address1, address2, false);
|
||||
RunMultiThreadedMultipart(GetParam(), "inproc://test_1");
|
||||
}
|
||||
|
||||
TEST(PushPull, Multipart_SingleThreaded_ipc_shmem_expanded_metadata) // NOLINT
|
||||
{
|
||||
test::IpcAddress const address1("multipart_1"), address2("multipart_2");
|
||||
RunSingleThreadedMultipart("shmem", address1, address2, true);
|
||||
}
|
||||
|
||||
TEST(PushPull, Multipart_MultiThreaded_inproc_zeromq) // NOLINT
|
||||
{
|
||||
RunMultiThreadedMultipart("zeromq", "inproc://test_1", false);
|
||||
}
|
||||
|
||||
TEST(PushPull, Multipart_MultiThreaded_inproc_shmem) // NOLINT
|
||||
{
|
||||
RunMultiThreadedMultipart("shmem", "inproc://test_1", false);
|
||||
}
|
||||
|
||||
TEST(PushPull, Multipart_MultiThreaded_inproc_shmem_expanded_metadata) // NOLINT
|
||||
{
|
||||
RunMultiThreadedMultipart("shmem", "inproc://test_1", true);
|
||||
}
|
||||
|
||||
TEST(PushPull, Multipart_MultiThreaded_ipc_zeromq) // NOLINT
|
||||
TEST_P(PushPullMultipart, MultiThreaded_ipc) // NOLINT
|
||||
{
|
||||
test::IpcAddress const address("multipart");
|
||||
RunMultiThreadedMultipart("zeromq", address, false);
|
||||
RunMultiThreadedMultipart(GetParam(), address);
|
||||
}
|
||||
|
||||
TEST(PushPull, Multipart_MultiThreaded_ipc_shmem) // NOLINT
|
||||
{
|
||||
test::IpcAddress const address("multipart");
|
||||
RunMultiThreadedMultipart("shmem", address, false);
|
||||
}
|
||||
|
||||
TEST(PushPull, Multipart_MultiThreaded_ipc_shmem_expanded_metadata) // NOLINT
|
||||
{
|
||||
test::IpcAddress const address("multipart");
|
||||
RunMultiThreadedMultipart("shmem", address, true);
|
||||
}
|
||||
INSTANTIATE_TEST_SUITE_P(, PushPullMultipart, test::AllTransports(), test::TransportParamName());
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <helper/Devices.h>
|
||||
#include <helper/Transport.h>
|
||||
#include <helper/TransportParam.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -19,34 +20,24 @@ namespace
|
||||
using namespace std;
|
||||
using namespace fair::mq::test;
|
||||
|
||||
auto RunReqRep(string const& transport, string const& extraArgs) -> void
|
||||
using ReqRep = TransportTest;
|
||||
|
||||
TEST_P(ReqRep, MultiThreaded_ipc)
|
||||
{
|
||||
auto const& transport = GetParam().transport;
|
||||
IpcAddress const address("req_rep");
|
||||
|
||||
auto const results = RunDevices({
|
||||
{"rep_" + transport, "name=data,type=rep,method=bind,address=" + address.str()},
|
||||
{"req_1_" + transport, "name=data,type=req,method=connect,address=" + address.str()},
|
||||
{"req_2_" + transport, "name=data,type=req,method=connect,address=" + address.str()},
|
||||
}, RunOptions(transport, extraArgs));
|
||||
}, RunOptions(transport, GetParam().DeviceArgs()));
|
||||
|
||||
for (auto const& result : results) {
|
||||
EXPECT_TRUE(Succeeded(result, transport));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ReqRep, zeromq)
|
||||
{
|
||||
RunReqRep("zeromq", "");
|
||||
}
|
||||
|
||||
TEST(ReqRep, shmem)
|
||||
{
|
||||
RunReqRep("shmem", "");
|
||||
}
|
||||
|
||||
TEST(ReqRep, shmem_expanded_metadata)
|
||||
{
|
||||
RunReqRep("shmem", "--shm-metadata-msg-size 2048");
|
||||
}
|
||||
INSTANTIATE_TEST_SUITE_P(, ReqRep, AllTransports(), TransportParamName());
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user