instrumentation: Fix cdashSubmit option

Setting cdashSubmit option automatically enables the dynamicSystemInformation
option and prepareForCDash hooks.
This commit is contained in:
Martin Duffy committed 2026-01-19 13:26:29 -05:00
1 parent e151d6d005
commit 614715d56f
6 files changed
+26 -30

No files matched your search

+3 -3
View File
@@ -241,15 +241,15 @@ key is required, but all other fields are optional.
after the command is executed.
``cdashSubmit``
Enables including instrumentation data in CDash. This does not
automatically enable ``dynamicSystemInformation``, but is otherwise
Enables including instrumentation data in CDash. This is
equivalent to having the :envvar:`CTEST_USE_INSTRUMENTATION` environment
variable enabled.
``cdashVerbose``
Enables including the full untruncated commands in data submitted to
CDash. Equivalent to having the
:envvar:`CTEST_USE_VERBOSE_INSTRUMENTATION` environment variable enabled.
:envvar:`CTEST_USE_VERBOSE_INSTRUMENTATION` and
:envvar:`CTEST_USE_INSTRUMENTATION` environment variables enabled.
``trace``
Enables generation of a `Google Trace File`_ during `Indexing`_ to
+9 -9
View File
@@ -136,21 +136,14 @@ void cmInstrumentation::CheckCDashVariable()
.Uuid;
if (envVal == uuid) {
std::set<cmInstrumentationQuery::Option> options_ = {
cmInstrumentationQuery::Option::CDashSubmit,
cmInstrumentationQuery::Option::DynamicSystemInformation
cmInstrumentationQuery::Option::CDashSubmit
};
if (cmSystemTools::GetEnv("CTEST_USE_VERBOSE_INSTRUMENTATION",
envVal) &&
!cmIsOff(envVal)) {
options_.insert(cmInstrumentationQuery::Option::CDashVerbose);
}
for (auto const& option : options_) {
this->AddOption(option);
}
std::set<cmInstrumentationQuery::Hook> hooks_ = {
cmInstrumentationQuery::Hook::PrepareForCDash
};
this->AddHook(cmInstrumentationQuery::Hook::PrepareForCDash);
std::set<cmInstrumentationQuery::Hook> hooks_;
this->WriteJSONQuery(options_, hooks_, {});
}
}
@@ -186,6 +179,13 @@ void cmInstrumentation::ReadJSONQuery(std::string const& file)
auto query = cmInstrumentationQuery();
query.ReadJSON(file, this->errorMsg, this->options, this->hooks,
this->callbacks);
if (this->HasOption(cmInstrumentationQuery::Option::CDashVerbose)) {
this->AddOption(cmInstrumentationQuery::Option::CDashSubmit);
}
if (this->HasOption(cmInstrumentationQuery::Option::CDashSubmit)) {
this->AddHook(cmInstrumentationQuery::Hook::PrepareForCDash);
this->AddOption(cmInstrumentationQuery::Option::DynamicSystemInformation);
}
if (!this->errorMsg.empty()) {
cmSystemTools::Error(cmStrCat(
"Could not load instrumentation queries from ",
@@ -1,18 +1,16 @@
cmake_minimum_required(VERSION 3.10)
@CASE_CMAKELISTS_PREFIX_CODE@
project(CTestInstrumentation@CASE_NAME@)
if(USE_INSTRUMENTATION)
set(CMAKE_EXPERIMENTAL_INSTRUMENTATION "ec7aa2dc-b87f-45a3-8022-fe01c5f59984")
endif()
include(CTest)
add_executable(main main.c)
add_test(NAME main COMMAND main)
if(USE_CMAKE_INSTRUMENTATION_CMD)
if($ENV{USE_INSTRUMENTATION_CMD})
set(CMAKE_EXPERIMENTAL_INSTRUMENTATION "ec7aa2dc-b87f-45a3-8022-fe01c5f59984")
cmake_instrumentation(
API_VERSION 1
DATA_VERSION 1
OPTIONS cdashSubmit
OPTIONS cdashVerbose
CUSTOM_CONTENT exampleContent STRING exampleData
)
endif()
@@ -0,0 +1 @@
include("${CMAKE_CURRENT_LIST_DIR}/InstrumentationInCTestXML-check.cmake")
@@ -1,29 +1,27 @@
include(RunCTest)
function(run_InstrumentationInCTestXML CASE_NAME)
cmake_parse_arguments(ARGS "USE_INSTRUMENTATION_ENV_VARS;USE_VERBOSE_INSTRUMENTATION;USE_CMAKE_INSTRUMENTATION_CMD" "" "" ${ARGN})
cmake_parse_arguments(ARGS "USE_INSTRUMENTATION_ENV_VARS;USE_VERBOSE_INSTRUMENTATION;USE_INSTRUMENTATION_CMD" "" "" ${ARGN})
if(ARGS_USE_VERBOSE_INSTRUMENTATION)
set(ENV{CTEST_USE_VERBOSE_INSTRUMENTATION} "1")
set(RunCMake_USE_VERBOSE_INSTRUMENTATION TRUE)
set(RunCMake_USE_VERBOSE_INSTRUMENTATION 1)
else()
set(ENV{CTEST_USE_VERBOSE_INSTRUMENTATION} "0")
set(RunCMake_USE_VERBOSE_INSTRUMENTATION FALSE)
set(RunCMake_USE_VERBOSE_INSTRUMENTATION 0)
endif()
if(ARGS_USE_INSTRUMENTATION_ENV_VARS)
set(ENV{CTEST_EXPERIMENTAL_INSTRUMENTATION} "ec7aa2dc-b87f-45a3-8022-fe01c5f59984")
set(ENV{CTEST_USE_INSTRUMENTATION} "1")
set(RunCMake_USE_INSTRUMENTATION TRUE)
else()
set(ENV{CTEST_EXPERIMENTAL_INSTRUMENTATION} "0")
set(ENV{CTEST_USE_INSTRUMENTATION} "0")
set(RunCMake_USE_INSTRUMENTATION FALSE)
endif()
if (ARGS_USE_CMAKE_INSTRUMENTATION_CMD)
set(RunCMake_USE_CMAKE_INSTRUMENTATION_CMD TRUE)
set(RunCMake_USE_INSTRUMENTATION TRUE)
if (ARGS_USE_INSTRUMENTATION_CMD)
set(ENV{USE_INSTRUMENTATION_CMD} "1")
set(RunCMake_USE_VERBOSE_INSTRUMENTATION 1)
else()
set(RunCMake_USE_CMAKE_INSTRUMENTATION_CMD FALSE)
set(RunCMake_USE_INSTRUMENTATION FALSE)
set(ENV{USE_INSTRUMENTATION_CMD} "0")
set(RunCMake_USE_VERBOSE_INSTRUMENTATION 0)
endif()
configure_file(${RunCMake_SOURCE_DIR}/main.c
@@ -41,5 +39,5 @@ run_InstrumentationInCTestXML(VerboseInstrumentationInCTestXML
USE_VERBOSE_INSTRUMENTATION
)
run_InstrumentationInCTestXML(InstrumentationInCTestXMLWithCmd
USE_CMAKE_INSTRUMENTATION_CMD
USE_INSTRUMENTATION_CMD
)
@@ -9,9 +9,8 @@ set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@")
set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@")
set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
set(CTEST_USE_LAUNCHERS TRUE)
set(CTEST_USE_INSTRUMENTATION "@RunCMake_USE_INSTRUMENTATION@")
ctest_start(Experimental)
ctest_configure(OPTIONS "-DUSE_INSTRUMENTATION=${CTEST_USE_INSTRUMENTATION}")
ctest_configure()
ctest_build()
ctest_test()