diff options
author | Ivan Zhakov <ivan@apache.org> | 2022-09-12 15:08:50 +0000 |
---|---|---|
committer | Ivan Zhakov <ivan@apache.org> | 2022-09-12 15:08:50 +0000 |
commit | 121cbd3fd95817003dd7235ac941611be4065dd4 (patch) | |
tree | c9a5710b5f12fe45c2404f3185bc51aa1c26f68f | |
parent | 77c39409310da77b79863fc7a2d9bc8a8192888b (diff) | |
download | apr-121cbd3fd95817003dd7235ac941611be4065dd4.tar.gz |
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.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1904016 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | test/testutil.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/testutil.c b/test/testutil.c index c433e92c3..2986cd5a2 100644 --- a/test/testutil.c +++ b/test/testutil.c @@ -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 */ } |