instrumentation: Rename postTest and postInstall hooks

`postCTest` and `postCMakeInstall` are more closely aligned with the
corresponding snippets which cause cause them to trigger (`ctest` and
`cmakeInstall`, respectively), and as such serve as better indicators of
their true behavior.
This commit is contained in:
Tyler Yankee
2025-09-04 11:39:11 -04:00
parent 89f4471c4c
commit fbb5b47fbf
12 changed files with 18 additions and 17 deletions

View File

@@ -203,8 +203,8 @@ key is required, but all other fields are optional.
* ``postBuild`` (called when ``ninja`` or ``make`` completes) * ``postBuild`` (called when ``ninja`` or ``make`` completes)
* ``preCMakeBuild`` (called when ``cmake --build`` is invoked) * ``preCMakeBuild`` (called when ``cmake --build`` is invoked)
* ``postCMakeBuild`` (called when ``cmake --build`` completes) * ``postCMakeBuild`` (called when ``cmake --build`` completes)
* ``postInstall`` * ``postCMakeInstall``
* ``postTest`` * ``postCTest``
``preBuild`` and ``postBuild`` are not supported when using the ``preBuild`` and ``postBuild`` are not supported when using the
:generator:`MSYS Makefiles` or :generator:`FASTBuild` generators. :generator:`MSYS Makefiles` or :generator:`FASTBuild` generators.
@@ -264,7 +264,7 @@ Example:
], ],
"hooks": [ "hooks": [
"postCMakeBuild", "postCMakeBuild",
"postInstall" "postCMakeInstall"
], ],
"options": [ "options": [
"staticSystemInformation", "staticSystemInformation",

View File

@@ -2673,7 +2673,7 @@ int cmCTest::ExecuteTests(std::vector<std::string> const& args)
return handler.ProcessHandler(); return handler.ProcessHandler();
}; };
int ret = instrumentation.InstrumentCommand("ctest", args, processHandler); int ret = instrumentation.InstrumentCommand("ctest", args, processHandler);
instrumentation.CollectTimingData(cmInstrumentationQuery::Hook::PostTest); instrumentation.CollectTimingData(cmInstrumentationQuery::Hook::PostCTest);
if (ret < 0) { if (ret < 0) {
cmCTestLog(this, ERROR_MESSAGE, "Errors while running CTest\n"); cmCTestLog(this, ERROR_MESSAGE, "Errors while running CTest\n");
if (!this->Impl->OutputTestOutputOnTestFailure) { if (!this->Impl->OutputTestOutputOnTestFailure) {

View File

@@ -20,9 +20,9 @@ std::vector<std::string> const cmInstrumentationQuery::OptionString{
"cdashVerbose", "trace" "cdashVerbose", "trace"
}; };
std::vector<std::string> const cmInstrumentationQuery::HookString{ std::vector<std::string> const cmInstrumentationQuery::HookString{
"postGenerate", "preBuild", "postBuild", "postGenerate", "preBuild", "postBuild",
"preCMakeBuild", "postCMakeBuild", "postTest", "preCMakeBuild", "postCMakeBuild", "postCTest",
"postInstall", "prepareForCDash", "manual" "postCMakeInstall", "prepareForCDash", "manual"
}; };
namespace ErrorMessages { namespace ErrorMessages {

View File

@@ -29,8 +29,8 @@ public:
PostBuild, PostBuild,
PreCMakeBuild, PreCMakeBuild,
PostCMakeBuild, PostCMakeBuild,
PostTest, PostCTest,
PostInstall, PostCMakeInstall,
PrepareForCDash, PrepareForCDash,
Manual Manual
}; };

View File

@@ -989,7 +989,8 @@ int do_install(int ac, char const* const* av)
cm::append(cmd, av, av + ac); cm::append(cmd, av, av + ac);
ret = instrumentation.InstrumentCommand( ret = instrumentation.InstrumentCommand(
"cmakeInstall", cmd, [doInstall]() { return doInstall(); }); "cmakeInstall", cmd, [doInstall]() { return doInstall(); });
instrumentation.CollectTimingData(cmInstrumentationQuery::Hook::PostInstall); instrumentation.CollectTimingData(
cmInstrumentationQuery::Hook::PostCMakeInstall);
return ret; return ret;
#endif #endif
} }

View File

@@ -1,5 +1,5 @@
^CMake Error: Could not load instrumentation queries from [^ ^CMake Error: Could not load instrumentation queries from [^
]+: ]+:
bad-hook.json:3: Not a valid hook: "bad hook" bad-hook.json:3: Not a valid hook: "bad hook"
"hooks": \["bad hook", "postGenerate", "preCMakeBuild", "postCMakeBuild", "postInstall"\] "hooks": \["bad hook", "postGenerate", "preCMakeBuild", "postCMakeBuild", "postCMakeInstall"\]
\^$ \^$

View File

@@ -1 +1 @@
.*\-\- postInstall$ .*\-\- postCMakeInstall$

View File

@@ -1 +1 @@
.*\-\- postTest$ .*\-\- postCTest$

View File

@@ -1,4 +1,4 @@
{ {
"version": 1, "version": 1,
"hooks": ["bad hook", "postGenerate", "preCMakeBuild", "postCMakeBuild", "postInstall"] "hooks": ["bad hook", "postGenerate", "preCMakeBuild", "postCMakeBuild", "postCMakeInstall"]
} }

View File

@@ -3,6 +3,6 @@ cmake_instrumentation(
API_VERSION 1 API_VERSION 1
DATA_VERSION 1 DATA_VERSION 1
OPTIONS trace OPTIONS trace
HOOKS postBuild postInstall postTest HOOKS postBuild postCMakeInstall postCTest
CALLBACK ${CMAKE_COMMAND} -P ${hook_path} 0 1 CALLBACK ${CMAKE_COMMAND} -P ${hook_path} 0 1
) )

View File

@@ -1,6 +1,6 @@
{ {
"version": 1, "version": 1,
"hooks": ["preCMakeBuild", "postInstall"], "hooks": ["preCMakeBuild", "postCMakeInstall"],
"callbacks": ["@GET_HOOK@"], "callbacks": ["@GET_HOOK@"],
"options": ["staticSystemInformation"] "options": ["staticSystemInformation"]
} }

View File

@@ -1,5 +1,5 @@
{ {
"version": 1, "version": 1,
"hooks": ["postGenerate", "postCMakeBuild", "postTest"], "hooks": ["postGenerate", "postCMakeBuild", "postCTest"],
"callbacks": ["@GET_HOOK@"] "callbacks": ["@GET_HOOK@"]
} }