Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: test/cctest/cctest.cc

Issue 576733002: Configure d8 & cctest to suppress Windows error dialogs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/d8.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 16 matching lines...) Expand all
27 27
28 #include "include/v8.h" 28 #include "include/v8.h"
29 #include "test/cctest/cctest.h" 29 #include "test/cctest/cctest.h"
30 30
31 #include "include/libplatform/libplatform.h" 31 #include "include/libplatform/libplatform.h"
32 #include "src/debug.h" 32 #include "src/debug.h"
33 #include "test/cctest/print-extension.h" 33 #include "test/cctest/print-extension.h"
34 #include "test/cctest/profiler-extension.h" 34 #include "test/cctest/profiler-extension.h"
35 #include "test/cctest/trace-extension.h" 35 #include "test/cctest/trace-extension.h"
36 36
37 #if (defined(_WIN32) || defined(_WIN64))
38 #include <windows.h> // NOLINT
39 #if defined(_MSC_VER)
40 #include <crtdbg.h>
41 #endif // defined(_MSC_VER)
42 #endif // defined(_WIN32) || defined(_WIN64)
43
37 enum InitializationState {kUnset, kUnintialized, kInitialized}; 44 enum InitializationState {kUnset, kUnintialized, kInitialized};
38 static InitializationState initialization_state_ = kUnset; 45 static InitializationState initialization_state_ = kUnset;
39 static bool disable_automatic_dispose_ = false; 46 static bool disable_automatic_dispose_ = false;
40 47
41 CcTest* CcTest::last_ = NULL; 48 CcTest* CcTest::last_ = NULL;
42 bool CcTest::initialize_called_ = false; 49 bool CcTest::initialize_called_ = false;
43 bool CcTest::isolate_used_ = false; 50 bool CcTest::isolate_used_ = false;
44 v8::Isolate* CcTest::isolate_ = NULL; 51 v8::Isolate* CcTest::isolate_ = NULL;
45 52
46 53
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 138
132 139
133 static void SuggestTestHarness(int tests) { 140 static void SuggestTestHarness(int tests) {
134 if (tests == 0) return; 141 if (tests == 0) return;
135 printf("Running multiple tests in sequence is deprecated and may cause " 142 printf("Running multiple tests in sequence is deprecated and may cause "
136 "bogus failure. Consider using tools/run-tests.py instead.\n"); 143 "bogus failure. Consider using tools/run-tests.py instead.\n");
137 } 144 }
138 145
139 146
140 int main(int argc, char* argv[]) { 147 int main(int argc, char* argv[]) {
148 #if (defined(_WIN32) || defined(_WIN64))
149 UINT new_flags =
150 SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
151 UINT existing_flags = SetErrorMode(new_flags);
152 SetErrorMode(existing_flags | new_flags);
153 #if defined(_MSC_VER)
154 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
155 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
156 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
157 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
158 _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
159 _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
160 _set_error_mode(_OUT_TO_STDERR);
161 #endif // _MSC_VER
162 #endif // defined(_WIN32) || defined(_WIN64)
163
141 v8::V8::InitializeICU(); 164 v8::V8::InitializeICU();
142 v8::Platform* platform = v8::platform::CreateDefaultPlatform(); 165 v8::Platform* platform = v8::platform::CreateDefaultPlatform();
143 v8::V8::InitializePlatform(platform); 166 v8::V8::InitializePlatform(platform);
144 167
145 v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true); 168 v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
146 169
147 CcTestArrayBufferAllocator array_buffer_allocator; 170 CcTestArrayBufferAllocator array_buffer_allocator;
148 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); 171 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator);
149 172
150 i::PrintExtension print_extension; 173 i::PrintExtension print_extension;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 CcTest::TearDown(); 231 CcTest::TearDown();
209 // TODO(svenpanne) See comment above. 232 // TODO(svenpanne) See comment above.
210 // if (!disable_automatic_dispose_) v8::V8::Dispose(); 233 // if (!disable_automatic_dispose_) v8::V8::Dispose();
211 v8::V8::ShutdownPlatform(); 234 v8::V8::ShutdownPlatform();
212 delete platform; 235 delete platform;
213 return 0; 236 return 0;
214 } 237 }
215 238
216 RegisterThreadedTest *RegisterThreadedTest::first_ = NULL; 239 RegisterThreadedTest *RegisterThreadedTest::first_ = NULL;
217 int RegisterThreadedTest::count_ = 0; 240 int RegisterThreadedTest::count_ = 0;
OLDNEW
« no previous file with comments | « src/d8.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698