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

Change cmake test file so it is possible to add separate unit test executables #934

Merged
merged 4 commits into from
Jan 21, 2025

Conversation

maaikez
Copy link
Contributor

@maaikez maaikez commented Jan 10, 2025

Describe your changes

Until now libocpp always used one big test executable. All tests were linked against the whole libocpp library. That is not always necessary and desirable. With some cmake changes, it is possible to add separate test executables.

I changed the utils_tests so it is created as a separate target instead of inside the default libocpp_unit_tests target, just to make it work and to have an example of how you can do this.

Issue ticket number and link

Checklist before requesting a review

tests/CMakeLists.txt Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

In general we should refactor this a bit to move some of the setup code to functions in a dedicated .cmake, but that doesn't have to happen in this PR

…ecutables.

Signed-off-by: Maaike Zijderveld, iolar <git.mail@iolar.nl>
@maaikez maaikez force-pushed the feature/unit_tests_separate_files branch from ebdee53 to db31fd0 Compare January 20, 2025 11:05
Signed-off-by: Maaike Zijderveld, iolar <git.mail@iolar.nl>
Signed-off-by: Maaike Zijderveld, iolar <git.mail@iolar.nl>
set(oneValueArgs NAME PATH)
set(options)
set(multiValueArgs)
cmake_parse_arguments(arg_libocpp_unittest "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
Copy link
Contributor

Choose a reason for hiding this comment

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

this could just be arg to make the following code more readable

Signed-off-by: Maaike Zijderveld, iolar <git.mail@iolar.nl>
@maaikez maaikez merged commit 96e7ae5 into main Jan 21, 2025
8 checks passed
@maaikez maaikez deleted the feature/unit_tests_separate_files branch January 21, 2025 09:01
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.

2 participants