CTest

Alexander Neundorf neundorf at kde.org
Sun Feb 21 22:13:43 CET 2010


On Friday 19 February 2010, Patrick Spendrin wrote:
> Hi everybody,
>
> I just tried out CTest today and did some work on integration into the
> kde-windows buildsystem.
> One question is still keeping me away from getting it done completely:
>
> Currently I use the following commandline to update, configure and build
> a package:
> ctest -M Nightly -T Start -T Update -T Configure -T Build -T Submit
>
> this requires a configured builddirectory though, e.g. you need to have
> run CMake in your builddir first.

Yes, this "bootstrapping" is one of the bigger issues. Without digging up the 
details, this is one of things which can be done better with the ctest 
scripts.

> What I'd like to know is whether I could add the flags we hand over to
> cmake via commandline, e.g. can I somehow run cmake only via ctest?

Yes and no. Yes, you can run cmake via ctest, but no, not via the command line 
(AFAIK), just via a ctest script.


Please check out kdesdk/cmake/nightly_support/.

I just committed a new and modified version of the ctest scripts which are 
used currently for the nightly builds there. This should make running a 
nightly build easier.

Right now I added files only for kdelibs and automoc4.
If this works for you (or if we can get it working for you...) we can add 
scripts for all the other modules there.

So, in kdesdk/cmake/nightly_support/ there is a file KDECTestNightly.cmake.
This file provides some macros and logic which help with setting everything up 
(e.g. how and where to run cmake etc.).

Then there are currently subdirectory kdesupport (for scripts for the 
components of kdesupport, right now only automoc4), KDE (trunk/KDE/, i.e. KDE 
SC IIRC, right now only kdelibs), koffice and extragear (both still empty).

So, how to run a nightly build for automoc ?

Basically:
ctest -S nightly_support/kdesupport/Automoc4Nightly.cmake

If the environment variable CMAKE_PREFIX_PATH (or PATH) is set up so that Qt 
can be found, this will do everything. It will create a source directory for 
the nightly build, check it out from svn, create a build directory, build 
automoc, run the (nonexisting) tests, and submit the results to the 
dashboard.

You may want to add the options -V and -VV to ctest to make ctest more 
verbose, so you see what's going on.

Also you can give options to the ctest-script.
E.g.
KDE_CTEST_BUILD_SUFFIX: this is a string which will be appended to the build 
name on cdash. The name and version of the compiler are a good option 
(e.g. "gcc-4.3.2").

DO_INSTALL : if TRUE, after building the project will also be installed

CMAKE_INSTALL_PREFIX: you probably want to set this if you set DO_INSTALL to 
TRUE

So, a full command line could look like

ctest -V -VV -S 
nightly_support/kdesupport/Automoc4Nightly.cmake,KDE_CTEST_BUILD_SUFFIX=gcc-4.2.3,DO_INSTALL=TRUE,CMAKE_INSTALL_PREFIX=/opt/automoc4


This really should take care of everything.

It also tries to automatically figure out which cmake generator to use.
If you do this on Windows, it will generate nmake makefiles if cl.exe is found 
in the PATH. Are you using cl or are you using mingw ?
Please have a look at KDECTestNightly.cmake, the part where 
CTEST_CMAKE_GENERATOR is determined. This may have to be tweaked for Windows 
until it does what you need.

Please give the automoc4 file a try.
If it there are any issues or wishes, please let me know.

Alex


More information about the Kde-buildsystem mailing list