31 Commits

Author SHA1 Message Date
Claude
5da5a35b4d test: parameterize the message, region, channel and option tests by transport
- Turn the per-transport TEST() copies into TEST_P() suites:
  Messages, ShmMessages, Regions, ConnectedPeers and Options
- The test names change, e.g. Resize.shmem_expanded_metadata is now
  Messages.Resize/shmem_expanded_metadata

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:00:01 +01:00
Claude
3c752937a4 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>
2026-11-03 17:00:01 +01:00
Claude
0367c2a4a8 refactor(test): set up test configs with test::Configure()
- 33 places repeated the same session, shm segment size, shm monitor
  and expanded metadata properties
- call test::Configure() and set only the properties that differ

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:00:01 +01:00
Claude
d4a85086aa test: wait for conditions instead of fixed sleeps
- Channel.GetNumberOfConnectedPeers slept 100 ms and then expected the
  peer count; on a slow runner the count can change later
- poll the count with a deadline instead
- remove the 500 ms sleep in Init() of the MultipleDevices sender and
  receiver: the transfer does not depend on the order of bind and
  connect

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:00:01 +01:00
Claude
5994ea44de fix(test): fail instead of hang when a region callback check fails
- an ASSERT_* in a region callback returned before blocker.Signal(),
  and the test then waited in blocker.Wait() until the ctest timeout
- use EXPECT_* in the callbacks, so that the signal always comes
- wait with a deadline (test::Semaphore) in the region and message
  tests
- in RegionEventSubscriptions, make the semaphore outlive the factory
  that calls the callback

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:00:01 +01:00
Claude
35caaab403 fix(test): do not change the global log severity in tests
- ZeroCopyFromUnmanaged and RegionEventSubscriptions set the console
  severity to debug and did not restore it
- the setting stayed active for all later tests in the same process,
  e.g. with --gtest_repeat or a direct run of the test binary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:00:01 +01:00
Claude
ddb365efe4 fix(test): check the results of Bind, Connect, Send and Receive
- the message, region, channel and transport tests ignored the return
  values of these calls; a failed bind or a short transfer showed up
  later as an unrelated failure, or not at all
- assert each result where the test uses it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:00:01 +01:00
Claude
e7f6c37247 test(shmem): guard size of Message and layout of MetaHeader
- Fail if `sizeof(shmem::Message)` grows above 72 bytes on LP64.
- Fail if `sizeof(shmem::MetaHeader)` changes from 40 bytes, because
  it is the wire format of the metadata message.
- Check the field order of `MetaHeader` with positional aggregate
  initialization and `offsetof`. Users such as AliceO2 create it by
  field position.

Refs: #477

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 15:11:03 +01:00
Claude
f1312aefe3 fix(shmem): release region blocks of reused messages to their own region
- Remove the `fRegionPtr` member of `shmem::Message`. It cached the
  region of the last `GetData()`, `GetRefCount()` or `Copy()` call.
  `Rebuild()` and `Socket::Receive()` did not reset it.
- When a message received a block of region A, was read, rebuilt, and
  then received a block of region B, its release went to region A.
  Region A got a wrong callback and region B never got its block back.
- Look up the region with `Manager::GetRegionFromCache()` where it is
  needed. The lookup is a thread-local fast path.
- `sizeof(shmem::Message)` goes from 80 to 72 bytes on LP64.

Refs: #477

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 15:11:03 +01:00
Alexey Rybalchenko
215c31428b feat(shmem): expose side-channel metadata API for unsent messages
Add two public entry points needed by the ALICE use case where shmem
messages are allocated via a transport but never sent — their metadata
is instead serialised into Arrow tables and delivered over a separate
channel, allowing consumer devices to resolve the payload pointer
without taking ownership.

shmem::Message::GetMeta() returns the MetaHeader of the message,
mirroring the existing positional-init pattern already used in Socket.h.

shmem::GetDataAddressFromHandle(TransportFactory&, const MetaHeader&)
is a free function declared in Common.h and defined in Manager.cxx.
Keeping it out of the TransportFactory class body means callers only
need to include Common.h (available transitively via Message.h) and do
not drag in Socket.h or zmq.h. The implementation handles both managed
segments and unmanaged regions, and throws SharedMemoryError with a
typed message on a bad segment or region id. TransportFactory also
gains a same-named member for callers that already have the concrete
type. Lifetime of the returned pointer is the caller's responsibility;
the cache device is expected to hold the messages alive.

A SideChannel test covers the GetMeta/GetDataAddressFromHandle
round-trip for both standard and expanded-metadata configurations.
2026-06-10 18:51:04 +02:00
Alexey Rybalchenko
2df3d909fa shm: when refCount segment size is zero, fallback to old behaviour
, which is to store reference counts inside the main data segment
2023-11-29 19:21:42 +01:00
Alexey Rybalchenko
6122010694 Fix address clashes in tests 2023-10-24 15:22:21 +02:00
Alexey Rybalchenko
25614e3e06 test: Add coverage for --shm-metadata-msg-size 2023-06-13 21:24:40 +02:00
Alexey Rybalchenko
45663189a9 Turn shm-monitor off by default
resolves #459
2023-02-24 14:28:18 +01:00
Alexey Rybalchenko
f4d39d224b Avoid fixed ports in the test suites 2022-01-25 11:55:38 +01:00
Alexey Rybalchenko
bfd08bb33f Don't use to-be-deprecated names 2022-01-24 06:40:24 +01:00
Alexey Rybalchenko
bce380d871 Implement shmem msg zero-copy 2021-09-07 20:53:16 +02:00
Alexey Rybalchenko
c57410b820 Extend test for empty messages 2021-09-07 20:53:16 +02:00
Dennis Klein
4e8f247a0d fix: First round of using new non-namespaced typenames 2021-09-07 20:53:16 +02:00
Alexey Rybalchenko
bffe74c5cf shm: handle shrink failure gracefully 2021-03-23 13:00:35 +01:00
Alexey Rybalchenko
c6b13cd3a1 Fix shmem::Message::SetUsedSize(0) 2021-01-25 13:46:40 +01:00
Alexey Rybalchenko
d9a5e82160 Cleanup tools includes 2021-01-25 13:46:40 +01:00
Alexey Rybalchenko
6815c9c172 zmq: implement alignment 2021-01-13 12:36:32 +01:00
Alexey Rybalchenko
be94ceb7a7 zmq: simplify SetUsedSize implementation 2021-01-13 12:36:32 +01:00
Alexey Rybalchenko
79ca436b74 Zmq: let GetData of an empty message return nullptr 2020-06-05 18:16:13 +02:00
Alexey Rybalchenko
53a4d17f8b Alignment part I - Interface and shmem send 2020-05-20 19:34:27 +02:00
Alexey Rybalchenko
a15d59c725 Remove nanomsg transport 2020-05-11 17:38:16 +02:00
Dennis Klein
a65f0e6777 Tests.Message: Fix race condition 2019-07-23 16:08:15 +02:00
Alexey Rybalchenko
cba6d19781 Add config plugin class. 2019-07-10 19:35:18 +02:00
Alexey Rybalchenko
5af604c0a9 Rename some test names for consistency 2019-03-06 14:23:08 +01:00
Alexey Rybalchenko
a9619a06d0 Add test for FairMQMessage::Rebuild 2018-11-28 21:16:29 +01:00