mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 04:40:56 -06:00
instrumentation: Add cmake_instrumentation check to ctest_instrumentation test
Update the `ctest_instrumentation` test cases to cover use of the `cmake_instrumentation` command and some of its arguments as a way of enabling instrumentation.
This commit is contained in:
@@ -7,4 +7,13 @@ endif()
|
|||||||
include(CTest)
|
include(CTest)
|
||||||
add_executable(main main.c)
|
add_executable(main main.c)
|
||||||
add_test(NAME main COMMAND main)
|
add_test(NAME main COMMAND main)
|
||||||
|
|
||||||
|
if(USE_CMAKE_INSTRUMENTATION_CMD)
|
||||||
|
cmake_instrumentation(
|
||||||
|
API_VERSION 1
|
||||||
|
DATA_VERSION 1
|
||||||
|
OPTIONS cdashSubmit
|
||||||
|
CUSTOM_CONTENT exampleContent STRING exampleData
|
||||||
|
)
|
||||||
|
endif()
|
||||||
@CASE_CMAKELISTS_SUFFIX_CODE@
|
@CASE_CMAKELISTS_SUFFIX_CODE@
|
||||||
|
|||||||
@@ -1,30 +1,45 @@
|
|||||||
include(RunCTest)
|
include(RunCTest)
|
||||||
|
|
||||||
function(run_InstrumentationInCTestXML CASE_NAME USE_INSTRUMENTATION USE_VERBOSE_INSTRUMENTATION)
|
function(run_InstrumentationInCTestXML CASE_NAME)
|
||||||
if(USE_VERBOSE_INSTRUMENTATION)
|
cmake_parse_arguments(ARGS "USE_INSTRUMENTATION_ENV_VARS;USE_VERBOSE_INSTRUMENTATION;USE_CMAKE_INSTRUMENTATION_CMD" "" "" ${ARGN})
|
||||||
|
if(ARGS_USE_VERBOSE_INSTRUMENTATION)
|
||||||
set(ENV{CTEST_USE_VERBOSE_INSTRUMENTATION} "1")
|
set(ENV{CTEST_USE_VERBOSE_INSTRUMENTATION} "1")
|
||||||
set(RunCMake_USE_VERBOSE_INSTRUMENTATION TRUE)
|
set(RunCMake_USE_VERBOSE_INSTRUMENTATION TRUE)
|
||||||
else()
|
else()
|
||||||
set(ENV{CTEST_USE_VERBOSE_INSTRUMENTATION} "0")
|
set(ENV{CTEST_USE_VERBOSE_INSTRUMENTATION} "0")
|
||||||
set(RunCMake_USE_VERBOSE_INSTRUMENTATION FALSE)
|
set(RunCMake_USE_VERBOSE_INSTRUMENTATION FALSE)
|
||||||
endif()
|
endif()
|
||||||
if(USE_INSTRUMENTATION)
|
if(ARGS_USE_INSTRUMENTATION_ENV_VARS)
|
||||||
set(ENV{CTEST_USE_INSTRUMENTATION} "1")
|
|
||||||
set(ENV{CTEST_EXPERIMENTAL_INSTRUMENTATION} "d16a3082-c4e1-489b-b90c-55750a334f27")
|
set(ENV{CTEST_EXPERIMENTAL_INSTRUMENTATION} "d16a3082-c4e1-489b-b90c-55750a334f27")
|
||||||
|
set(ENV{CTEST_USE_INSTRUMENTATION} "1")
|
||||||
set(RunCMake_USE_INSTRUMENTATION TRUE)
|
set(RunCMake_USE_INSTRUMENTATION TRUE)
|
||||||
set(CASE_NAME InstrumentationInCTestXML)
|
|
||||||
else()
|
else()
|
||||||
set(ENV{CTEST_USE_INSTRUMENTATION} "0")
|
|
||||||
set(ENV{CTEST_EXPERIMENTAL_INSTRUMENTATION} "0")
|
set(ENV{CTEST_EXPERIMENTAL_INSTRUMENTATION} "0")
|
||||||
|
set(ENV{CTEST_USE_INSTRUMENTATION} "0")
|
||||||
set(RunCMake_USE_INSTRUMENTATION FALSE)
|
set(RunCMake_USE_INSTRUMENTATION FALSE)
|
||||||
set(CASE_NAME NoInstrumentationInCTestXML)
|
|
||||||
endif()
|
endif()
|
||||||
|
if (ARGS_USE_CMAKE_INSTRUMENTATION_CMD)
|
||||||
|
set(RunCMake_USE_CMAKE_INSTRUMENTATION_CMD TRUE)
|
||||||
|
set(RunCMake_USE_INSTRUMENTATION TRUE)
|
||||||
|
else()
|
||||||
|
set(RunCMake_USE_CMAKE_INSTRUMENTATION_CMD FALSE)
|
||||||
|
set(RunCMake_USE_INSTRUMENTATION FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
configure_file(${RunCMake_SOURCE_DIR}/main.c
|
configure_file(${RunCMake_SOURCE_DIR}/main.c
|
||||||
${RunCMake_BINARY_DIR}/${CASE_NAME}/main.c COPYONLY)
|
${RunCMake_BINARY_DIR}/${CASE_NAME}/main.c COPYONLY)
|
||||||
run_ctest("${CASE_NAME}")
|
run_ctest("${CASE_NAME}")
|
||||||
unset(RunCMake_USE_LAUNCHERS)
|
unset(RunCMake_USE_LAUNCHERS)
|
||||||
unset(RunCMake_USE_INSTRUMENTATION)
|
unset(RunCMake_USE_INSTRUMENTATION)
|
||||||
endfunction()
|
endfunction()
|
||||||
run_InstrumentationInCTestXML(InstrumentationInCTestXML ON OFF)
|
run_InstrumentationInCTestXML(NoInstrumentationInCTestXML)
|
||||||
run_InstrumentationInCTestXML(VerboseInstrumentationInCTestXML ON ON)
|
run_InstrumentationInCTestXML(InstrumentationInCTestXML
|
||||||
run_InstrumentationInCTestXML(NoInstrumentationInCTestXML OFF OFF)
|
USE_INSTRUMENTATION_ENV_VARS
|
||||||
|
)
|
||||||
|
run_InstrumentationInCTestXML(VerboseInstrumentationInCTestXML
|
||||||
|
USE_INSTRUMENTATION_ENV_VARS
|
||||||
|
USE_VERBOSE_INSTRUMENTATION
|
||||||
|
)
|
||||||
|
run_InstrumentationInCTestXML(InstrumentationInCTestXMLWithCmd
|
||||||
|
USE_CMAKE_INSTRUMENTATION_CMD
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user