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 |
11 // with the distribution. | 11 // with the distribution. |
12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
15 // | 15 // |
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <v8.h> | 28 #include <v8.h> |
29 #include "cctest.h" | 29 #include "cctest.h" |
| 30 |
| 31 #include "print-extension.h" |
| 32 #include "profiler-extension.h" |
| 33 #include "trace-extension.h" |
30 #include "debug.h" | 34 #include "debug.h" |
31 | 35 |
32 enum InitializationState {kUnset, kUnintialized, kInitialized}; | 36 enum InitializationState {kUnset, kUnintialized, kInitialized}; |
33 static InitializationState initialization_state_ = kUnset; | 37 static InitializationState initialization_state_ = kUnset; |
34 static bool disable_automatic_dispose_ = false; | 38 static bool disable_automatic_dispose_ = false; |
35 | 39 |
36 CcTest* CcTest::last_ = NULL; | 40 CcTest* CcTest::last_ = NULL; |
37 bool CcTest::initialize_called_ = false; | 41 bool CcTest::initialize_called_ = false; |
38 bool CcTest::isolate_used_ = false; | 42 bool CcTest::isolate_used_ = false; |
39 v8::Isolate* CcTest::isolate_ = NULL; | 43 v8::Isolate* CcTest::isolate_ = NULL; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 138 |
135 int main(int argc, char* argv[]) { | 139 int main(int argc, char* argv[]) { |
136 v8::V8::InitializeICU(); | 140 v8::V8::InitializeICU(); |
137 i::Isolate::SetCrashIfDefaultIsolateInitialized(); | 141 i::Isolate::SetCrashIfDefaultIsolateInitialized(); |
138 | 142 |
139 v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true); | 143 v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true); |
140 | 144 |
141 CcTestArrayBufferAllocator array_buffer_allocator; | 145 CcTestArrayBufferAllocator array_buffer_allocator; |
142 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); | 146 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); |
143 | 147 |
| 148 i::PrintExtension print_extension; |
| 149 v8::RegisterExtension(&print_extension); |
| 150 i::ProfilerExtension profiler_extension; |
| 151 v8::RegisterExtension(&profiler_extension); |
| 152 i::TraceExtension trace_extension; |
| 153 v8::RegisterExtension(&trace_extension); |
| 154 |
144 int tests_run = 0; | 155 int tests_run = 0; |
145 bool print_run_count = true; | 156 bool print_run_count = true; |
146 for (int i = 1; i < argc; i++) { | 157 for (int i = 1; i < argc; i++) { |
147 char* arg = argv[i]; | 158 char* arg = argv[i]; |
148 if (strcmp(arg, "--list") == 0) { | 159 if (strcmp(arg, "--list") == 0) { |
149 PrintTestList(CcTest::last()); | 160 PrintTestList(CcTest::last()); |
150 print_run_count = false; | 161 print_run_count = false; |
151 | 162 |
152 } else { | 163 } else { |
153 char* arg_copy = v8::internal::StrDup(arg); | 164 char* arg_copy = v8::internal::StrDup(arg); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 198 } |
188 } | 199 } |
189 if (print_run_count && tests_run != 1) | 200 if (print_run_count && tests_run != 1) |
190 printf("Ran %i tests.\n", tests_run); | 201 printf("Ran %i tests.\n", tests_run); |
191 if (!disable_automatic_dispose_) v8::V8::Dispose(); | 202 if (!disable_automatic_dispose_) v8::V8::Dispose(); |
192 return 0; | 203 return 0; |
193 } | 204 } |
194 | 205 |
195 RegisterThreadedTest *RegisterThreadedTest::first_ = NULL; | 206 RegisterThreadedTest *RegisterThreadedTest::first_ = NULL; |
196 int RegisterThreadedTest::count_ = 0; | 207 int RegisterThreadedTest::count_ = 0; |
OLD | NEW |