kde unittests integrated in cmake buildsystem
David Faure
faure at kde.org
Tue Feb 14 22:05:21 CET 2006
On Tuesday 14 February 2006 18:23, William A. Hoffman wrote:
> At 10:59 AM 2/14/2006, David Faure wrote:
> >On Sunday 05 February 2006 19:26, Alexander Neundorf wrote:
> >> turn the option KDE4_BUILD_TESTS
> >
> >Ah, that's what I missed.
> >Hmm. Is there a way to have "make test" build them instead?
> >We need an easy way to run unit tests, otherwise nobody will run them.
> >A global kdelibs option doesn't work, since I want to build kdelibs without the
> >tests most of the time, and with the tests sometimes...
>
> There is a way. You can have all of the tests be independent projects.
> Then use the ctest --build-and-test option. That is what we do for cmake.
>
> For example, there is a test in CMake that tests the custom commands,
> and the ADD_TEST line looks like this:
>
> ADD_TEST(CustomCommand ${CMAKE_CTEST_COMMAND}
> --build-and-test
> "${CMake_SOURCE_DIR}/Tests/CustomCommand"
> "${CMake_BINARY_DIR}/Tests/CustomCommand"
> --build-two-config
> --build-generator ${CMAKE_TEST_GENERATOR}
> --build-project CustomCommand
> --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
> --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin"
> --test-command CustomCommand
> )
>
> What this does is runs cmake on the project CustomCommand, then builds and
> runs the test.
Thanks - I'm a bit confused by the solution still. Is that one custom command
for all tests, or do we have to have the above for each test (which would be
a lot of typing, but I guess there could be a macro)?
I guess I'll have to rely on Alex to implement it, this is still a bit too new for me ;-)
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the Kde-buildsystem
mailing list