1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

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)
* ``preCMakeBuild`` (called when ``cmake --build`` is invoked)
* ``postCMakeBuild`` (called when ``cmake --build`` completes)
* ``postInstall``
* ``postTest``
* ``postCMakeInstall``
* ``postCTest``
``preBuild`` and ``postBuild`` are not supported when using the
:generator:`MSYS Makefiles` or :generator:`FASTBuild` generators.
@@ -264,7 +264,7 @@ Example:
],
"hooks": [
"postCMakeBuild",
"postInstall"
"postCMakeInstall"
],
"options": [
"staticSystemInformation",

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
^CMake Error: Could not load instrumentation queries from [^
]+:
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,
"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
DATA_VERSION 1
OPTIONS trace
HOOKS postBuild postInstall postTest
HOOKS postBuild postCMakeInstall postCTest
CALLBACK ${CMAKE_COMMAND} -P ${hook_path} 0 1
)

View File

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

View File

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