Reviewers: Michael Achenbach, marja,

Message:
PTAL, here is the cl which tries if it really works:

https://codereview.chromium.org/560933004

(atm trybot is still working)

Description:
Configure d8 & cctest to suppress Windows error dialogs.

Please review this at https://codereview.chromium.org/575473002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+33, -0 lines):
  M src/d8.cc
  M test/cctest/cctest.cc


Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index f22be5bb5d184125dc0c7c6410d698029113d26b..b651d46add54df7713f9d8ffbf050b209f961b13 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -54,6 +54,8 @@

 #if !defined(_WIN32) && !defined(_WIN64)
 #include <unistd.h>  // NOLINT
+#else
+#include <windows.h>
 #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();
Index: test/cctest/cctest.cc
diff --git a/test/cctest/cctest.cc b/test/cctest/cctest.cc
index 2bb08b0ec946ff517371054ef656a56ff6ab6ea3..a3b06991ccf9f625988f3becef7f3bf1d055c607 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 <windows.h>
+#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);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to