ctest: extend config mapping to include script-only variables

This commit is contained in:
Zack Galbreath
2026-05-14 10:06:46 -04:00
parent 68489471a6
commit 21b9c20592
2 changed files with 86 additions and 1 deletions

View File

@@ -1064,6 +1064,13 @@ Configuration settings include:
* `CTest Script`_ variable: :variable:`CTEST_SOURCE_DIRECTORY`
* :module:`CTest` module variable: :variable:`PROJECT_SOURCE_DIR`
``CheckoutCommand``
Command-line to run before the start step to initialize the source
directory, e.g. to perform an initial checkout from version control.
* `CTest Script`_ variable: :variable:`CTEST_CHECKOUT_COMMAND`
* :module:`CTest` module variable: none
.. _`CTest Update Step`:
CTest Update Step
@@ -1283,6 +1290,27 @@ Configuration settings include:
See `Label and Subproject Summary`_.
``CMakeGenerator``
The CMake generator to use for the configure step when
``ConfigureCommand`` is not set.
* `CTest Script`_ variable: ``CTEST_CMAKE_GENERATOR``
* :module:`CTest` module variable: none
``CMakeGeneratorPlatform``
The CMake generator platform to use for the configure step when
``ConfigureCommand`` is not set.
* `CTest Script`_ variable: ``CTEST_CMAKE_GENERATOR_PLATFORM``
* :module:`CTest` module variable: none
``CMakeGeneratorToolset``
The CMake generator toolset to use for the configure step when
``ConfigureCommand`` is not set.
* `CTest Script`_ variable: ``CTEST_CMAKE_GENERATOR_TOOLSET``
* :module:`CTest` module variable: none
.. _`CTest Build Step`:
CTest Build Step
@@ -1340,6 +1368,20 @@ Configuration settings include:
* `CTest Script`_ variable: :variable:`CTEST_USE_LAUNCHERS`
* :module:`CTest` module variable: ``CTEST_USE_LAUNCHERS``
``BuildFlags``
Additional flags to pass to the build tool when building the project.
Only used when ``MakeCommand`` is not set explicitly.
* `CTest Script`_ variable: ``CTEST_BUILD_FLAGS``
* :module:`CTest` module variable: none
``BuildTarget``
Specify a specific target to build instead of the default target.
Only used when ``MakeCommand`` is not set explicitly.
* `CTest Script`_ variable: ``CTEST_BUILD_TARGET``
* :module:`CTest` module variable: none
.. _`CTest Test Step`:
CTest Test Step
@@ -1446,6 +1488,13 @@ Configuration settings include:
These options are the first arguments passed to ``CoverageCommand``.
``ExtraCoverageGlob``
A semicolon-separated list of glob patterns for additional source files
to include in the coverage analysis.
* `CTest Script`_ variable: :variable:`CTEST_EXTRA_COVERAGE_GLOB`
* :module:`CTest` module variable: none
.. _`CTest MemCheck Step`:
CTest MemCheck Step
@@ -1685,6 +1734,27 @@ Configuration settings include:
* `CTest Script`_ variable: :variable:`CTEST_SUBMIT_INACTIVITY_TIMEOUT`
* :module:`CTest` module variable: ``CTEST_SUBMIT_INACTIVITY_TIMEOUT``
``NotesFiles``
A semicolon-separated list of notes files to upload with the submission.
* `CTest Script`_ variable: :variable:`CTEST_NOTES_FILES`
* :module:`CTest` module variable: none
``ExtraSubmitFiles``
A semicolon-separated list of extra ``.xml`` files to upload with the
submission.
* `CTest Script`_ variable: :variable:`CTEST_EXTRA_SUBMIT_FILES`
* :module:`CTest` module variable: none
``TimeLimit``
Maximum total time (in seconds) allowed for the entire dashboard run.
CTest will not start additional steps once the remaining time drops
below two minutes.
* `CTest Script`_ variable: ``CTEST_TIME_LIMIT``
* :module:`CTest` module variable: none
``TLSVersion``
.. versionadded:: 3.30

View File

