浏览代码

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.
Tyler Yankee 1 月之前
父节点
当前提交
fbb5b47fbf

+ 3 - 3
Help/manual/cmake-instrumentation.7.rst

@@ -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",

+ 1 - 1
Source/cmCTest.cxx

@@ -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) {

+ 3 - 3
Source/cmInstrumentationQuery.cxx

@@ -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 {

+ 2 - 2
Source/cmInstrumentationQuery.h

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

+ 2 - 1
Source/cmakemain.cxx

@@ -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
 }

+ 1 - 1
Tests/RunCMake/Instrumentation/bad-hook-stderr.txt

@@ -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"\]
             \^$

+ 1 - 1
Tests/RunCMake/Instrumentation/hooks-1-install-stdout.txt

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

+ 1 - 1
Tests/RunCMake/Instrumentation/hooks-2-test-stdout.txt

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

+ 1 - 1
Tests/RunCMake/Instrumentation/query/bad-hook.json.in

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

+ 1 - 1
Tests/RunCMake/Instrumentation/query/cmake-command-trace.cmake

@@ -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
 )

+ 1 - 1
Tests/RunCMake/Instrumentation/query/hooks-1.json.in

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

+ 1 - 1
Tests/RunCMake/Instrumentation/query/hooks-2.json.in

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