Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Side by Side Diff: base/stats_table_unittest.cc

Issue 1990007: Mark StatsTableTest.MultipleThreads as flaky (Closed)
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if defined(OS_WIN) 5 #if defined(OS_WIN)
6 #include <process.h> 6 #include <process.h>
7 #include <windows.h> 7 #include <windows.h>
8 #endif 8 #endif
9 9
10 #include "base/multiprocess_test.h" 10 #include "base/multiprocess_test.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (id_ % 2) 102 if (id_ % 2)
103 mixed_counter.Decrement(); 103 mixed_counter.Decrement();
104 else 104 else
105 mixed_counter.Increment(); 105 mixed_counter.Increment();
106 PlatformThread::Sleep(index % 10); // short wait 106 PlatformThread::Sleep(index % 10); // short wait
107 } 107 }
108 } 108 }
109 109
110 // Create a few threads and have them poke on their counters. 110 // Create a few threads and have them poke on their counters.
111 // Currently disabled. See bug report below: 111 // Currently disabled. See bug report below:
112 // TODO(maruel): http://crbug.com/10611 112 // Flaky, http://crbug.com/10611
113 TEST_F(StatsTableTest, MultipleThreads) { 113 TEST_F(StatsTableTest, FLAKY_MultipleThreads) {
114 #if 0
115 // Create a stats table. 114 // Create a stats table.
116 const std::string kTableName = "MultipleThreadStatTable"; 115 const std::string kTableName = "MultipleThreadStatTable";
117 const int kMaxThreads = 20; 116 const int kMaxThreads = 20;
118 const int kMaxCounter = 5; 117 const int kMaxCounter = 5;
119 DeleteShmem(kTableName); 118 DeleteShmem(kTableName);
120 StatsTable table(kTableName, kMaxThreads, kMaxCounter); 119 StatsTable table(kTableName, kMaxThreads, kMaxCounter);
121 StatsTable::set_current(&table); 120 StatsTable::set_current(&table);
122 121
123 EXPECT_EQ(0, table.CountThreadsRegistered()); 122 EXPECT_EQ(0, table.CountThreadsRegistered());
124 123
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 table.GetCounterValue(name)); 156 table.GetCounterValue(name));
158 name = "c:" + kCounterDecrement; 157 name = "c:" + kCounterDecrement;
159 EXPECT_EQ(-kMaxThreads * kThreadLoops, 158 EXPECT_EQ(-kMaxThreads * kThreadLoops,
160 table.GetCounterValue(name)); 159 table.GetCounterValue(name));
161 name = "c:" + kCounterMixed; 160 name = "c:" + kCounterMixed;
162 EXPECT_EQ((kMaxThreads % 2) * kThreadLoops, 161 EXPECT_EQ((kMaxThreads % 2) * kThreadLoops,
163 table.GetCounterValue(name)); 162 table.GetCounterValue(name));
164 EXPECT_EQ(0, table.CountThreadsRegistered()); 163 EXPECT_EQ(0, table.CountThreadsRegistered());
165 164
166 DeleteShmem(kTableName); 165 DeleteShmem(kTableName);
167 #endif
168 } 166 }
169 167
170 const std::string kMPTableName = "MultipleProcessStatTable"; 168 const std::string kMPTableName = "MultipleProcessStatTable";
171 169
172 MULTIPROCESS_TEST_MAIN(StatsTableMultipleProcessMain) { 170 MULTIPROCESS_TEST_MAIN(StatsTableMultipleProcessMain) {
173 // Each process will open the shared memory and set counters 171 // Each process will open the shared memory and set counters
174 // concurrently in a loop. We'll use some pauses to 172 // concurrently in a loop. We'll use some pauses to
175 // mixup the scheduling. 173 // mixup the scheduling.
176 174
177 StatsTable table(kMPTableName, 0, 0); 175 StatsTable table(kMPTableName, 0, 0);
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 PlatformThread::Sleep(500); 396 PlatformThread::Sleep(500);
399 } 397 }
400 EXPECT_LE(1000, table.GetCounterValue("t:foo")); 398 EXPECT_LE(1000, table.GetCounterValue("t:foo"));
401 EXPECT_LE(1000, table.GetCounterValue("t:bar")); 399 EXPECT_LE(1000, table.GetCounterValue("t:bar"));
402 EXPECT_EQ(2, table.GetCounterValue("c:bar")); 400 EXPECT_EQ(2, table.GetCounterValue("c:bar"));
403 401
404 DeleteShmem(kTableName); 402 DeleteShmem(kTableName);
405 } 403 }
406 404
407 } // namespace base 405 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698