Przeglądaj źródła

Merge topic 'ctest-crash-handling'

0a4ee422c1 ctest: Restore Windows Error Reporting in interactive mode

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !9855
Brad King 1 rok temu
rodzic
commit
f21c08ebbf

+ 19 - 5
Help/manual/ctest.1.rst

@@ -353,18 +353,32 @@ Run Tests
  This allows the user to widen the output to avoid clipping the test
  name which can be very annoying.
 
-.. option:: --interactive-debug-mode [0|1]
+.. option:: --interactive-debug-mode <0|1>
 
- Set the interactive mode to ``0`` or ``1``.
+ Disable (``0``) or enable (``1``) interactive debug mode.
 
  This option causes CTest to run tests in either an interactive mode
  or a non-interactive mode.  In dashboard mode (``Experimental``, ``Nightly``,
  ``Continuous``), the default is non-interactive.  In non-interactive mode,
  the environment variable :envvar:`DASHBOARD_TEST_FROM_CTEST` is set.
 
- Prior to CMake 3.11, interactive mode on Windows allowed system debug
- popup windows to appear.  Now, due to CTest's use of ``libuv`` to launch
- test processes, all system debug popup windows are always blocked.
+ Interactive Mode allows Windows Error Reporting (WER) to show debug popup
+ windows and to create core dumps.  To enable core dumps in tests,
+ use interactive mode, and follow the Windows documentation
+ on `Collecting User-Mode Dumps`_.
+
+ .. versionchanged:: 3.32
+   Windows Error Reporting (WER) is enabled in interactive mode, so
+   test processes may show debug popup windows and create core dumps.
+   This was made possible by updates to ``libuv``.
+
+ .. versionchanged:: 3.11
+   Windows Error Reporting (WER) is disabled in both interactive and
+   non-interactive modes, so test processes do not show popup windows
+   or create core dumps.  This is due to launching test processes with
+   ``libuv``.
+
+.. _`Collecting User-Mode Dumps`: https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps
 
 .. option:: --no-label-summary
 

+ 7 - 0
Help/release/dev/ctest-crash-handling.rst

@@ -0,0 +1,7 @@
+ctest-crash-handling
+--------------------
+
+* The :option:`ctest --interactive-debug-mode` option on Windows
+  now enables Windows Error Reporting by default in test processes,
+  allowing them to creating debug popup windows and core dumps.
+  This restores behavior previously removed by CMake 3.11.

+ 5 - 3
Source/CTest/cmProcess.cxx

@@ -106,6 +106,11 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
   options.stdio_count = 3; // in, out and err
   options.exit_cb = &cmProcess::OnExitCB;
   options.stdio = stdio;
+#if UV_VERSION_MAJOR > 1 || !defined(CMAKE_USE_SYSTEM_LIBUV)
+  if (!this->Runner->GetCTest()->GetInteractiveDebugMode()) {
+    options.flags = UV_PROCESS_WINDOWS_USE_PARENT_ERROR_MODE;
+  }
+#endif
 #if !defined(CMAKE_USE_SYSTEM_LIBUV)
   std::vector<char> cpumask;
   if (affinity && !affinity->empty()) {
@@ -122,9 +127,6 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
 #else
   static_cast<void>(affinity);
 #endif
-#if UV_VERSION_MAJOR > 1 || !defined(CMAKE_USE_SYSTEM_LIBUV)
-  options.flags = UV_PROCESS_WINDOWS_USE_PARENT_ERROR_MODE;
-#endif
 
   status =
     uv_read_start(pipe_reader, &cmProcess::OnAllocateCB, &cmProcess::OnReadCB);

+ 5 - 0
Source/cmCTest.cxx

@@ -3096,6 +3096,11 @@ int cmCTest::GetSubmitIndex() const
   return this->Impl->SubmitIndex;
 }
 
+bool cmCTest::GetInteractiveDebugMode() const
+{
+  return this->Impl->InteractiveDebugMode;
+}
+
 bool cmCTest::GetLabelSummary() const
 {
   return this->Impl->LabelSummary;

+ 2 - 0
Source/cmCTest.h

@@ -389,6 +389,8 @@ public:
 
   void AddSiteProperties(cmXMLWriter& xml, cmake* cm);
 
+  bool GetInteractiveDebugMode() const;
+
   bool GetLabelSummary() const;
   bool GetSubprojectSummary() const;