-
Notifications
You must be signed in to change notification settings - Fork 131
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 runner option to ament_add_test #174
Conversation
@tfoote This is the first of two PRs required to implement isolated testing for ROS2. This change is ROS agnostic, but will allow us to have wrappers around @wjwwood This is the approach we discussed last week that keeps ROS stuff out of ament. I will create a follow-up PR in ament_cmake_ros with the aforementioned wrappers. |
@dirk-thomas can you comment on the change in the dependency structure due to this change? Is it ok or is there a better way to do this to avoid that dependency? |
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.
can you comment on the change in the dependency structure due to this change?
The added dependency looks reasonable to me.
@@ -83,6 +83,7 @@ function(ament_add_gtest_test target) | |||
COMMAND ${cmd} | |||
OUTPUT_FILE "${CMAKE_BINARY_DIR}/ament_cmake_gtest/${target}.txt" | |||
RESULT_FILE "${result_file}" | |||
RUNNER "${ARG_RUNNER}" |
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.
Should this not be added conditionally only - same as in 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.
I'll make it match the style of the other arguments. Note that ament_add_gtest
does things differently than ament_add_gtest_test
and ament_add_pytest_test
even before my change
f0dc669
to
5115416
Compare
@dirk-thomas Ok, I think the history is fixed now. Git blame on github, and on my machine now shows you and William wrote most of the code of |
@dirk-thomas Ok, I think this is ready to go. I believe I've addressed all of your comments and I tested it along with ros2/ament_cmake_ros#3 and verified that rcl and rclpy can use the new 'isolated' version of the test functions successfully |
Since we don't want to squash on merge can you please squash the commit 4 (and soon 5) into the first commit. Thanks. |
- By default, still uses run_test.py - Example use case: ament_cmake_ros can use a test runner that sets a ROS_DOMAIN_ID Signed-off-by: Pete Baughman <[email protected]>
- This should let us see the history Signed-off-by: Pete Baughman <[email protected]>
- Adds an ament_cmake_test python package Signed-off-by: Pete Baughman <[email protected]>
5e8b15b
to
e46066c
Compare
@dirk-thomas Done |
Thanks for the enhancement. |
* ament_cmake allow speficiation of a different test runner - By default, still uses run_test.py - Example use case: ament_cmake_ros can use a test runner that sets a ROS_DOMAIN_ID Signed-off-by: Pete Baughman <[email protected]> * ament_cmake move run_test.py to a python module - This should let us see the history Signed-off-by: Pete Baughman <[email protected]> * ament_cmake refactor run_test.py into an importable python module - Adds an ament_cmake_test python package Signed-off-by: Pete Baughman <[email protected]>
* ament_cmake allow speficiation of a different test runner - By default, still uses run_test.py - Example use case: ament_cmake_ros can use a test runner that sets a ROS_DOMAIN_ID Signed-off-by: Pete Baughman <[email protected]> * ament_cmake move run_test.py to a python module - This should let us see the history Signed-off-by: Pete Baughman <[email protected]> * ament_cmake refactor run_test.py into an importable python module - Adds an ament_cmake_test python package Signed-off-by: Pete Baughman <[email protected]> Signed-off-by: Steven! Ragnarök <[email protected]>
* Add runner option to ament_add_test (#174) * ament_cmake allow speficiation of a different test runner - By default, still uses run_test.py - Example use case: ament_cmake_ros can use a test runner that sets a ROS_DOMAIN_ID Signed-off-by: Pete Baughman <[email protected]> * ament_cmake move run_test.py to a python module - This should let us see the history Signed-off-by: Pete Baughman <[email protected]> * ament_cmake refactor run_test.py into an importable python module - Adds an ament_cmake_test python package Signed-off-by: Pete Baughman <[email protected]> Signed-off-by: Steven! Ragnarök <[email protected]> * improve handling of encoding (#181) Signed-off-by: Dirk Thomas <[email protected]> Signed-off-by: Steven! Ragnarök <[email protected]> * use deterministic order for updated env vars (#196) Signed-off-by: Dirk Thomas <[email protected]> Signed-off-by: Steven! Ragnarök <[email protected]> * Run tests in current binary directory, not global source directory (#206) Switch to CMAKE_CURRENT_BINARY_DIR for consistency with CTest Signed-off-by: Dan Rose <[email protected]> Signed-off-by: Steven! Ragnarök <[email protected]> * remove status attribute from result XML, add skipped tag instead (#218) Signed-off-by: Dirk Thomas <[email protected]> Signed-off-by: Steven! Ragnarök <[email protected]> * Declare AMENT_TEST_RESULTS_DIR as a PATH (#221) Signed-off-by: Dan Rose <[email protected]> Signed-off-by: Steven! Ragnarök <[email protected]> * Generate xunit files valid for the junit10.xsd Signed-off-by: Jose Luis Rivero <[email protected]> Signed-off-by: Steven! Ragnarök <[email protected]> * Revert "Run tests in current binary directory, not global source directory (#206)" This reverts commit 4354d62. Signed-off-by: Steven! Ragnarök <[email protected]> Co-authored-by: Peter Baughman <[email protected]> Co-authored-by: Dirk Thomas <[email protected]> Co-authored-by: Dan Rose <[email protected]> Co-authored-by: Jose Luis Rivero <[email protected]>
Allow the user of
ament_add_gtest
andament_add_pytest_test
to specify a different test runner. This will be used by ROS2 tests so they can optionally specify a runner that provides isolation between tests running in parallel(resolves #172)
A note about changing dependencies:
Previously, the dependencies for ament_cmake_test looked like this:
In this PR, I changed run_test.py from a python script to a python script that imports most of its functionality from a new python library called
ament_add_test
. This required me to change the dependencies of ament_cmake_test to depend on ament_cmake_python. Now the deps look like this:As you can see, this did not cause many other indirect dependencies. Since ament_cmake_test relied on python anyway (to execute run_test.py) I think this is OK.