diff --git a/test/channel/_channel.cxx b/test/channel/_channel.cxx index ff43cf13..9ee10957 100644 --- a/test/channel/_channel.cxx +++ b/test/channel/_channel.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -98,10 +99,7 @@ TEST(Channel, Validation) auto testConnectedPeers(std::string const& transport) { ProgOptions config; - config.SetProperty("session", tools::Uuid()); - config.SetProperty("shm-monitor", true); - config.SetProperty("shm-segment-size", 100000000); - string const address(tools::ToString("ipc://", config.GetProperty("session"))); + string const address(tools::ToString("ipc://", test::Configure(config))); unsigned long constexpr zero(0), one(1); auto factory(TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config)); diff --git a/test/memory_resources/_memory_resources.cxx b/test/memory_resources/_memory_resources.cxx index f4511cff..6d355cd3 100644 --- a/test/memory_resources/_memory_resources.cxx +++ b/test/memory_resources/_memory_resources.cxx @@ -13,6 +13,7 @@ #include +#include #include #include @@ -78,11 +79,8 @@ int TestData::ndeallocations = 0; TEST(MemoryResources, transportAllocatorMap) { - size_t session{tools::UuidHash()}; ProgOptions config; - config.SetProperty("session", to_string(session)); - config.SetProperty("shm-monitor", true); - config.SetProperty("shm-segment-size", 100000000); + test::Configure(config); FactoryType factoryZMQ = TransportFactory::CreateTransportFactory("zeromq", fair::mq::tools::Uuid(), &config); FactoryType factorySHM = TransportFactory::CreateTransportFactory("shmem", fair::mq::tools::Uuid(), &config); @@ -102,9 +100,8 @@ TEST(MemoryResources, allocator) TestData::nallocations = 0; TestData::ndeallocations = 0; - size_t session{tools::UuidHash()}; ProgOptions config; - config.SetProperty("session", to_string(session)); + test::Configure(config); FactoryType factoryZMQ = TransportFactory::CreateTransportFactory("zeromq", fair::mq::tools::Uuid(), &config); @@ -130,11 +127,8 @@ TEST(MemoryResources, getMessage) TestData::nallocations = 0; TestData::ndeallocations = 0; - size_t session{tools::UuidHash()}; ProgOptions config; - config.SetProperty("session", to_string(session)); - config.SetProperty("shm-monitor", true); - config.SetProperty("shm-segment-size", 100000000); + test::Configure(config); FactoryType factoryZMQ = TransportFactory::CreateTransportFactory("zeromq", fair::mq::tools::Uuid(), &config); FactoryType factorySHM = TransportFactory::CreateTransportFactory("shmem", fair::mq::tools::Uuid(), &config); diff --git a/test/message/_message.cxx b/test/message/_message.cxx index 293ea079..43992344 100644 --- a/test/message/_message.cxx +++ b/test/message/_message.cxx @@ -17,6 +17,7 @@ #include +#include #include #include @@ -45,12 +46,7 @@ auto AsStringView(Message const& msg) -> string_view auto RunPushPullWithMsgResize(string const & transport, string const & _address, bool expandedShmMetadata = false) -> void { ProgOptions config; - config.SetProperty("session", tools::Uuid()); - config.SetProperty("shm-segment-size", 100000000); - config.SetProperty("shm-monitor", true); - if (expandedShmMetadata) { - config.SetProperty("shm-metadata-msg-size", 2048); - } + test::Configure(config, tools::Uuid(), expandedShmMetadata); auto factory(TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config)); Channel push{"Push", "push", factory}; @@ -111,12 +107,7 @@ auto RunPushPullWithMsgResize(string const & transport, string const & _address, auto RunMsgRebuild(const string& transport, bool expandedShmMetadata = false) -> void { ProgOptions config; - config.SetProperty("session", tools::Uuid()); - config.SetProperty("shm-segment-size", 100000000); - config.SetProperty("shm-monitor", true); - if (expandedShmMetadata) { - config.SetProperty("shm-metadata-msg-size", 2048); - } + test::Configure(config, tools::Uuid(), expandedShmMetadata); auto factory(TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config)); size_t const msgSize{100}; @@ -148,12 +139,7 @@ auto CheckMsgAlignment(Message const& msg, fair::mq::Alignment alignment) -> boo auto RunPushPullWithAlignment(string const& transport, string const& _address, bool expandedShmMetadata = false) -> void { ProgOptions config; - config.SetProperty("session", tools::Uuid()); - config.SetProperty("shm-segment-size", 100000000); - config.SetProperty("shm-monitor", true); - if (expandedShmMetadata) { - config.SetProperty("shm-metadata-msg-size", 2048); - } + test::Configure(config, tools::Uuid(), expandedShmMetadata); auto factory(TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config)); Channel push{"Push", "push", factory}; @@ -206,12 +192,7 @@ auto RunPushPullWithAlignment(string const& transport, string const& _address, b auto EmptyMessage(string const& transport, string const& _address, bool expandedShmMetadata = false) -> void { ProgOptions config; - config.SetProperty("session", tools::Uuid()); - config.SetProperty("shm-segment-size", 100000000); - config.SetProperty("shm-monitor", true); - if (expandedShmMetadata) { - config.SetProperty("shm-metadata-msg-size", 2048); - } + test::Configure(config, tools::Uuid(), expandedShmMetadata); auto factory(TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config)); Channel push{"Push", "push", factory}; @@ -261,12 +242,7 @@ auto EmptyMessage(string const& transport, string const& _address, bool expanded auto ZeroCopy(bool expandedShmMetadata = false) -> void { ProgOptions config; - config.SetProperty("session", tools::Uuid()); - config.SetProperty("shm-segment-size", 100000000); - config.SetProperty("shm-monitor", true); - if (expandedShmMetadata) { - config.SetProperty("shm-metadata-msg-size", 2048); - } + test::Configure(config, tools::Uuid(), expandedShmMetadata); auto factory(TransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &config)); unique_ptr str(make_unique("asdf")); @@ -296,21 +272,10 @@ auto ZeroCopyFromUnmanaged(string const& address, bool expandedShmMetadata, uint { ProgOptions config1; ProgOptions config2; - string session(tools::Uuid()); - config1.SetProperty("session", session); - config1.SetProperty("shm-segment-size", 100000000); - config1.SetProperty("shm-monitor", true); - config2.SetProperty("session", session); - config2.SetProperty("shm-segment-size", 100000000); - config2.SetProperty("shm-monitor", true); + string const session(test::Configure(config1, tools::Uuid(), expandedShmMetadata)); + test::Configure(config2, session, expandedShmMetadata); // ref counts should be accessible accross different segments config2.SetProperty("shm-segment-id", 2); - if (expandedShmMetadata) { - config1.SetProperty("shm-metadata-msg-size", 2048); - } - if (expandedShmMetadata) { - config2.SetProperty("shm-metadata-msg-size", 2048); - } auto factory1(TransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &config1)); auto factory2(TransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &config2)); @@ -464,18 +429,11 @@ auto SideChannel(bool expandedShmMetadata = false) -> void const string session = tools::Uuid(); ProgOptions producerConfig; - producerConfig.SetProperty("session", session); - producerConfig.SetProperty("shm-segment-size", 100000000); - producerConfig.SetProperty("shm-monitor", true); - if (expandedShmMetadata) { - producerConfig.SetProperty("shm-metadata-msg-size", 2048); - } + test::Configure(producerConfig, session, expandedShmMetadata); auto producerFactory(TransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &producerConfig)); ProgOptions consumerConfig; - consumerConfig.SetProperty("session", session); - consumerConfig.SetProperty("shm-segment-size", 100000000); - consumerConfig.SetProperty("shm-monitor", true); + test::Configure(consumerConfig, session); auto consumerFactory(TransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &consumerConfig)); const size_t size = 2; @@ -512,15 +470,11 @@ auto SideChannelUnmanaged() -> void const string session = tools::Uuid(); ProgOptions producerConfig; - producerConfig.SetProperty("session", session); - producerConfig.SetProperty("shm-segment-size", 100000000); - producerConfig.SetProperty("shm-monitor", true); + test::Configure(producerConfig, session); auto producerFactory(TransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &producerConfig)); ProgOptions consumerConfig; - consumerConfig.SetProperty("session", session); - consumerConfig.SetProperty("shm-segment-size", 100000000); - consumerConfig.SetProperty("shm-monitor", true); + test::Configure(consumerConfig, session); auto consumerFactory(TransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &consumerConfig)); const size_t regionSize = 1000000; @@ -552,9 +506,7 @@ auto SideChannelUnmanaged() -> void auto ReuseReceivedRegionMessage() -> void { ProgOptions config; - config.SetProperty("session", tools::Uuid()); - config.SetProperty("shm-segment-size", 100000000); - config.SetProperty("shm-monitor", true); + test::Configure(config); auto factory(TransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &config)); const size_t regionSize = 1000000; @@ -599,9 +551,7 @@ auto ReuseReceivedRegionMessage() -> void auto SideChannelErrors() -> void { ProgOptions config; - config.SetProperty("session", tools::Uuid()); - config.SetProperty("shm-segment-size", 100000000); - config.SetProperty("shm-monitor", true); + test::Configure(config); auto shmFactory(TransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &config)); auto zmqFactory(TransportFactory::CreateTransportFactory("zeromq", tools::Uuid(), &config)); diff --git a/test/protocols/_push_pull_multipart.cxx b/test/protocols/_push_pull_multipart.cxx index d98fe8dc..e726267d 100644 --- a/test/protocols/_push_pull_multipart.cxx +++ b/test/protocols/_push_pull_multipart.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -28,12 +29,7 @@ using namespace fair::mq; auto RunSingleThreadedMultipart(string transport, string address1, string address2, bool expandedShmMetadata) -> void { fair::mq::ProgOptions config; - config.SetProperty("session", tools::Uuid()); - config.SetProperty("shm-segment-size", 100000000); - config.SetProperty("shm-monitor", true); - if (expandedShmMetadata) { - config.SetProperty("shm-metadata-msg-size", 2048); - } + test::Configure(config, tools::Uuid(), expandedShmMetadata); address1 += "_" + config.GetProperty("session"); address2 += "_" + config.GetProperty("session"); @@ -113,13 +109,9 @@ auto RunSingleThreadedMultipart(string transport, string address1, string addres auto RunMultiThreadedMultipart(string transport, string address1, bool expandedShmMetadata) -> void { ProgOptions config; - config.SetProperty("session", tools::Uuid()); + test::Configure(config, tools::Uuid(), expandedShmMetadata); config.SetProperty("io-threads", 1); config.SetProperty("shm-segment-size", 20000000); // NOLINT - config.SetProperty("shm-monitor", true); - if (expandedShmMetadata) { - config.SetProperty("shm-metadata-msg-size", 2048); - } address1 += "_" + config.GetProperty("session"); diff --git a/test/region/_region.cxx b/test/region/_region.cxx index 0a2f3dc8..b345f6b7 100644 --- a/test/region/_region.cxx +++ b/test/region/_region.cxx @@ -20,6 +20,7 @@ #include +#include #include #include @@ -70,9 +71,7 @@ void RegionsSizeMismatch() size_t session = tools::UuidHash(); ProgOptions config; - config.SetProperty("session", to_string(session)); - config.SetProperty("shm-segment-size", 100000000); - config.SetProperty("shm-monitor", true); + test::Configure(config, to_string(session)); auto factory = TransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &config); @@ -94,12 +93,8 @@ void RegionsCache(const string& transport, const string& _address) ProgOptions config1; ProgOptions config2; - config1.SetProperty("session", to_string(session1)); - config1.SetProperty("shm-segment-size", 100000000); - config1.SetProperty("shm-monitor", true); - config2.SetProperty("session", to_string(session2)); - config2.SetProperty("shm-segment-size", 100000000); - config2.SetProperty("shm-monitor", true); + test::Configure(config1, to_string(session1)); + test::Configure(config2, to_string(session2)); auto factory1 = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config1); auto factory2 = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config2); @@ -174,9 +169,8 @@ void RegionEventSubscriptions(const string& transport, bool external) } ProgOptions config; - config.SetProperty("session", to_string(session)); + test::Configure(config, to_string(session)); config.SetProperty("shm-segment-size", sSize); - config.SetProperty("shm-monitor", true); if (external) { config.SetProperty("shm-no-cleanup", true); // config.SetProperty("shm-monitor", false); @@ -276,9 +270,8 @@ void RegionCallbacks(const string& transport, const string& _address) constexpr size_t r2Size = 3000000; ProgOptions config; - config.SetProperty("session", to_string(session)); + test::Configure(config, to_string(session)); config.SetProperty("shm-segment-size", sSize); - config.SetProperty("shm-monitor", true); auto factory = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config); @@ -346,9 +339,7 @@ void RegionCallbackCallsTransportDuringDestruction(const string& transport, cons std::string address(tools::ToString(_address, "_", transport)); ProgOptions config; - config.SetProperty("session", to_string(session)); - config.SetProperty("shm-segment-size", 100000000); - config.SetProperty("shm-monitor", true); + test::Configure(config, to_string(session)); auto factory = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config); @@ -385,9 +376,7 @@ void RegionLockOrder(const string& _address) constexpr int numIterations = 10; ProgOptions config; - config.SetProperty("session", to_string(session)); - config.SetProperty("shm-segment-size", 100000000); - config.SetProperty("shm-monitor", true); + test::Configure(config, to_string(session)); auto factory1 = TransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &config); auto factory2 = TransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &config); diff --git a/test/transport/_options.cxx b/test/transport/_options.cxx index 86117d67..25505650 100644 --- a/test/transport/_options.cxx +++ b/test/transport/_options.cxx @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -40,9 +41,7 @@ void CheckOldOptionInterface(Channel& channel, const string& option) void RunOptionsTest(const string& transport) { ProgOptions config; - config.SetProperty("session", tools::Uuid()); - config.SetProperty("shm-monitor", true); - config.SetProperty("shm-segment-size", 100000000); + test::Configure(config); auto factory = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config); Channel channel("Push", "push", factory); @@ -72,11 +71,10 @@ void RunOptionsTest(const string& transport) void ZeroingAndMlock(const string& transport) { ProgOptions config; - config.SetProperty("session", tools::Uuid()); + test::Configure(config); config.SetProperty("shm-segment-size", 16384); // NOLINT config.SetProperty("shm-zero-segment", true); config.SetProperty("shm-mlock-segment", true); - config.SetProperty("shm-monitor", true); auto factory = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config); @@ -88,14 +86,11 @@ void ZeroingAndMlock(const string& transport) void ZeroingAndMlockOnCreation(const string& transport) { - size_t session{tools::UuidHash()}; - ProgOptions config; - config.SetProperty("session", to_string(session)); + test::Configure(config); config.SetProperty("shm-segment-size", 16384); // NOLINT config.SetProperty("shm-mlock-segment-on-creation", true); config.SetProperty("shm-zero-segment-on-creation", true); - config.SetProperty("shm-monitor", true); auto factory = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config); diff --git a/test/transport/_shmem.cxx b/test/transport/_shmem.cxx index 258ab541..2a21ea13 100644 --- a/test/transport/_shmem.cxx +++ b/test/transport/_shmem.cxx @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -24,10 +25,7 @@ using namespace fair::mq; void GetFreeMemory() { ProgOptions config; - string sessionId(to_string(tools::UuidHash())); - config.SetProperty("session", sessionId); - config.SetProperty("shm-monitor", true); - config.SetProperty("shm-segment-size", 100000000); + string const sessionId(test::Configure(config)); ASSERT_THROW(shmem::Monitor::GetFreeMemory(shmem::SessionId{sessionId}, 0), shmem::Monitor::MonitorError); diff --git a/test/transport/_transfer_timeout.cxx b/test/transport/_transfer_timeout.cxx index 143d3276..44e1352c 100644 --- a/test/transport/_transfer_timeout.cxx +++ b/test/transport/_transfer_timeout.cxx @@ -17,6 +17,7 @@ #include +#include #include #include @@ -74,9 +75,7 @@ void InterruptTransfer(const string& transport, const string& _address) std::string address(ToString(_address, "_", transport)); fair::mq::ProgOptions config; - config.SetProperty("session", to_string(session)); - config.SetProperty("shm-segment-size", 100000000); - config.SetProperty("shm-monitor", true); + test::Configure(config, to_string(session)); auto factory = TransportFactory::CreateTransportFactory(transport, Uuid(), &config);