From d9838be973bc80eaf7809e74c12dac794da22966 Mon Sep 17 00:00:00 2001 From: "sigurds@chromium.org" Date: Tue, 16 Sep 2014 08:57:59 +0000 Subject: [PATCH] Configure d8 & cctest to suppress Windows error dialogs. R=machenbach@chromium.org Review URL: https://codereview.chromium.org/575473002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23962 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/d8.cc | 15 +++++++++++++++ test/cctest/cctest.cc | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/d8.cc b/src/d8.cc index f22be5bb5..8a155ebd9 100644 --- a/src/d8.cc +++ b/src/d8.cc @@ -54,6 +54,8 @@ #if !defined(_WIN32) && !defined(_WIN64) #include // NOLINT +#else +#include // NOLINT #endif #ifndef DCHECK @@ -1595,6 +1597,19 @@ class StartupDataHandler { int Shell::Main(int argc, char* argv[]) { +#if (defined(_WIN32) || defined(_WIN64)) + UINT new_flags = + SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX; + UINT existing_flags = SetErrorMode(new_flags); + SetErrorMode(existing_flags | new_flags); + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); + _set_error_mode(_OUT_TO_STDERR); +#endif if (!SetOptions(argc, argv)) return 1; v8::V8::InitializeICU(options.icu_data_file); v8::Platform* platform = v8::platform::CreateDefaultPlatform(); diff --git a/test/cctest/cctest.cc b/test/cctest/cctest.cc index 2bb08b0ec..6fb831a68 100644 --- a/test/cctest/cctest.cc +++ b/test/cctest/cctest.cc @@ -34,6 +34,10 @@ #include "test/cctest/profiler-extension.h" #include "test/cctest/trace-extension.h" +#if (defined(_WIN32) || defined(_WIN64)) +#include // NOLINT +#endif + enum InitializationState {kUnset, kUnintialized, kInitialized}; static InitializationState initialization_state_ = kUnset; static bool disable_automatic_dispose_ = false; @@ -138,6 +142,20 @@ static void SuggestTestHarness(int tests) { int main(int argc, char* argv[]) { +#if (defined(_WIN32) || defined(_WIN64)) + UINT new_flags = + SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX; + UINT existing_flags = SetErrorMode(new_flags); + SetErrorMode(existing_flags | new_flags); + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); + _set_error_mode(_OUT_TO_STDERR); +#endif + v8::V8::InitializeICU(); v8::Platform* platform = v8::platform::CreateDefaultPlatform(); v8::V8::InitializePlatform(platform); -- 2.34.1