-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for parameters #14
Conversation
Invoking the test launch files directly fails with:
Update: fixed in 2cae78f1d14486a282936774ebe4d08f4f7bf3b0 |
The Python launch file does not follow the style conventions. |
PROPERTIES DEPENDS "test_parameters_cpp__${middleware_impl1}" | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the two empty lines.
Instead of streaming to cout / cerr incrementally this should use printf / fprintf to avoid interleaving. |
Connext Dynamic fails with the following for me which indicate some type mismatch:
Update: |
The Connext dynamic test currently hangs forever since the sync API has no timeouts. May be it would be better to cover the async API in a first test which has timeouts instead. Update: seems to work now. |
0d91358
to
3094070
Compare
@dirk-thomas I pushed a test that exposes the issue with subscriptions not being fired. The test will hang at the end because we |
The current behavior is that So either rmw has to always return as long as not yet taken samples are available or the executor has to handle available sample after wait returns. Since the |
@dirk-thomas I have a local branch that modifies the executors so that there's a global default one that can be reused instead of instantiating a new one. |
#20 contains a test for the spinning problem. ros2/rmw_connext#62 fixes the behavior of |
@esteve Can you please implement a similar fix as ros2/rmw_connext#62 (and for opensplice) to change the conditions for services too? I would expect that to fix this broken test. |
@dirk-thomas I won't be able to do it today or tomorrow, so if you have the fix fresh in your mind, go for it. Thanks! |
The patch will look exactly the same way as for the subscription. Nothing new or different, just effort to put it together. It can wait until you (or @tfoote) have time for it. |
db45df1
to
750b571
Compare
I've updated it to use gtest and actually test the results. It's revealed some underlying errors. The returned parameters have different values than the set parameters. I will next look at the implementation to try to get the unit tests passing. I triggered a CI job to verify the same behavior on the farm: http://ci.ros2.org/job/ros2_batch_ci_linux/122/
|
16b4bad
to
29fa865
Compare
ros2/rmw_connext#66 should fix the services issue |
06e1628
to
31bd174
Compare
e81a761
to
bbe6adf
Compare
This is blocked by #29 before it can be merged. |
6e5336f
to
45be86d
Compare
@@ -131,6 +133,42 @@ if(AMENT_ENABLE_TESTING) | |||
"rclcpp") | |||
endif() | |||
|
|||
ament_add_gtest(local_parameters_cpp__${middleware_impl} "test/local_parameters.cpp") | |||
add_dependencies(local_parameters_cpp__${middleware_impl} ${PROJECT_NAME}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before using the gtest target you must check that it actually exists (e.g. when gtest is not found):
if(TARGET local_parameters_cpp__${middleware_impl})
Same below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just added both to CMakeLists.txt
, let me know if they look ok and I'll squash and merge this PR.
45be86d
to
618d89a
Compare
I've removed the tests for the |
618d89a
to
3a551ad
Compare
It looks like we still have intermittent failures in the services. The OSX build failed with: test_requester_replier_cpp__empty__rmw_opensplice_cpp.test_requester_replier I retriggered the linux and osx jobs: Update: the above tests passed Windows still has 28 failures which is our baseline at the moment. |
@tfoote should we merge this PR? I don't see a reason why not, the intermittent failures are not introduced by this PR, and these changes will just make it easier to watch for errors in the parameters code. |
@@ -135,6 +137,46 @@ if(AMENT_ENABLE_TESTING) | |||
"rclcpp") | |||
endif() | |||
|
|||
if(TARGET local_parameters_cpp__${middleware_impl}) | |||
ament_add_gtest(local_parameters_cpp__${middleware_impl} "test/local_parameters.cpp") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cpp file contains a main function and should therefore not link against gtest's main function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the solution here? Remove the main function from local_parameters.cpp
or not add it with ament_add_gtest
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an argument to SKIP_LINKING_MAIN_LIBRARIES I'll take care of that and clean up the whitespace above before we merge.
3a551ad
to
97efbef
Compare
I've amended for dirk's comment about the main. And cleared a few whitespace only changes. CI pending: |
All tests pass except the one lower level test, tickted in #37 http://ci.ros2.org/job/ros2_batch_ci_osx/218/testReport/junit/%28root%29/test_requester_replier_cpp__primitives__rmw_opensplice_cpp/test_requester_replier/ |
This has some basic tests. However I need some help on the RTI Connext Dynamic implmeentation tests which hang.
How much details do we want to implement before we add support for a testing framework like gtest. Writing detailed unit tests with return values only is not very productive.
This is currently running the tests and checking their values only.
Connects to #10