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

cmake // Added Ctest support for unittests #882

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
4 participants
@snikulov
Copy link
Member

commented Jun 16, 2016

Hi all,
I've enabled ctest verification for cmake builds and tests/unit folder.
Now it is possible after build run
on Linux
make test
on Windows
ctest -VV -C <Debug|Release>

@mention-bot

This comment has been minimized.

Copy link

commented Jun 16, 2016

By analyzing the blame information on this pull request, we identified @billhoffman, @Sukender and @Lekensteyn to be potential reviewers

@snikulov

This comment has been minimized.

Copy link
Member Author

commented Jun 16, 2016

@bradking Brad, could you please review and comment? Thank you!

@@ -1042,6 +1042,8 @@ if(BUILD_CURL_EXE)
add_subdirectory(src)
endif()
if(BUILD_CURL_TESTS)
include(CTest)
enable_testing()

This comment has been minimized.

Copy link
@bradking

bradking Jun 16, 2016

Contributor

The CTest module calls enable_testing for us so we don't need to call it here.

This comment has been minimized.

Copy link
@snikulov

snikulov Jun 16, 2016

Author Member

@bradking From which version? Looks I'm a bit outdated here.

This comment has been minimized.

Copy link
@bradking

bradking Jun 16, 2016

Contributor

It has always done this.

This comment has been minimized.

Copy link
@bradking

bradking Jun 16, 2016

Contributor

Note that it depends on BUILD_TESTING.

PROPERTIES COMPILE_DEFINITIONS "UNITTESTS")

add_test(NAME ${_testname}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}

This comment has been minimized.

Copy link
@bradking

bradking Jun 16, 2016

Contributor

I don't think EXECUTABLE_OUTPUT_PATH is set anywhere. I think this line can just be dropped.

This comment has been minimized.

Copy link
@snikulov

snikulov Jun 16, 2016

Author Member

@bradking Agreed. It was copy-paste from my project. But anyway, sometimes it is required for DLL when shared library used in build.

@snikulov snikulov force-pushed the snikulov:ctest_enable branch from 150b555 to 64d7929 Jun 17, 2016

@snikulov

This comment has been minimized.

Copy link
Member Author

commented Jun 17, 2016

@bradking updated and rebased into single commit.

@bradking

This comment has been minimized.

Copy link
Contributor

commented Jun 17, 2016

The CTest module defines a BUILD_TESTING option that controls most of its functionality, including its call to enable_testing. The intended way to use the CTest module is to include it unconditionally and then honor its BUILD_TESTING option:

include(CTest)
if(BUILD_TESTING)
  add_subdirectory(tests)
endif()

However, curl is currently defining its own BUILD_CURL_TESTS option. It also has a code path that includes the CTest module earlier in a BUILD_DASHBOARD_REPORTS condition. These should all be reconciled.

@snikulov

This comment has been minimized.

Copy link
Member Author

commented Jun 17, 2016

@bradking So what is your proposal, exactly? Should I remove BUILD_CURL_TESTS and BUILD_DASHBOARD_REPORTS anywhere in scripts?

@bradking

This comment has been minimized.

Copy link
Contributor

commented Jun 17, 2016

Should I remove BUILD_CURL_TESTS and BUILD_DASHBOARD_REPORTS anywhere in scripts?

That would be the simplest solution. Since the CMake files still warn that they are poorly maintained I don't think anyone expects stability in the current options.

@snikulov

This comment has been minimized.

Copy link
Member Author

commented Jun 20, 2016

@bradking updated.

@bradking

This comment has been minimized.

Copy link
Contributor

commented Jun 20, 2016

The change itself looks good. Please squash in the fixups and revise the commit message to explain the new logic change.

CMake build now using BUILD_TESTING=ON/OFF (default is OFF) to build
tests and enabling CTest integration.
Options BUILD_CURL_TESTS and BUILD_DASHBOARD_REPORTS was removed.

@snikulov snikulov force-pushed the snikulov:ctest_enable branch from 72af5f1 to 0fe6e3c Jun 21, 2016

@snikulov

This comment has been minimized.

Copy link
Member Author

commented Jun 21, 2016

@bradking Done.

@bagder Daniel, Could you please merge?

@bagder bagder closed this in 12e21fa Jun 21, 2016

@bagder

This comment has been minimized.

Copy link
Member

commented Jun 21, 2016

Done, thanks!

Small nit: please make the commit message to follow our commit styles and I'll have an easier job merging your work!

@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.