Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged

Conversation

sarcasticnature
Copy link
Contributor

Hopefully resolves #960 (with a small typo fix thrown in for good measure)

@sarcasticnature sarcasticnature marked this pull request as draft April 15, 2025 02:38
@sarcasticnature
Copy link
Contributor Author

Welp, I screwed something up based on all the failed CI jobs, I'll give this a closer look

@sarcasticnature
Copy link
Contributor Author

I think the issue is that many things were actually using the "non-ros" else clause in the testing CMake because they had BUILD_TESTING set to OFF (even though they actually use the test executable...)

@sarcasticnature
Copy link
Contributor Author

sarcasticnature commented Apr 15, 2025

if @facontidavide is ok with it I may just strip out the BUILD_TESTING given it wasn't working as expected anyway

edit: given it wasn't working as I expected... perhaps this was the intended behavior?

@sarcasticnature sarcasticnature marked this pull request as ready for review April 15, 2025 02:56
@@ -38,7 +38,7 @@ set(TEST_DEPENDECIES
foonathan::lexy
bt_sample_nodes)

if(ament_cmake_FOUND AND BUILD_TESTING)
if(ament_cmake_FOUND)
Copy link
Contributor

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

Suggested change
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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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

#960 (comment)

Copy link

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.

Copy link
Contributor Author

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

@facontidavide
Copy link
Collaborator

looks good to me, thanks for addressing this

@facontidavide facontidavide merged commit 3a00bc3 into BehaviorTree:master Apr 16, 2025
9 of 10 checks passed
@sarcasticnature sarcasticnature deleted the bugfix/rolling-regression branch April 16, 2025 18:23
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.

Regression on ROS 2 Buildfarm for Rolling
4 participants