Commit Graph

51 Commits

Author SHA1 Message Date
Claude
4e4d21bbd0 test(device): add tests for the runner options and interactive keys
- --print-options prints the computed options and does not start the
  device
- --print-channels and --version do not start the device
- Interactive control: h, c, p, k and an invalid key print their action
- Register two channel endpoints in the StateAction device
- Add disabled tests for known defects: --print-channels and --version
  print nothing (console severity "nolog"); keys that arrive in one read
  stay in the std::cin buffer and are never handled

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:00:01 +01:00
Claude
4ae5a6d2f5 test(device): add tests for the data callbacks and ConditionalRun()
- OnData() with single messages and with Parts on all transports;
  a callback that returns false ends Run() and the device goes to Ready
- Two input channels (poller path) and one input channel per transport
  (one poll thread per transport, per-channel transport override)
- ConditionalRun() ends Run() when it returns false; the rate option
  limits the calls

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:00:01 +01:00
Claude
f1ae05b45c test: use comparison assertions that print both values
- EXPECT_EQ/EXPECT_NE instead of EXPECT_TRUE(a == b) in the parts,
  memory resource and plugin manager tests; split the && checks
- ASSERT_NE on the message pointer before it is dereferenced
- ASSERT_TRUE/ASSERT_FALSE instead of ASSERT_EQ(x, true/false)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:00:01 +01:00
Claude
8ff2214f9c test: parameterize the device state tests by state and control
- Add test::StateParam (state, control mode, stdin input) and
  WithControls() for INSTANTIATE_TEST_SUITE_P()
- Turn the 60 TEST() copies in the Exceptions, ErrorState, Signals and
  WaitFor files into one TEST_P() each
