[CMake] ctest puts LD_LIBRARY_PATH into environment impacts sub-runs of cmake/ctest

Bill Hoffman bill.hoffman at kitware.com
Tue Sep 9 15:29:39 EDT 2008


Wheeler, Frederick W (GE, Research) wrote:

> Thanks for this helpful tip, which is panning out well, though I'm still
> testing/fixing a few things.  I have a few follow-up questions, and I'm
> grateful for any advice on any of them from anybody.
> 
> 1.  What is the right way to add a notes file when ctest-scripting like
> this?  Is there a script equivalent of the command-line option ctest -A
> Notes.txt ?   Or does -A Notes.txt still need to be on the ctest
> command-line?
> 
SET (CTEST_NOTES_FILES
      "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")


> 2.  Does it make sense to use both CTEST_TEST() *and* CTEST_MEMCHECK()
> for valgrind builds?  I've always just done one of the other, but cannot
> remember why.
> 
Yes it does, they are separate operations.   If you do not run 
ctest_test(), then you will get an empty test column on the dashboard.


> 3.  There used to be a file $BLDTREE/Testing/TAG that had the date
> string (e.g. "20080909-1705") of the most recent output directory used
> by ctest.  I've been checking for the presence of
> $BLDTREE/Testing/string_taken_from_TAG/Configure.xml to determine
> whether a continuous ctest build just the a CVS update and found no
> changes, or did a CVS update and then did a build/test/submit.  My
> reason is that if a continuous build actually does something I want to
> trigger dependent builds (other cmake projects), but not otherwise.  So
> my question is this: if I'm right that TAG is now gone, how can I
> determine whether a continuous build actually did build.  Hmmm.  I guess
> I could use CTEST_UPDATE( SOURCE "\${CTEST_SOURCE_DIRECTORY}"
> RETURN_VALUE res ) and write a file or not based on 'res'.  Is that the
> right thing to do here?
> 
Using res is the right thing to use for that.

For example, I have a paraview derivative project that does this:

function(update_and_build_paraview)
   # first update paraview
   message("update and build ParaView")
   execute_process(COMMAND
     "c:/Program Files/TortoiseCVS/cvs.exe"
     update -dAP
     WORKING_DIRECTORY "c:/Dashboards/My Tests/ParaView3")
   ctest_build (BUILD "c:/Dashboards/My Tests/ParaView3VS8Nightly")
endfunction(update_and_build_paraview)

ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY})
while (${CTEST_ELAPSED_TIME} LESS 36000)
   set (START_TIME ${CTEST_ELAPSED_TIME})
   ctest_start (Continuous)
   ctest_update (SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE res)
   # force a build if this is the first run and the build dir is empty
   if(NOT EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
     set(res 1)
     message("first time build")
     file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "
ParaView_DIR:PATH=${CTEST_DASHBOARD_ROOT}/ParaView3VS8Nightly
")
   endif(NOT EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
   if("${res}" GREATER "0")
     message("Found changes run build")
     update_and_build_paraview()
     ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}")
     ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}")
     ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}")
     ctest_test  (BUILD "${CTEST_BINARY_DIRECTORY}")
     ctest_submit ()
   endif("${res}" GREATER "0")
   # loop no faster than once every 5 minutes
   message("wait for 5 minutes")
   ctest_sleep( ${START_TIME} 300 ${CTEST_ELAPSED_TIME})
endwhile(${CTEST_ELAPSED_TIME} LESS 36000)

> 4.  With my older ctest command-line runs, continuous builds used to
> automatically end if there were no changes during the CVS update.  Is
> that still true with these ctest scripts?  My guess is no, and you need
> to check the RETURN_VALUE of CTEST_UPDATE and take care of this yourself
> by putting the rest of the steps in an IF/ENDIF.  Is that right?
> 

See the above while loop.

-Bill


More information about the CMake mailing list