OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/test/multiprocess_test.h" | 9 #include "base/test/multiprocess_test.h" |
10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 // that all notifiers had the same quality of service. | 275 // that all notifiers had the same quality of service. |
276 EXPECT_EQ(expected_total / pairs.size(), data[i]); | 276 EXPECT_EQ(expected_total / pairs.size(), data[i]); |
277 total += data[i]; | 277 total += data[i]; |
278 } | 278 } |
279 EXPECT_EQ(expected_total, total); | 279 EXPECT_EQ(expected_total, total); |
280 } | 280 } |
281 | 281 |
282 // Functionally equivalent (as far as the shared data goes) to the | 282 // Functionally equivalent (as far as the shared data goes) to the |
283 // ThousandNotifiersTwoThreads test but uses a single pair of notifiers + | 283 // ThousandNotifiersTwoThreads test but uses a single pair of notifiers + |
284 // FlagArray for the 1000 signals. This approach is significantly faster. | 284 // FlagArray for the 1000 signals. This approach is significantly faster. |
285 TEST(CrossProcessNotification, TwoNotifiersTwoThreads1000Signals) { | 285 // Disabled as it trips of the TSAN bot - "Possible data race during write of |
| 286 // size 4" (the flag array). |
| 287 TEST(CrossProcessNotification, DISABLED_TwoNotifiersTwoThreads1000Signals) { |
286 CrossProcessNotification a, b; | 288 CrossProcessNotification a, b; |
287 ASSERT_TRUE(CrossProcessNotification::InitializePair(&a, &b)); | 289 ASSERT_TRUE(CrossProcessNotification::InitializePair(&a, &b)); |
288 | 290 |
289 const size_t kCount = 1000; | 291 const size_t kCount = 1000; |
290 FlagArray signals; | 292 FlagArray signals; |
291 ASSERT_GE(signals.size(), kCount); | 293 ASSERT_GE(signals.size(), kCount); |
292 size_t data[kCount] = {0}; | 294 size_t data[kCount] = {0}; |
293 | 295 |
294 // Since this algorithm checks all events each time the notifier is | 296 // Since this algorithm checks all events each time the notifier is |
295 // signaled, |repeat| doesn't mean the same thing here as it does in | 297 // signaled, |repeat| doesn't mean the same thing here as it does in |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 | 453 |
452 ipc->ready = true; | 454 ipc->ready = true; |
453 | 455 |
454 a.Signal(); | 456 a.Signal(); |
455 a.Wait(); | 457 a.Wait(); |
456 | 458 |
457 int exit_code = -1; | 459 int exit_code = -1; |
458 base::WaitForExitCode(process, &exit_code); | 460 base::WaitForExitCode(process, &exit_code); |
459 EXPECT_EQ(0, exit_code); | 461 EXPECT_EQ(0, exit_code); |
460 } | 462 } |
OLD | NEW |