| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // Switches between all the Api tests using the threading support. | 170 // Switches between all the Api tests using the threading support. |
| 171 // In order to get a surprising but repeatable pattern of thread | 171 // In order to get a surprising but repeatable pattern of thread |
| 172 // switching it has extra semaphores to control the order in which | 172 // switching it has extra semaphores to control the order in which |
| 173 // the tests alternate, not relying solely on the big V8 lock. | 173 // the tests alternate, not relying solely on the big V8 lock. |
| 174 // | 174 // |
| 175 // A test is augmented with calls to ApiTestFuzzer::Fuzz() in its | 175 // A test is augmented with calls to ApiTestFuzzer::Fuzz() in its |
| 176 // callbacks. This will have no effect when we are not running the | 176 // callbacks. This will have no effect when we are not running the |
| 177 // thread fuzzing test. In the thread fuzzing test it will | 177 // thread fuzzing test. In the thread fuzzing test it will |
| 178 // pseudorandomly select a successor thread and switch execution | 178 // pseudorandomly select a successor thread and switch execution |
| 179 // to that thread, suspending the current test. | 179 // to that thread, suspending the current test. |
| 180 class ApiTestFuzzer: public v8::internal::Thread { | 180 class ApiTestFuzzer: public v8::base::Thread { |
| 181 public: | 181 public: |
| 182 void CallTest(); | 182 void CallTest(); |
| 183 | 183 |
| 184 // The ApiTestFuzzer is also a Thread, so it has a Run method. | 184 // The ApiTestFuzzer is also a Thread, so it has a Run method. |
| 185 virtual void Run(); | 185 virtual void Run(); |
| 186 | 186 |
| 187 enum PartOfTest { FIRST_PART, | 187 enum PartOfTest { FIRST_PART, |
| 188 SECOND_PART, | 188 SECOND_PART, |
| 189 THIRD_PART, | 189 THIRD_PART, |
| 190 FOURTH_PART, | 190 FOURTH_PART, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 205 active_(true) { | 205 active_(true) { |
| 206 } | 206 } |
| 207 ~ApiTestFuzzer() {} | 207 ~ApiTestFuzzer() {} |
| 208 | 208 |
| 209 static bool fuzzing_; | 209 static bool fuzzing_; |
| 210 static int tests_being_run_; | 210 static int tests_being_run_; |
| 211 static int current_; | 211 static int current_; |
| 212 static int active_tests_; | 212 static int active_tests_; |
| 213 static bool NextThread(); | 213 static bool NextThread(); |
| 214 int test_number_; | 214 int test_number_; |
| 215 v8::internal::Semaphore gate_; | 215 v8::base::Semaphore gate_; |
| 216 bool active_; | 216 bool active_; |
| 217 void ContextSwitch(); | 217 void ContextSwitch(); |
| 218 static int GetNextTestNumber(); | 218 static int GetNextTestNumber(); |
| 219 static v8::internal::Semaphore all_tests_done_; | 219 static v8::base::Semaphore all_tests_done_; |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 | 222 |
| 223 #define THREADED_TEST(Name) \ | 223 #define THREADED_TEST(Name) \ |
| 224 static void Test##Name(); \ | 224 static void Test##Name(); \ |
| 225 RegisterThreadedTest register_##Name(Test##Name, #Name); \ | 225 RegisterThreadedTest register_##Name(Test##Name, #Name); \ |
| 226 /* */ TEST(Name) | 226 /* */ TEST(Name) |
| 227 | 227 |
| 228 | 228 |
| 229 class RegisterThreadedTest { | 229 class RegisterThreadedTest { |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 CHECK_EQ(0, heap_profiler_->heap_object_map()->FindUntrackedObjects()); | 495 CHECK_EQ(0, heap_profiler_->heap_object_map()->FindUntrackedObjects()); |
| 496 heap_profiler_->StopHeapObjectsTracking(); | 496 heap_profiler_->StopHeapObjectsTracking(); |
| 497 } | 497 } |
| 498 | 498 |
| 499 private: | 499 private: |
| 500 i::HeapProfiler* heap_profiler_; | 500 i::HeapProfiler* heap_profiler_; |
| 501 }; | 501 }; |
| 502 | 502 |
| 503 | 503 |
| 504 #endif // ifndef CCTEST_H_ | 504 #endif // ifndef CCTEST_H_ |
| OLD | NEW |