[CMake] How to set build configuration when using CDash test scheduling?

David Cole david.cole at kitware.com
Mon Nov 28 08:54:51 EST 2011


If you're using 2.8.6 (you said you were, right?) ... do this:

  set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")

instead of this:

  set(CTEST_BUILD_CONFIGURATION "${JOB_BUILD_CONFIGURATION}")

Setting both will not hurt, but if both are set,
CTEST_CONFIGURATION_TYPE is used, and not CTEST_BUILD_CONFIGURATION.
Adding that variable was part of the bug fix for
http://public.kitware.com/Bug/view.php?id=2336, which was fixed back
in December, 2009...


HTH,
David


On Mon, Nov 28, 2011 at 6:30 AM, Nils Gladitz <gladitz at sci-vis.de> wrote:
> I'm using CDash's (1.8.2) test scheduling and have trouble with a few tests
> added with the newer "add_test(NAME ..." signature.
> Tests added with the new signature are "Not Run" and I get the following
> test output:
>
>    Test not available without configuration. (Missing "-C <config>"?)
>
> On a client machine ctest (2.8.6 on windows with Visual Studio 2010) runs in
> script mode polling for new test jobs from my CDash instance; jobs are run
> with different configurations.
> The build configuration gets picked up properly by the build (I assume
> "ctest_build" - I can see files in the Debug/Release output directory as
> configured via CDash).
>
> What do I have to do so the test command (I assume) "ctest_test" picks this
> up as well?
>
> I use the preconfigured client script with an additional
> "ctest_empty_binary_directory" before the initial cache gets written:
>
>    # From this line down, this script may be customized
>    # on the Clients tab of the CDash createProject page.
>    #
>    if(JOB_MODULE)
>      set(SOURCE_NAME ${JOB_MODULE})
>      if(JOB_TAG)
>        set(SOURCE_NAME ${SOURCE_NAME}-${JOB_TAG})
>      endif()
>    else()
>      set(SOURCE_NAME ${PROJECT_NAME})
>      if(JOB_BUILDNAME_SUFFIX)
>        set(SOURCE_NAME ${SOURCE_NAME}-${JOB_BUILDNAME_SUFFIX})
>      endif()
>    endif()
>
>    set(CTEST_SOURCE_NAME ${SOURCE_NAME})
>    set(CTEST_BINARY_NAME ${SOURCE_NAME}-bin)
>    set(CTEST_DASHBOARD_ROOT "${CLIENT_BASE_DIRECTORY}")
>    set(CTEST_SOURCE_DIRECTORY
> "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}")
>    set(CTEST_BINARY_DIRECTORY
> "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}")
>    set(CTEST_CMAKE_GENERATOR "${JOB_CMAKE_GENERATOR}")
>    set(CTEST_BUILD_CONFIGURATION "${JOB_BUILD_CONFIGURATION}")
>
>    set(CTEST_SITE "${CLIENT_SITE}")
>    set(CTEST_BUILD_NAME
> "${JOB_OS_NAME}-${JOB_OS_VERSION}-${JOB_OS_BITS}-${JOB_COMPILER_NAME}-${JOB_COMPILER_VERSION}")
>    if(JOB_BUILDNAME_SUFFIX)
>      set(CTEST_BUILD_NAME ${CTEST_BUILD_NAME}-${JOB_BUILDNAME_SUFFIX})
>    endif()
>
>    if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
>      set(CTEST_CHECKOUT_COMMAND "svn co ${JOB_REPOSITORY} ${SOURCE_NAME}")
>    endif()
>    set(CTEST_UPDATE_COMMAND "svn")
>
>    ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}")
>
>    file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt"
> "${JOB_INITIAL_CACHE}")
>
>    ctest_start(${JOB_BUILDTYPE})
>    ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY})
>    ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
>    ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
>    ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
>    # The following lines are used to associate a build id with this job.
>    set(CTEST_DROP_SITE ${JOB_DROP_SITE})
>    set(CTEST_DROP_LOCATION ${JOB_DROP_LOCATION})
>    ctest_submit(RETURN_VALUE res)
>
>    message("DONE")
>
> Thanks in advance
> Nils
> --
>
> 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