@@ -731,8 +731,10 @@ int cmCTest::ProcessSteps()
script.CreateCMake();
cmMakefile& mf = *script.GetMakefile();
this->ReadCustomConfigurationFileTree(this->Impl->BinaryDir, &mf);
this->SetTimeLimit(mf.GetDefinition("CTEST_TIME_LIMIT"));
this->SetCMakeVariables(mf);
// CTEST_TIME_LIMIT may come from CTestCustom.cmake (already in the makefile)
// or from the config map (just populated by SetCMakeVariables above).
this->SetTimeLimit(mf.GetDefinition("CTEST_TIME_LIMIT"));
std::vector<cmListFileArgument> args{
cmListFileArgument("RETURN_VALUE"_s, cmListFileArgument::Unquoted, 0),
cmListFileArgument("return_value"_s, cmListFileArgument::Unquoted, 0),
@@ -3162,6 +3164,8 @@ CTestVarConfigEntry const kCTestVarConfigMap[] = {
{ "CTEST_NIGHTLY_START_TIME", "NightlyStartTime" },
{ "CTEST_SOURCE_DIRECTORY", "SourceDirectory" },
{ "CTEST_BINARY_DIRECTORY", "BuildDirectory" },
// Start step
{ "CTEST_CHECKOUT_COMMAND", "CheckoutCommand" },
// Update step
{ "CTEST_UPDATE_COMMAND", "UpdateCommand" },
{ "CTEST_UPDATE_OPTIONS", "UpdateOptions" },
@@ -3189,15 +3193,23 @@ CTestVarConfigEntry const kCTestVarConfigMap[] = {
// Configure step
{ "CTEST_CONFIGURE_COMMAND", "ConfigureCommand" },
{ "CTEST_LABELS_FOR_SUBPROJECTS", "LabelsForSubprojects" },
{ "CTEST_CMAKE_GENERATOR", "CMakeGenerator" },
{ "CTEST_CMAKE_GENERATOR_PLATFORM", "CMakeGeneratorPlatform" },
{ "CTEST_CMAKE_GENERATOR_TOOLSET", "CMakeGeneratorToolset" },
// Build step
{ "CTEST_BUILD_COMMAND", "MakeCommand" },
{ "CTEST_USE_LAUNCHERS", "UseLaunchers" },
{ "CTEST_BUILD_FLAGS", "BuildFlags" },
{ "CTEST_BUILD_TARGET", "BuildTarget" },
// Test step
{ "CTEST_TEST_TIMEOUT", "TimeOut" },
{ "CTEST_TEST_COVERAGE_TOOL", "CTestTestCoverageTool" },
{ "CTEST_RESOURCE_SPEC_FILE", "ResourceSpecFile" },
{ "CTEST_TEST_LOAD", "TestLoad" },
// Coverage step
{ "CTEST_COVERAGE_COMMAND", "CoverageCommand" },
{ "CTEST_COVERAGE_EXTRA_FLAGS", "CoverageExtraFlags" },
{ "CTEST_EXTRA_COVERAGE_GLOB", "ExtraCoverageGlob" },
// MemCheck step
{ "CTEST_MEMORYCHECK_TYPE", "MemoryCheckType" },
{ "CTEST_MEMORYCHECK_SANITIZER_OPTIONS", "MemoryCheckSanitizerOptions" },
@@ -3205,6 +3217,8 @@ CTestVarConfigEntry const kCTestVarConfigMap[] = {
{ "CTEST_MEMORYCHECK_COMMAND_OPTIONS", "MemoryCheckCommandOptions" },
{ "CTEST_MEMORYCHECK_SUPPRESSIONS_FILE", "MemoryCheckSuppressionFile" },
// Submit step
{ "CTEST_NOTES_FILES", "NotesFiles" },
{ "CTEST_EXTRA_SUBMIT_FILES", "ExtraSubmitFiles" },
{ "CTEST_SUBMIT_URL", "SubmitURL" },
{ "CTEST_DROP_METHOD", "DropMethod" },
{ "CTEST_DROP_SITE_USER", "DropSiteUser" },
@@ -3215,6 +3229,7 @@ CTestVarConfigEntry const kCTestVarConfigMap[] = {
{ "CTEST_TLS_VERSION", "TLSVersion" },
{ "CTEST_CURL_OPTIONS", "CurlOptions" },
{ "CTEST_SUBMIT_INACTIVITY_TIMEOUT", "SubmitInactivityTimeout" },
{ "CTEST_TIME_LIMIT", "TimeLimit" },
};
// clang-format on
} // namespace