-
Notifications
You must be signed in to change notification settings - Fork 722
Fix testing CMake issue to resolve Rolling regression #961
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
Fix testing CMake issue to resolve Rolling regression #961
Conversation
Welp, I screwed something up based on all the failed CI jobs, I'll give this a closer look |
I think the issue is that many things were actually using the "non-ros" |
if @facontidavide is ok with it I may just strip out the edit: given it wasn't working as I expected... perhaps this was the intended behavior? |
@@ -38,7 +38,7 @@ set(TEST_DEPENDECIES | |||
foonathan::lexy | |||
bt_sample_nodes) | |||
|
|||
if(ament_cmake_FOUND AND BUILD_TESTING) | |||
if(ament_cmake_FOUND) |
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 think the original check is correct
if(ament_cmake_FOUND) | |
if(ament_cmake_FOUND AND BUILD_TESTING) |
The problem here is that gtest was being found and linked transitively via ament_cmake
. We'll likely need to explicitly call find_package(ament_cmake_gtest REQUIRED)
before we call ament_add_gtest
below and add a <test_depend>
for the same in package.xml.
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 mean aren't both of those things true already? See line 43 below for your first point and here: https://github.com/BehaviorTree/BehaviorTree.CPP/blob/4.6.2/package.xml#L27 for the second point
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.
also, as I noted in my comments on the issue, it seems that this case of the if statement isn't even being hit on the build farm
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 don't think this is the right change. -DBUILD_TESTING=OFF
is a widely accepted mechanism to say "don't build the tests". On the buildfarm today, we don't install any of the test dependencies and expect packages to respect -DBUILD_TESTING=OFF
.
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 issue with the way that the CMake is currently structured is that even with -DBUILD_TESTING=OFF
the else
case is going to be hit and it will (attempt to) build the tests anyway. I don't disagree that it should work that way, but it would require more changes elsewhere to actually respect that.
My first attempt at fixing it 'respected' BUILD_TESTING
(...kind of) but that broke the repo's CI because it builds with testing off but still expects the test executable to be present
I'll take a look at your comment in #960 and respond there as well
looks good to me, thanks for addressing this |
Hopefully resolves #960 (with a small typo fix thrown in for good measure)