- The test names change, e.g. Exceptions.interactive_InRun is now
  Exceptions.Throw/interactive_Run, Signal_SIGINT.* is Signals.RaiseSIGINT/*
  and ErrorState.OrphanMessages is OrphanMessages.shmem

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:00:01 +01:00
Claude
2a57a38efe refactor(test): merge the state action test devices
- Replace TestExceptions, TestErrorState, TestSignals and TestWaitFor
  with one StateAction device; the id selects the action and the state
- Run the device tests through test::RunDevices() instead of
  EXPECT_EXIT() and check the exit code and the expected log line

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
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
d67a6c0745 fix(test): join threads and end the device on an early return
- an ASSERT_* between thread start and join() returned with a joinable
  std::thread, and its destructor called std::terminate()
- the PluginServices fixture ended the device only from Idle; after a
  failure in another state, the join waited until the ctest timeout
- use StateMachineThread in the Transitions tests and in the fixture,
  and JoiningThread in Region.LockOrder

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:00:01 +01:00
Claude
3077d1c0ab test: use 100 MB shm segments in all shmem tests
- The shmem default segment is 2 GiB, and Boost reserves it with
  posix_fallocate, so each test takes 2 GiB of /dev/shm
- Parallel test runs then exhaust /dev/shm and segment creation
  fails with "No space left on device"
- Set --shm-segment-size 100000000 like the other tests already do

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:00:00 +01:00
Claude
d05ec00d54 chore(test): remove dead test code
- remove the StateMachine test: CMake did not build it, and it used an
  API that no longer exists
- remove memory_resources/runner.cxx: no target uses it
- remove the mqConfig declaration (never defined) and the
  SDK_TESTSUITE_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR macros (unused,
  test/sdk does not exist)
- remove the unused boost/process includes from the device tests, and
  the compile definition that selected their header

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:00:00 +01:00
Dennis Klein
fa64faf3f7 fix(boost): add compatibility for Boost.Process v1 API in Boost 1.89+
Boost 1.88 replaced Boost.Process with v2, breaking the v1 API.
Boost 1.89 restores v1 compatibility via <boost/process/v1.hpp>.

- Fail configuration if Boost 1.88 is detected
- Define FAIRMQ_BOOST_PROCESS_V1_HEADER for Boost >= 1.89
- Use conditional includes to select v1.hpp or process.hpp
- Add namespace aliases (bp, bp_this) for portable API access
2026-01-05 14:11:19 +01:00
Alexey Rybalchenko
39cb021827 Add 'no control' controller 2024-02-19 22:09:54 +01:00
Dennis Klein
c35d35a3c3 feat!: Remove Device::TransitionTo() without replacement
BREAKING CHANGE

However, this API was never advertised nor used by anyone.
2023-03-01 15:39:38 +01:00
Dennis Klein
b25c0787c0 test: Fix [-Wunused-result] 2023-03-01 15:39:38 +01:00
Dennis Klein
84de22f80b test: Consolidate some device control logic 2023-03-01 15:39:38 +01:00
Dennis Klein
435d07eaf9 feat: Improve ChangeState API
* Add `[[nodiscard]]` to `bool Device::ChangeState()`
* Introduce throwing variant `void Device::ChangeStateOrThrow()`

resolves #441
2023-03-01 15:39:38 +01:00
Dennis Klein
b798b1e098 test: Increase robustness of the test suite for high -j 2022-08-11 15:30:25 +02:00
Dennis Klein
12a85c6fb1 fix: Use namespaced typenames/headers 2022-08-11 15:30:25 +02:00
Alexey Rybalchenko
bfd08bb33f Don't use to-be-deprecated names 2022-01-24 06:40:24 +01:00
Alexey Rybalchenko
153dcfab94 Apply modernize-use-override 2021-09-27 12:04:07 +02:00
Alexey Rybalchenko
ad824b4de1 Define copy/move ctors and assignment ops
Delete special member functions where they are not used.
(as part of applying suggestions from cppcoreguidelines-special-member-functions)

These classes don't need to be copyable/movable:
  # copy/move not used:
  zmq:: TransportFactory, Socket, Message, UnmanagedRegion, Poller, Context
  shm:: TransportFactory, Socket, Message, UnmanagedRegion, Poller
  ofi:: TransportFactory, Socket, Message, Context
  shm:: ZMsg, Region, Monitor, TerminalConfig, Manager
  plugins:: Config, Control, TerminalConfig
  fairmq::StateQueue, StateMachine, ProgOptions, PluginServices, PluginManager, Plugin, Device, StateSubscription
  TestData, BadDevice, TestDevice (test suite heplers)

  # used via ptr interface:
  fairmq::UnmanagedRegion, TransportFactory, Socket, Poller, Message

These classes need to be movable/copyable:
 MyClass (test suite helper), fairmq::Channel, fairmq::Parts
2021-09-27 12:04:07 +02:00
Alexey Rybalchenko
6aeac265ec Apply modernize-use-equals-default 2021-05-28 13:14:51 +02:00
Alexey Rybalchenko
e1b229522c Apply modernize-deprecated-headers 2021-05-28 13:14:51 +02:00
Alexey Rybalchenko
c85d6e079c shm: reduce shm contention when dealing with ack queues 2021-05-07 21:33:15 +02:00
Alexey Rybalchenko
4a09154a91 17-ify namespaces 2021-01-25 13:46:40 +01:00
Alexey Rybalchenko
d9a5e82160 Cleanup tools includes 2021-01-25 13:46:40 +01:00
Dennis Klein
278cd62049 Fix ODR violations for unity builds 2020-02-08 18:58:23 +01:00
Alexey Rybalchenko
684e711b8b Shmem: track number of message objects, throw if non-zero at reset 2019-12-20 14:04:58 +01:00
Alexey Rybalchenko
5256e7c580 Add support and test for concurrent TransitionTo 2019-07-19 14:45:27 +02:00
Alexey Rybalchenko
74d301a16f Implement Device::TransitionTo() and test it 2019-07-19 14:45:27 +02:00
Alexey Rybalchenko
1c7da53386 Refactor multiple devices test for better readability 2019-07-19 14:45:27 +02:00
Alexey Rybalchenko
5271d4236e Add additional test for running device with plugins without DeviceRunner 2019-07-10 19:35:18 +02:00
Alexey Rybalchenko
cba6d19781 Add config plugin class. 2019-07-10 19:35:18 +02:00
Alexey Rybalchenko
bf8ec968e7 Remove FairMQChannel from parser, implement bulk operations 2019-07-10 19:35:18 +02:00
Alexey Rybalchenko
99ffb732f4 Use process tools for WaitFor test 2019-03-19 18:09:01 +01:00
Alexey Rybalchenko
1a00f3edbd Remove controller input for several tests
The affected tests have independent shutdown
  conditions that race with the controller inputs.
2019-03-12 17:51:33 +01:00
Alexey Rybalchenko
dd02c01c36 Extend tests of error cases
- test raising SIGINT in every state
 - test going to Error state from every state
 - add new states (bind/connect) to exception tests
2019-03-12 12:10:47 +01:00
Alexey Rybalchenko
5af604c0a9 Rename some test names for consistency 2019-03-06 14:23:08 +01:00
Alexey Rybalchenko
fc94342db8 Update state machine
- Split INITIALIZING state into Init+Bind+Connect
 - Remove PAUSE state
 - Convert state/transitions to enum classes (CamelCase)
 - Transition to a state only once previous handler is complete
 - Add CompleteInit transition to notify Initializing state
   that config updates are complete
 - Deprecate WaitForEndOfState(transition) in favor of
   WaitForState(state)/WaitForNextState()
 - Update tests/plugins to new APIs
 - Deprecate CheckCurrentState() in favor of NewStatePending()
2019-02-25 12:19:50 +01:00
Alexey Rybalchenko
2e7005225e Remove sleeps from tests that were helping broken linger 2018-10-17 13:28:50 +02:00
Dennis Klein
78acb954cd Test more cases with interactive controller 2018-10-10 19:35:18 +02:00
Alexey Rybalchenko
cb199e7283 Fix throw after quit signal case 2018-10-10 19:35:18 +02:00
Dennis Klein
e39316c866 Test exceptions thrown in user code 2018-10-10 19:35:18 +02:00
Alexey Rybalchenko
957233cf95 Relocate some tests to more apropriate test suits 2018-09-20 14:05:44 +02:00
Alexey Rybalchenko
5397cef9d1 Use same runner.cxx/.h for all tests 2018-09-20 14:05:44 +02:00
Alexey Rybalchenko
5d37ab2f01 Use always-available transport for config test 2018-08-27 18:12:02 +02:00
Alexey Rybalchenko
7d5e76dece Add more tests for custom main() 2018-08-27 17:37:22 +02:00
Alexey Rybalchenko
a53ef79552 Run state handlers on the main thread (breaking change for control). 2018-08-08 16:13:41 +02:00
Alexey Rybalchenko
e4c349888d Improve compilation speed 2018-05-17 16:32:49 +02:00
Alexey Rybalchenko
2a6e4de72c provide FAIRMQ_PATH to test suites 2018-05-15 19:18:37 +02:00