Skip to content
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

Adapt unit tests #9

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Adapt unit tests #9

wants to merge 3 commits into from

Conversation

andistorm
Copy link
Contributor

@andistorm andistorm commented Feb 5, 2024

…faq.html#testing

Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de>
Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de>
@andistorm andistorm force-pushed the ah-adapt-unit-tests branch from 1b6990d to 442904e Compare February 7, 2024 19:09
@hikinggrass hikinggrass requested a review from a-w50 February 9, 2024 10:23
CMakeLists.txt Outdated
include(CTest)
enable_testing()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://cmake.org/cmake/help/latest/command/enable_testing.html

should not be necessary as we're requiring BUILD_TESTING

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

CMakeLists.txt Outdated Show resolved Hide resolved
Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de>
@andistorm andistorm requested a review from a-w50 February 27, 2024 09:22
@@ -39,7 +40,7 @@ endif()
#
# tests
#
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
if((${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME} OR ${PROJECT_NAME}_BUILD_TESTING) AND BUILD_TESTING)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about the ... AND BUILD_TESTING here, if this is required, we probably will also trigger building tests in our external requirements like libcurl and maybe others

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is the result of the discussion here: EVerest/EVerest#129 and and in the WG CI/CD & Testing.
I understand your concern, could be handled by using the options field in dependencies.yaml (setting BUILD_TESTING=OFF)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has the discussion, you mentioned, taken into account, that requiring BUILD_TESTING would trigger unit tests in the dependencies?
Concerning the setting BUILD_TESTING in the options field - I'm not sure if this will work - because it is an option with global scope. So it can be only on or off, but not on for one project and off for another one.

@@ -16,20 +16,21 @@ if (CODE_COVERAGE)
evc_include(CodeCoverage)
endif()

add_executable(test_state_allocator state_allocator.cpp)
target_link_libraries(test_state_allocator
set(TEST_TARGET_NAME ${PROJECT_NAME}_tests)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TEST_TARGET_NAME is to general here, especially when having multiple tests. There should be a TEST_PREFIX or something similar, which gets prepended to state_allocator

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other repos we re-use that TEST_TARGET_NAME variable for multiple test cases, so setting it to something like

set(TEST_TARGET_NAME ${PROJECT_NAME}_state_allocator_tests)

and later

set(TEST_TARGET_NAME ${PROJECT_NAME}_some_other_target_name_tests)

If we just use a TEST_PREFIX we still have to repeat the appended test name, but an argument could be made for unique variable names

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants