diff --git a/Help/manual/cmake-instrumentation.7.rst b/Help/manual/cmake-instrumentation.7.rst index e0d0fc2e2b..5a77c70f81 100644 --- a/Help/manual/cmake-instrumentation.7.rst +++ b/Help/manual/cmake-instrumentation.7.rst @@ -423,6 +423,10 @@ and contain the following data: contains information about the CMake configure and generate steps responsible for generating the ``command`` in this snippet. + ``showOnly`` + A boolean representing whether the ``--show-only`` option was passed to + ``ctest``. Only included when ``role`` is ``ctest``. + Example: .. code-block:: json diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index fa94409156..221e4ef854 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2672,7 +2672,10 @@ int cmCTest::ExecuteTests(std::vector const& args) auto processHandler = [&handler]() -> int { return handler.ProcessHandler(); }; - int ret = instrumentation.InstrumentCommand("ctest", args, processHandler); + std::map data; + data["showOnly"] = this->GetShowOnly() ? "1" : "0"; + int ret = + instrumentation.InstrumentCommand("ctest", args, processHandler, data); instrumentation.CollectTimingData(cmInstrumentationQuery::Hook::PostCTest); if (ret < 0) { cmCTestLog(this, ERROR_MESSAGE, "Errors while running CTest\n"); diff --git a/Source/cmInstrumentation.cxx b/Source/cmInstrumentation.cxx index ae84725129..cfd2e9884d 100644 --- a/Source/cmInstrumentation.cxx +++ b/Source/cmInstrumentation.cxx @@ -663,6 +663,8 @@ int cmInstrumentation::InstrumentCommand( for (auto const& item : data.value()) { if (item.first == "role" && !item.second.empty()) { command_type = item.second; + } else if (item.first == "showOnly") { + root[item.first] = item.second == "1" ? true : false; } else if (!item.second.empty()) { root[item.first] = item.second; } diff --git a/Tests/RunCMake/Instrumentation/verify-snippet.cmake b/Tests/RunCMake/Instrumentation/verify-snippet.cmake index fed51383e6..92d0f3d959 100644 --- a/Tests/RunCMake/Instrumentation/verify-snippet.cmake +++ b/Tests/RunCMake/Instrumentation/verify-snippet.cmake @@ -27,6 +27,8 @@ function(snippet_has_fields snippet contents) json_has_key("${snippet}" "${contents}" outputs) json_has_key("${snippet}" "${contents}" outputSizes) json_has_key("${snippet}" "${contents}" config) + elseif (filename MATCHES "^ctest-*") + json_has_key("${snippet}" "${contents}" showOnly) elseif (filename MATCHES "^test-*") json_has_key("${snippet}" "${contents}" testName) json_has_key("${snippet}" "${contents}" config)