You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by iv...@apache.org on 2022/09/12 15:08:50 UTC

svn commit: r1904016 - in /apr/apr/branches/1.7.x: ./ test/testutil.c

Author: ivan
Date: Mon Sep 12 15:08:50 2022
New Revision: 1904016

URL: http://svn.apache.org/viewvc?rev=1904016&view=rev
Log:
On 1.7.x branch: Merge r1904015 from 1.8.x branch:
  tests: Configure VC runtime to write errors to stderr instead of displaying
  popup message box on Windows.

Modified:
    apr/apr/branches/1.7.x/   (props changed)
    apr/apr/branches/1.7.x/test/testutil.c

Propchange: apr/apr/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /apr/apr/branches/1.8.x:r1904015
  Merged /apr/apr/trunk:r1902283

Modified: apr/apr/branches/1.7.x/test/testutil.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/test/testutil.c?rev=1904016&r1=1904015&r2=1904016&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/test/testutil.c (original)
+++ apr/apr/branches/1.7.x/test/testutil.c Mon Sep 12 15:08:50 2022
@@ -16,6 +16,9 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#if defined(_MSC_VER)
+#include <crtdbg.h>
+#endif
 
 #include "abts.h"
 #include "testutil.h"
@@ -41,4 +44,18 @@ void initialize(void) {
     atexit(apr_terminate);
     
     apr_pool_create(&p, NULL);
+
+#if _MSC_VER >= 1400
+    /* In release mode: Redirect abort() errors to stderr */
+    _set_error_mode(_OUT_TO_STDERR);
+
+    /* In _DEBUG mode: Redirect all debug output (E.g. assert() to stderr.
+        (Ignored in release builds) */
+    _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+    _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+    _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+    _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+    _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+    _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+#endif /* _MSC_VER >= 1400 */
 }