OLD | NEW |
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 Loading... |
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 #endif | |
40 | |
41 enum InitializationState {kUnset, kUnintialized, kInitialized}; | 37 enum InitializationState {kUnset, kUnintialized, kInitialized}; |
42 static InitializationState initialization_state_ = kUnset; | 38 static InitializationState initialization_state_ = kUnset; |
43 static bool disable_automatic_dispose_ = false; | 39 static bool disable_automatic_dispose_ = false; |
44 | 40 |
45 CcTest* CcTest::last_ = NULL; | 41 CcTest* CcTest::last_ = NULL; |
46 bool CcTest::initialize_called_ = false; | 42 bool CcTest::initialize_called_ = false; |
47 bool CcTest::isolate_used_ = false; | 43 bool CcTest::isolate_used_ = false; |
48 v8::Isolate* CcTest::isolate_ = NULL; | 44 v8::Isolate* CcTest::isolate_ = NULL; |
49 | 45 |
50 | 46 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 131 |
136 | 132 |
137 static void SuggestTestHarness(int tests) { | 133 static void SuggestTestHarness(int tests) { |
138 if (tests == 0) return; | 134 if (tests == 0) return; |
139 printf("Running multiple tests in sequence is deprecated and may cause " | 135 printf("Running multiple tests in sequence is deprecated and may cause " |
140 "bogus failure. Consider using tools/run-tests.py instead.\n"); | 136 "bogus failure. Consider using tools/run-tests.py instead.\n"); |
141 } | 137 } |
142 | 138 |
143 | 139 |
144 int main(int argc, char* argv[]) { | 140 int main(int argc, char* argv[]) { |
145 #if (defined(_WIN32) || defined(_WIN64)) | |
146 UINT new_flags = | |
147 SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX; | |
148 UINT existing_flags = SetErrorMode(new_flags); | |
149 SetErrorMode(existing_flags | new_flags); | |
150 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); | |
151 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); | |
152 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); | |
153 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); | |
154 _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); | |
155 _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); | |
156 _set_error_mode(_OUT_TO_STDERR); | |
157 #endif | |
158 | |
159 v8::V8::InitializeICU(); | 141 v8::V8::InitializeICU(); |
160 v8::Platform* platform = v8::platform::CreateDefaultPlatform(); | 142 v8::Platform* platform = v8::platform::CreateDefaultPlatform(); |
161 v8::V8::InitializePlatform(platform); | 143 v8::V8::InitializePlatform(platform); |
162 | 144 |
163 v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true); | 145 v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true); |
164 | 146 |
165 CcTestArrayBufferAllocator array_buffer_allocator; | 147 CcTestArrayBufferAllocator array_buffer_allocator; |
166 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); | 148 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); |
167 | 149 |
168 i::PrintExtension print_extension; | 150 i::PrintExtension print_extension; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 CcTest::TearDown(); | 208 CcTest::TearDown(); |
227 // TODO(svenpanne) See comment above. | 209 // TODO(svenpanne) See comment above. |
228 // if (!disable_automatic_dispose_) v8::V8::Dispose(); | 210 // if (!disable_automatic_dispose_) v8::V8::Dispose(); |
229 v8::V8::ShutdownPlatform(); | 211 v8::V8::ShutdownPlatform(); |
230 delete platform; | 212 delete platform; |
231 return 0; | 213 return 0; |
232 } | 214 } |
233 | 215 |
234 RegisterThreadedTest *RegisterThreadedTest::first_ = NULL; | 216 RegisterThreadedTest *RegisterThreadedTest::first_ = NULL; |
235 int RegisterThreadedTest::count_ = 0; | 217 int RegisterThreadedTest::count_ = 0; |
OLD | NEW |