Resolve "Fix test_subscription_callback"
Closes #50 (closed)
test_subscription_callback
is the only test that uses the test_ping
& test_pong
test nodes. The test times out because the nodes check if argc == 1
(which was intended to be a dummy argument to make the nodes keep executing, as an example for a callback duration analysis).
I added this to the nodes' main()
:
for (int i = 0; i < argc; i++) {
printf("ping|pong %d: %s\n", i, argv[i]);
}
Running test_pong
ros2 run
leads to argc == 0
, which is fine:
$ ros2 run tracetools_test test_pong
ping 0: /home/user/ros2_ws/install/tracetools_test/lib/tracetools_test/test_pong
spinning
But using a launch file adds another argument:
$ ros2 launch tracetools_launch example.launch.py
...
[test_pong-2] ping 0: /home/boc7rng/ros2_ws/install/tracetools_test/lib/tracetools_test/test_pong
[test_pong-2] ping 1: --ros-args
[test_pong-2] spinning
--ros-args
seems to have been added here: https://github.com/ros2/launch_ros/commit/7e4f43156c729839cc8e6dd986f32bcac169a25b
That was committed 9 days ago, so that explains why it only appears in the build_from_source
job.
Solution is just to look for a specific string ("do_more"
) instead of just relying on argc
.
Edited by Christophe Bédard