Skip to content

check rmw id using RCL_ASSERT_RMW_ID_MATCHES - #51

Merged
tfoote merged 4 commits into
masterfrom
check_identifier_by_env
May 3, 2016
Merged

tfoote merged 4 commits into
masterfrom
check_identifier_by_env

Conversation

@wjwwood

@wjwwood wjwwood commented Apr 26, 2016

Copy link
Copy Markdown
Member

With this pr, if you set RCL_CHECK_RMW_ID_MATCHES_OR_DIE to an rmw implementation like rmw_connext_cpp, and the librcl that your program is using returns a different answer it will exit with return code 1 before running the main. If the environment variable is not set, then nothing happens.

Taking an rcl test as an example:

william@farl ~/ros2_ws/build_isolated/rcl/test (git:master:fc1a991)
% ./test_time__rmw_connext_cpp
Running main() from gtest_main.cc
[==========] Running 8 tests from 2 test cases.
...
[==========] 8 tests from 2 test cases ran. (102 ms total)
[  PASSED  ] 8 tests.

william@farl ~/ros2_ws/build_isolated/rcl/test (git:master:fc1a991)
% RCL_CHECK_RMW_ID_MATCHES_OR_DIE=rmw_connext_cpp ./test_time__rmw_connext_cpp
Running main() from gtest_main.cc
[==========] Running 8 tests from 2 test cases.
...
[==========] 8 tests from 2 test cases ran. (103 ms total)
[  PASSED  ] 8 tests.

william@farl ~/ros2_ws/build_isolated/rcl/test (git:master:fc1a991)
% RCL_CHECK_RMW_ID_MATCHES_OR_DIE=rmw_opensplice_cpp ./test_time__rmw_connext_cpp
Expected RMW implementation identifier of 'rmw_opensplice_cpp' but instead found 'rmw_connext_cpp', exiting with 1.

william@farl ~/ros2_ws/build_isolated/rcl/test (git:master:fc1a991)
% echo $?
1

This would be used with @dhood's pr, see: ros2/examples#106 (comment)

@wjwwood wjwwood added the in progress Actively being worked on (Kanban column) label Apr 26, 2016
@tfoote

tfoote commented Apr 26, 2016

Copy link
Copy Markdown
Contributor

Use assert in the name.

@dhood

dhood commented Apr 26, 2016

Copy link
Copy Markdown
Member

I've got this linter failure too:

5: Test command: /usr/bin/python3 "-u" "/home/dhood/ros2_ws/install_isolated/ament_cmake_test/share/ament_cmake_test/cmake/run_test.py" "/home/dhood/src/rcl/build/rcl/test_results/rcl/uncrustify.xunit.xml" "--output-file" "/home/dhood/src/rcl/build/rcl/ament_uncrustify/uncrustify.txt" "--command" "/home/dhood/ros2_ws/install_isolated/ament_uncrustify/bin/ament_uncrustify" "--xunit-file" "/home/dhood/src/rcl/build/rcl/test_results/rcl/uncrustify.xunit.xml"
5: Test timeout computed to be: 60
5: -- run_test.py: invoking following command in '/home/dhood/src/rcl/rcl':
5:  - /home/dhood/ros2_ws/install_isolated/ament_uncrustify/bin/ament_uncrustify --xunit-file /home/dhood/src/rcl/build/rcl/test_results/rcl/uncrustify.xunit.xml
5: Code style divergence in file 'src/rcl/rmw_implementation_identifier_check.c':
5: 
5: --- src/rcl/rmw_implementation_identifier_check.c
5: +++ src/rcl/rmw_implementation_identifier_check.c.uncrustify
5: @@ -35,4 +35,4 @@
5: -    static void f(void); \
5: -    __declspec(allocate(".CRT$XCU")) void (*f##_)(void) = f; \
5: -    __pragma(comment(linker, "/include:" p #f "_")) \
5: -    static void f(void)
5: +  static void f(void); \
5: +  __declspec(allocate(".CRT$XCU")) void(*f ## _)(void) = f; \
5: +  __pragma(comment(linker, "/include:" p #f "_")) \
5: +  static void f(void)
5: @@ -46,2 +46,2 @@
5: -    static void f(void) __attribute__((constructor)); \
5: -    static void f(void)
5: +  static void f(void) __attribute__((constructor)); \
5: +  static void f(void)
5: @@ -50,2 +50 @@
5: -INITIALIZER(initialize)
5: -{
5: +INITIALIZER(initialize) {
5: 

@wjwwood wjwwood added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Apr 26, 2016
@wjwwood
wjwwood force-pushed the check_identifier_by_env branch from 87c8a11 to 359acae Compare April 26, 2016 23:12
@wjwwood

wjwwood commented Apr 26, 2016

Copy link
Copy Markdown
Member Author

I renamed to RCL_ASSERT_RMW_ID_MATCHES and addressed the style issues that @dhood pointed out. I also changed it so it has a specific return code when it fails.

Here is CI (just Linux to start):

@wjwwood

wjwwood commented Apr 27, 2016

Copy link
Copy Markdown
Member Author

I think the 3 failures (technically 4, but two of the entries are the same failure) on the Linux CI are flakey. OS X passes green and Windows has failures, but they don't seem related:

I'd appreciate final reviews so I can merge and @dhood can make use of them.

@dhood

dhood commented Apr 27, 2016

Copy link
Copy Markdown
Member

does that talker_listener test usually fail on windows? I don't think I've seen it failing before

@wjwwood

wjwwood commented Apr 27, 2016

Copy link
Copy Markdown
Member Author

@dhood good point, I'll dig into it. Based on my changes I expected lots of new things to fail or nothing new to fail, but I'll look into the talker-listener example to see what's up.

@wjwwood wjwwood changed the title check rmw id using RCL_CHECK_RMW_ID_MATCHES_OR_DIE check rmw id using RCL_ASSERT_RMW_ID_MATCHES Apr 27, 2016
@wjwwood

wjwwood commented Apr 27, 2016

Copy link
Copy Markdown
Member Author

@wjwwood

wjwwood commented Apr 27, 2016

Copy link
Copy Markdown
Member Author

Still looking for up/down votes on merging this as-is.

@dhood

dhood commented Apr 27, 2016

Copy link
Copy Markdown
Member

the talker-listener one is new, but I don't think it was caused by this: it was in the most-recent nightly: http://ci.ros2.org/view/nightly/job/nightly_win_rel/62/#showFailuresLink but before that nightly I haven't seen it before

@wjwwood

wjwwood commented Apr 27, 2016

Copy link
Copy Markdown
Member Author

If it's in the nightly then that's good evidence that this is not a regression of this pr.

@dhood

dhood commented Apr 27, 2016

Copy link
Copy Markdown
Member

yes I agree

@tfoote tfoote assigned tfoote and wjwwood and unassigned tfoote May 3, 2016
@tfoote
tfoote merged commit 2c9320f into master May 3, 2016
@tfoote
tfoote deleted the check_identifier_by_env branch May 3, 2016 20:38
@tfoote tfoote removed the in review Waiting for review (Kanban column) label May 3, 2016
skyegalaxy pushed a commit to irobot-ros/rcl that referenced this pull request Mar 12, 2025
Fixes to support proper lifecycle of the rmw objects and other tear down issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants