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