summaryrefslogtreecommitdiff
path: root/test/gtest_stress_test.cc
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2010-03-04 22:15:53 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2010-03-04 22:15:53 +0000
commitf6fb532f0825024feda89c863e33a51b6ff377f5 (patch)
tree9a7a9aac24a5946d5bca4e04ec681ecd38b6199c /test/gtest_stress_test.cc
parent2b608176ebb3ae26cd536dbb5809d6941affec33 (diff)
downloadgoogletest-f6fb532f0825024feda89c863e33a51b6ff377f5.tar.gz
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).
git-svn-id: http://googletest.googlecode.com/svn/trunk@386 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'test/gtest_stress_test.cc')
-rw-r--r--test/gtest_stress_test.cc17
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++)