diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-03-04 22:15:53 (GMT) |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-03-04 22:15:53 (GMT) |
commit | 12a92c26fc0e0de81f687dbe739a6aa24f37f9dd (patch) | |
tree | 9a7a9aac24a5946d5bca4e04ec681ecd38b6199c /test/gtest_stress_test.cc | |
parent | 0928f00c6b995af037b787b710fde509267ad624 (diff) | |
download | googletest-12a92c26fc0e0de81f687dbe739a6aa24f37f9dd.zip googletest-12a92c26fc0e0de81f687dbe739a6aa24f37f9dd.tar.gz googletest-12a92c26fc0e0de81f687dbe739a6aa24f37f9dd.tar.bz2 |
Renames ThreadStartSempahore to Notificaton (by Vlad Losev); adds threading tests for SCOPED_TRACE() (by Vlad Losev); replaces native pthread calls with gtest's threading constructs (by Vlad Losev); fixes flakiness in CountedDestructor (by Vlad Losev); minor MSVC 7.1 clean-up (by Zhanyong Wan).
Diffstat (limited to 'test/gtest_stress_test.cc')
-rw-r--r-- | test/gtest_stress_test.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/test/gtest_stress_test.cc b/test/gtest_stress_test.cc index 01f4fc6..f5af78c 100644 --- a/test/gtest_stress_test.cc +++ b/test/gtest_stress_test.cc @@ -49,16 +49,15 @@ namespace testing { namespace { -using internal::scoped_ptr; +using internal::Notification; using internal::String; using internal::TestPropertyKeyIs; -using internal::ThreadStartSemaphore; using internal::ThreadWithParam; +using internal::scoped_ptr; // In order to run tests in this file, for platforms where Google Test is -// thread safe, implement ThreadWithParam and ThreadStartSemaphore. See the -// description of their API in gtest-port.h, where they are defined for -// already supported platforms. +// thread safe, implement ThreadWithParam. See the description of its API +// in gtest-port.h, where it is defined for already supported platforms. // How many threads to create? const int kThreadCount = 50; @@ -129,11 +128,13 @@ void CheckTestFailureCount(int expected_failures) { TEST(StressTest, CanUseScopedTraceAndAssertionsInManyThreads) { { scoped_ptr<ThreadWithParam<int> > threads[kThreadCount]; - ThreadStartSemaphore semaphore; + Notification threads_can_start; for (int i = 0; i != kThreadCount; i++) - threads[i].reset(new ThreadWithParam<int>(&ManyAsserts, i, &semaphore)); + threads[i].reset(new ThreadWithParam<int>(&ManyAsserts, + i, + &threads_can_start)); - semaphore.Signal(); // Starts all the threads. + threads_can_start.Notify(); // Blocks until all the threads are done. for (int i = 0; i != kThreadCount; i++) |