test: use unique ipc addresses that the tests remove

- the in-process tests used fixed, relative ipc addresses; the socket
  files stayed in the build directory (99 files after 6 runs), and two
  runs of the same test at the same time could share a socket
- use test::IpcAddress: a unique path in /tmp that the destructor
  removes
- drop the session suffix of the inproc addresses: an inproc address
  is local to the process

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-11-03 14:16:33 +00:00
committed by Dennis Klein
parent 0367c2a4a8
commit 3c752937a4
6 changed files with 70 additions and 60 deletions

View File

@@ -26,13 +26,12 @@ namespace
using namespace std;
using namespace fair::mq;
auto RunSingleThreadedMultipart(string transport, string address1, string address2, bool expandedShmMetadata) -> void {
auto RunSingleThreadedMultipart(string const& transport, string const& address1, string const& address2, bool expandedShmMetadata) -> void
{
fair::mq::ProgOptions config;
test::Configure(config, tools::Uuid(), expandedShmMetadata);
address1 += "_" + config.GetProperty<string>("session");
address2 += "_" + config.GetProperty<string>("session");
auto factory = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config);
@@ -106,14 +105,13 @@ auto RunSingleThreadedMultipart(string transport, string address1, string addres
}
}
auto RunMultiThreadedMultipart(string transport, string address1, bool expandedShmMetadata) -> void
auto RunMultiThreadedMultipart(string const& transport, string const& address1, bool expandedShmMetadata) -> void
{
ProgOptions config;
test::Configure(config, tools::Uuid(), expandedShmMetadata);
config.SetProperty<int>("io-threads", 1);
config.SetProperty<size_t>("shm-segment-size", 20000000); // NOLINT
address1 += "_" + config.GetProperty<string>("session");
auto factory = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config);
@@ -167,17 +165,20 @@ TEST(PushPull, Multipart_SingleThreaded_inproc_shmem_expanded_metadata) // NOLIN
TEST(PushPull, Multipart_SingleThreaded_ipc_zeromq) // NOLINT
{
RunSingleThreadedMultipart("zeromq", "ipc://test_Multipart_SingleThreaded_ipc_zeromq_1", "ipc://test_Multipart_SingleThreaded_ipc_zeromq_2", false);
test::IpcAddress const address1("multipart_1"), address2("multipart_2");
RunSingleThreadedMultipart("zeromq", address1, address2, false);
}
TEST(PushPull, Multipart_SingleThreaded_ipc_shmem) // NOLINT
{
RunSingleThreadedMultipart("shmem", "ipc://test_Multipart_SingleThreaded_ipc_shmem_1", "ipc://test_Multipart_SingleThreaded_ipc_shmem_2", false);
test::IpcAddress const address1("multipart_1"), address2("multipart_2");
RunSingleThreadedMultipart("shmem", address1, address2, false);
}
TEST(PushPull, Multipart_SingleThreaded_ipc_shmem_expanded_metadata) // NOLINT
{
RunSingleThreadedMultipart("shmem", "ipc://test_Multipart_SingleThreaded_ipc_shmem_1", "ipc://test_Multipart_SingleThreaded_ipc_shmem_2", true);
test::IpcAddress const address1("multipart_1"), address2("multipart_2");
RunSingleThreadedMultipart("shmem", address1, address2, true);
}
TEST(PushPull, Multipart_MultiThreaded_inproc_zeromq) // NOLINT
@@ -197,17 +198,20 @@ TEST(PushPull, Multipart_MultiThreaded_inproc_shmem_expanded_metadata) // NOLINT
TEST(PushPull, Multipart_MultiThreaded_ipc_zeromq) // NOLINT
{
RunMultiThreadedMultipart("zeromq", "ipc://test_Multipart_MultiThreaded_ipc_zeromq_1", false);
test::IpcAddress const address("multipart");
RunMultiThreadedMultipart("zeromq", address, false);
}
TEST(PushPull, Multipart_MultiThreaded_ipc_shmem) // NOLINT
{
RunMultiThreadedMultipart("shmem", "ipc://test_Multipart_MultiThreaded_ipc_shmem_1", false);
test::IpcAddress const address("multipart");
RunMultiThreadedMultipart("shmem", address, false);
}
TEST(PushPull, Multipart_MultiThreaded_ipc_shmem_expanded_metadata) // NOLINT
{
RunMultiThreadedMultipart("shmem", "ipc://test_Multipart_MultiThreaded_ipc_shmem__expanded_metadata_1", true);
test::IpcAddress const address("multipart");
RunMultiThreadedMultipart("shmem", address, true);
}
} // namespace