mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-19 19:43:23 +08:00
instrumentation: Fix expected location of Labels when using CTest launchers
This commit is contained in:
@@ -46,7 +46,7 @@ endif()
|
|||||||
|
|
||||||
if(CTEST_USE_LAUNCHERS)
|
if(CTEST_USE_LAUNCHERS)
|
||||||
set(__launch_common_options
|
set(__launch_common_options
|
||||||
"--target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR>")
|
"--target-name <TARGET_NAME> --current-build-dir <CMAKE_CURRENT_BINARY_DIR>")
|
||||||
|
|
||||||
set(__launch_compile_options
|
set(__launch_compile_options
|
||||||
"${__launch_common_options} --output <OBJECT> --source <SOURCE> --language <LANGUAGE>")
|
"${__launch_common_options} --output <OBJECT> --source <SOURCE> --language <LANGUAGE>")
|
||||||
|
@@ -2661,14 +2661,14 @@ int cmake::ActualConfigure()
|
|||||||
std::string launcher;
|
std::string launcher;
|
||||||
if (mf->IsOn("CTEST_USE_LAUNCHERS")) {
|
if (mf->IsOn("CTEST_USE_LAUNCHERS")) {
|
||||||
launcher =
|
launcher =
|
||||||
cmStrCat("\"", cmSystemTools::GetCTestCommand(), "\" --launch ");
|
cmStrCat("\"", cmSystemTools::GetCTestCommand(), "\" --launch ",
|
||||||
|
"--current-build-dir <CMAKE_CURRENT_BINARY_DIR> ");
|
||||||
} else {
|
} else {
|
||||||
launcher =
|
launcher =
|
||||||
cmStrCat("\"", cmSystemTools::GetCTestCommand(), "\" --instrument ");
|
cmStrCat("\"", cmSystemTools::GetCTestCommand(), "\" --instrument ");
|
||||||
}
|
}
|
||||||
std::string common_args =
|
std::string common_args =
|
||||||
cmStrCat(" --target-name <TARGET_NAME> --current-build-dir ",
|
cmStrCat(" --target-name <TARGET_NAME> --build-dir \"",
|
||||||
"<CMAKE_CURRENT_BINARY_DIR> --build-dir \"",
|
|
||||||
this->State->GetBinaryDirectory(), "\" ");
|
this->State->GetBinaryDirectory(), "\" ");
|
||||||
this->State->SetGlobalProperty(
|
this->State->SetGlobalProperty(
|
||||||
"RULE_LAUNCH_COMPILE",
|
"RULE_LAUNCH_COMPILE",
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
(-1|255)
|
@@ -0,0 +1,2 @@
|
|||||||
|
Unable to find executable:.*MyThirdPartyDependency/src(/[^/
|
||||||
|
]+)?/third_party
|
@@ -0,0 +1,9 @@
|
|||||||
|
0% tests passed, 1 tests failed out of 1
|
||||||
|
+
|
||||||
|
Subproject Time Summary:
|
||||||
|
MyThirdPartyDependency += +[0-9.]+ sec\*proc \(1 test\)
|
||||||
|
+
|
||||||
|
Label Time Summary:
|
||||||
|
NotASubproject += +[0-9.]+ sec\*proc \(1 test\)
|
||||||
|
+
|
||||||
|
Total Test time \(real\) = +[0-9.]+ sec
|
@@ -29,25 +29,36 @@ run_CTestScriptVariable()
|
|||||||
# ctest -S test.cmake -DCTEST_LABELS_FOR_SUBPROJECTS:STRING="MySubproject"
|
# ctest -S test.cmake -DCTEST_LABELS_FOR_SUBPROJECTS:STRING="MySubproject"
|
||||||
# Note: This test includes a failing build
|
# Note: This test includes a failing build
|
||||||
# Note: Also use --instrumentation mode to ensure it doesn't interfere with label generation
|
# Note: Also use --instrumentation mode to ensure it doesn't interfere with label generation
|
||||||
function(run_CTestScriptVariableCommandLine)
|
function(run_CTestScriptVariableCommandLine USE_INSTRUMENTATION)
|
||||||
set(CTEST_EXTRA_CONFIG "set(CTEST_USE_LAUNCHERS 1)")
|
set(CTEST_EXTRA_CONFIG "set(CTEST_USE_LAUNCHERS 1)")
|
||||||
set(CASE_TEST_PREFIX_CODE [[
|
set(CASE_TEST_PREFIX_CODE [[
|
||||||
file(COPY "${CTEST_RUNCMAKE_SOURCE_DIRECTORY}/MyThirdPartyDependency"
|
file(COPY "${CTEST_RUNCMAKE_SOURCE_DIRECTORY}/MyThirdPartyDependency"
|
||||||
DESTINATION ${CTEST_SOURCE_DIRECTORY})
|
DESTINATION ${CTEST_SOURCE_DIRECTORY})
|
||||||
]])
|
]])
|
||||||
set(CASE_CMAKELISTS_SUFFIX_CODE [[
|
if(USE_INSTRUMENTATION)
|
||||||
add_subdirectory(MyThirdPartyDependency)
|
set(CASE_CMAKELISTS_SUFFIX_CODE [[
|
||||||
set(CMAKE_EXPERIMENTAL_INSTRUMENTATION "a37d1069-1972-4901-b9c9-f194aaf2b6e0")
|
add_subdirectory(MyThirdPartyDependency)
|
||||||
cmake_instrumentation(DATA_VERSION 1 API_VERSION 1)
|
set(CMAKE_EXPERIMENTAL_INSTRUMENTATION "a37d1069-1972-4901-b9c9-f194aaf2b6e0")
|
||||||
]])
|
cmake_instrumentation(DATA_VERSION 1 API_VERSION 1)
|
||||||
|
]])
|
||||||
run_ctest(CTestScriptVariableCommandLine "-DCTEST_LABELS_FOR_SUBPROJECTS:STRING=MyThirdPartyDependency")
|
set(RunCMake-check-file CTestScriptVariableCommandLine-check.cmake)
|
||||||
|
run_ctest(CTestScriptVariableCommandLineWithInstrumentation
|
||||||
|
"-DCTEST_LABELS_FOR_SUBPROJECTS:STRING=MyThirdPartyDependency")
|
||||||
|
unset(RunCMake-check-file)
|
||||||
|
else()
|
||||||
|
set(CASE_CMAKELISTS_SUFFIX_CODE [[
|
||||||
|
add_subdirectory(MyThirdPartyDependency)
|
||||||
|
]])
|
||||||
|
run_ctest(CTestScriptVariableCommandLine
|
||||||
|
"-DCTEST_LABELS_FOR_SUBPROJECTS:STRING=MyThirdPartyDependency")
|
||||||
|
endif()
|
||||||
|
|
||||||
unset(CTEST_EXTRA_CONFIG)
|
unset(CTEST_EXTRA_CONFIG)
|
||||||
unset(CASE_TEST_PREFIX_CODE)
|
unset(CASE_TEST_PREFIX_CODE)
|
||||||
unset(CASE_CMAKELISTS_SUFFIX_CODE)
|
unset(CASE_CMAKELISTS_SUFFIX_CODE)
|
||||||
endfunction()
|
endfunction()
|
||||||
run_CTestScriptVariableCommandLine()
|
run_CTestScriptVariableCommandLine(ON)
|
||||||
|
run_CTestScriptVariableCommandLine(OFF)
|
||||||
|
|
||||||
# 3. Set subprojects via a CTest module variable on the command line
|
# 3. Set subprojects via a CTest module variable on the command line
|
||||||
# (will populate DartConfiguration.tcl)
|
# (will populate DartConfiguration.tcl)
|
||||||
|
Reference in New Issue
Block a user