Repository navigation
Enable unit tests to run in parallel - #630
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #630 +/- ##
==========================================
+ Coverage 83.40% 83.96% +0.56%
==========================================
Files 127 128 +1
Lines 8559 8565 +6
Branches 3913 3914 +1
==========================================
+ Hits 7139 7192 +53
+ Misses 998 962 -36
+ Partials 422 411 -11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
There was a problem hiding this comment.
🟡 Changes recommended
Inserting the new port fields before reverse_ip breaks existing positional aggregate initializers of the public UrDriverConfiguration struct, causing compilation errors; they should be appended after socket_connect_timeout.
1 open issue
What changed in this PR
This PR reduces port conflicts so the library’s network unit tests can run in parallel, with supporting APIs for configurable ports and runtime port discovery.
Changes:
- Replace fixed test ports with ephemeral ports and reserve non-listening ports for connection-refusal tests.
- Add port configuration and accessors, and use bound ports in generated robot scripts.
- Enable parallel CTest execution across CI platforms.
| File | Description |
|---|---|
| tests/test_utils.h | Add the RefusedPort helper. |
| tests/test_ur_driver_tool_voltage.cpp | Use dynamically assigned fake-robot and driver ports. |
| tests/test_trajectory_point_interface.cpp | Connect clients to the assigned interface port. |
| tests/test_tcp_socket.cpp | Use ephemeral ports and reserved refusal ports. |
| tests/test_tcp_server.cpp | Replace fixed ports with bound-port discovery. |
| tests/test_stream.cpp | Use dynamic connection and refusal ports. |
| tests/test_script_sender.cpp | Discover the script sender’s port. |
| tests/test_script_command_interface.cpp | Use ephemeral script-command ports. |
| tests/test_rtde_writer.cpp | Connect streams to dynamically assigned ports. |
| tests/test_rtde_client_reconnect.cpp | Preserve the assigned port across server restarts. |
| tests/test_rtde_client_fake_server.cpp | Discover fake RTDE server ports. |
| tests/test_rtde_allocations.cpp | Use an ephemeral fake RTDE port. |
| tests/test_producer.cpp | Use dynamic server and refusal ports. |
| tests/test_pipeline.cpp | Use dynamic server and refusal ports. |
| tests/test_dashboard_client.cpp | Pass assigned ports to dashboard clients. |
| tests/test_client_connect_timeout.cpp | Configure clients with ephemeral test-server ports. |
| tests/fake_rtde_server.h | Expose the bound server port. |
| src/ur/ur_driver.cpp | Honor configured ports and publish bound script ports. |
| src/ur/dashboard_client.cpp | Forward the configurable G5 dashboard port. |
| src/ur/dashboard_client_implementation_g5.cpp | Initialize the configured dashboard port. |
| include/ur_client_library/ur/ur_driver.h | Add connection-port settings and a script-command port accessor. |
| include/ur_client_library/ur/dashboard_client.h | Add an optional G5 dashboard port parameter. |
| include/ur_client_library/ur/dashboard_client_implementation_g5.h | Declare configurable G5 port support. |
| include/ur_client_library/control/script_sender.h | Expose the bound script-sender port. |
| .github/workflows/win-build.yml | Enable processor-count-based parallel tests on Windows. |
| .github/workflows/mac-build.yml | Enable processor-count-based parallel tests on macOS. |
| .github/workflows/ci.yml | Enable processor-count-based parallel tests on Linux. |
| .github/workflows/alpine-build.yml | Enable processor-count-based parallel tests on Alpine. |
Review effort: Balanced
8856fc5 to
6048e69
Compare
6048e69 to
e27db94
Compare
UrDriverConfiguration gains rtde_port and primary_port, and the G5 dashboard client an optional port. Tests bind port 0 and read the real port back instead of sharing fixed ports, so no test needs a lock. The control script now gets the ports the driver actually bound, and unit-test CI runs ctest -j.
getDataPackage() with an empty unique_ptr try-locked reconnect_mutex_ to copy the output layout, but the background reader holds that mutex while it waits on the socket, so the call failed at once instead of waiting for data. Copy the layout from the background read buffer under read_mutex_ instead, as the allocating overload already does.
e27db94 to
e9ceae3
Compare
|
@urfeex please review this with a special focus on src/rtde/rtde_client.cpp |
|
This pull request is merged. |
data_buffer0_ is set when background reading starts and kept after it stops, so its presence does not mean the reader is running. Check background_read_running_ before copying it when receiving into an empty pointer.

Tests that own both ends of a connection bind port 0 and read the real
port back via getPort(), instead of sharing fixed ports. Tests that need
a refused connection hold a bound, non-listening socket (RefusedPort in
test_utils.h) rather than assuming 12321 or 12322 is free.