[CMake] Problems detecting source-code changes in continuous integration ctest script

David Cole david.cole at kitware.com
Tue Sep 11 13:29:59 EDT 2012


We do this in the cmake_common.cmake script to avoid multiple "initial
checkouts":

  # Look for updates.
  ctest_update(RETURN_VALUE count)
  set(CTEST_CHECKOUT_COMMAND) # checkout on first iteration only

ctest_start does an initial checkout if CTEST_CHECKOUT_COMMAND is set.
So in order to have that on initial checkout, but prevent it on
updates, set it to the right thing to begin with, but then unset it
for the duration of the script immediately after the first
ctest_update.

When in doubt, use the cmake_common script as a good reference for how
dashboard scripts should work.

Here's a link to the latest snapshot of cmake_common.cmake:

  http://cmake.org/gitweb?p=cmake.git;a=blob;f=cmake_common.cmake;h=2d7091a7315740ca296cefc17b12a8d63207306f;hb=849820219e84e251ad99121f738456f3743ba4fa


HTH,
David


On Tue, Sep 11, 2012 at 1:14 AM, Kristofer Tingdahl
<kristofer.tingdahl at dgbes.com> wrote:
> Dear list-members,
>
> I am reasonably new to cmake (6 month now), and I have run into some problems:
>
> I have the following script:
> ...
> while ( ${CTEST_ELAPSED_TIME} LESS 82800 ) #23 hours
>     set ( START_TIME ${CTEST_ELAPSED_TIME} )
>     ctest_start (Continuous)
>     ctest_update ( RETURN_VALUE count )
>     message ( "Found ${count} updated files." )
>     if ( ${count} GREATER 0 )
>         ctest_configure()
>         ctest_build()
>         ctest_test()
>         ctest_submit()
>     endif ()
>     ctest_sleep( ${START_TIME} 120 ${CTEST_ELAPSED_TIME})
> endwhile()
> ...
>
>
> Inspired by your script on the wiki site
> (http://www.cmake.org/Wiki/CMake_Scripting_Of_CTest ). I use CVS for
> the version
> control. My problem is that ctest_update ( RETURN_VALUE count ) does
> not always detect updates (i.e. count is set to zero, while there are
> real updates). The build environment is updated with the changed files, but
> count is not set, and the script does not build in the loop. I
> compiled ctest and ran it in the debugger, and I found the following:
>
> 1. cvs checkout is called from ctest_start (Continuous), and the files
> are updated there. The call comes from:
>
> cmProcessTools::RunProcess  at
> /dsk/d46/apps/tmp/cmake-2.8.9/Source/cmProcessTools.cxx:26
> #1  0x082bb7b4 in cmCTestVC::RunChild
>     workDir=0x87b39f4 "/dev/shm/continiousintegration/dgb20_od_ci") at
> /dsk/d46/apps/tmp/cmake-2.8.9/Source/CTest/cmCTestVC.cxx:99
> #2  0x082bb481 in cmCTestVC::InitialCheckout (this=0xffffc2d0,
>     command=0x87b2f84 "\"/usr/bin/cvs\" -d
> :ext:cvsdgb at cvs.opendtect.org:/cvsroot co od")
>     at /dsk/d46/apps/tmp/cmake-2.8.9/Source/CTest/cmCTestVC.cxx:79
> #3  0x0828db91 in cmCTestStartCommand::InitialCheckout
> (this=0x87b42a8, ofs=..., sourceDir=...)
>     at /dsk/d46/apps/tmp/cmake-2.8.9/Source/CTest/cmCTestStartCommand.cxx:164
> #4  0x0828d6ec in cmCTestStartCommand::InitialPass (this=0x87b42a8, args=...)
>     at /dsk/d46/apps/tmp/cmake-2.8.9/Source/CTest/cmCTestStartCommand.cxx:123
>
> 2. When the script runs
> ctest_update ( RETURN_VALUE count )
>
> The environment is already updated, and there are no changes to
> detected (unless something was updated in the few milliseconds between
> the two cvs-calls. It works if I move the ctest_start outside the loop
> (i.e. before), but that is not what the wiki example says. Is this the
> way it is supposed to be? If not, could someone give a hint how it
> should be, so that I can change the code and make a patch. I am using
> cmake 2.8.9.
>
>
> Sincerely,
>
>
> Kristofer Tingdahl
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list