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? |
dirk-thomas
left a comment
There was a problem hiding this comment.
can you comment on the change in the dependency structure due to this change?
The added dependency looks reasonable to me.
| 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.
Should this not be added conditionally only - same as in ament_add_gtest?
There was a problem hiding this comment.
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 <pete.baughman@apex.ai>
- This should let us see the history Signed-off-by: Pete Baughman <pete.baughman@apex.ai>
- Adds an ament_cmake_test python package Signed-off-by: Pete Baughman <pete.baughman@apex.ai>
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 <pete.baughman@apex.ai>
* ament_cmake move run_test.py to a python module
- This should let us see the history
Signed-off-by: Pete Baughman <pete.baughman@apex.ai>
* ament_cmake refactor run_test.py into an importable python module
- Adds an ament_cmake_test python package
Signed-off-by: Pete Baughman <pete.baughman@apex.ai>
* 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 <pete.baughman@apex.ai>
* ament_cmake move run_test.py to a python module
- This should let us see the history
Signed-off-by: Pete Baughman <pete.baughman@apex.ai>
* ament_cmake refactor run_test.py into an importable python module
- Adds an ament_cmake_test python package
Signed-off-by: Pete Baughman <pete.baughman@apex.ai>
Signed-off-by: Steven! Ragnarök <steven@nuclearsandwich.com>
* 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 <pete.baughman@apex.ai> * ament_cmake move run_test.py to a python module - This should let us see the history Signed-off-by: Pete Baughman <pete.baughman@apex.ai> * ament_cmake refactor run_test.py into an importable python module - Adds an ament_cmake_test python package Signed-off-by: Pete Baughman <pete.baughman@apex.ai> Signed-off-by: Steven! Ragnarök <steven@nuclearsandwich.com> * improve handling of encoding (#181) Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com> Signed-off-by: Steven! Ragnarök <steven@nuclearsandwich.com> * use deterministic order for updated env vars (#196) Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com> Signed-off-by: Steven! Ragnarök <steven@nuclearsandwich.com> * 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 <dan@digilabs.io> Signed-off-by: Steven! Ragnarök <steven@nuclearsandwich.com> * remove status attribute from result XML, add skipped tag instead (#218) Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com> Signed-off-by: Steven! Ragnarök <steven@nuclearsandwich.com> * Declare AMENT_TEST_RESULTS_DIR as a PATH (#221) Signed-off-by: Dan Rose <dan@digilabs.io> Signed-off-by: Steven! Ragnarök <steven@nuclearsandwich.com> * Generate xunit files valid for the junit10.xsd Signed-off-by: Jose Luis Rivero <jrivero@osrfoundation.org> Signed-off-by: Steven! Ragnarök <steven@nuclearsandwich.com> * Revert "Run tests in current binary directory, not global source directory (#206)" This reverts commit 4354d62. Signed-off-by: Steven! Ragnarök <steven@nuclearsandwich.com> Co-authored-by: Peter Baughman <dblue135@yahoo.com> Co-authored-by: Dirk Thomas <dirk-thomas@users.noreply.github.com> Co-authored-by: Dan Rose <rotu@users.noreply.github.com> Co-authored-by: Jose Luis Rivero <jrivero@osrfoundation.org>
Allow the user of
ament_add_gtestandament_add_pytest_testto 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.