kde unittests integrated in cmake buildsystem

William A. Hoffman billlist at nycap.rr.com
Tue Feb 14 18:23:03 CET 2006


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.

>It seems that turning on that option and typing make again, triggered a full recompile
>of everything in kdelibs....  :((

This seems like a bug, that can be fixed.  My guess is that the config.h file
is somehow being changed.

-Bill



More information about the Kde-buildsystem mailing list