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

Kristofer Tingdahl kristofer.tingdahl at dgbes.com
Tue Sep 11 01:14:23 EDT 2012


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


More information about the CMake mailing list