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

Unified Diff: runtime/vm/thread_test.cc

Issue 1265503004: Fix issue 23942 by updating expectations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove unintentional leftover comment. Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread_test.cc
diff --git a/runtime/vm/thread_test.cc b/runtime/vm/thread_test.cc
index 887fee565ca778f13668df5827ddafc9ea7e47c8..04f4943d9e457ea4389036145fb5dc31c0f5b1bc 100644
--- a/runtime/vm/thread_test.cc
+++ b/runtime/vm/thread_test.cc
@@ -271,44 +271,46 @@ class SafepointTestTask : public ThreadPool::Task {
for (int i = 0; ; ++i) {
Thread* thread = Thread::Current();
StackZone stack_zone(thread);
- Zone* zone = thread->zone();
- HANDLESCOPE(thread);
- const intptr_t kUniqueSmi = 928327281;
- Smi& smi = Smi::Handle(zone, Smi::New(kUniqueSmi));
- if ((i % 100) != 0) {
- // Usually, we just cooperate.
- isolate_->thread_registry()->CheckSafepoint();
- } else {
- // But occasionally, organize a rendezvous.
- isolate_->thread_registry()->SafepointThreads();
- ObjectCounter counter(isolate_, &smi);
- isolate_->thread_registry()->VisitObjectPointers(&counter);
- {
- MutexLocker ml(mutex_);
- EXPECT_EQ(*expected_count_, counter.count());
- }
- UserTag& tag = UserTag::Handle(zone, isolate_->current_tag());
- if (tag.raw() != isolate_->default_tag()) {
- String& label = String::Handle(zone, tag.label());
- EXPECT(label.Equals("foo"));
- // if this is the first time.
- MutexLocker ml(mutex_);
- if (*expected_count_ == kTaskCount && !local_done_) {
- // Success for the first time! Remember that we are done, and
- // update the total count.
- local_done_ = true;
- ++*total_done_;
- }
- }
- isolate_->thread_registry()->ResumeAllThreads();
- }
- // Check whether everyone is done.
+ Zone* zone = thread->zone();
+ HANDLESCOPE(thread);
+ const intptr_t kUniqueSmi = 928327281;
+ Smi& smi = Smi::Handle(zone, Smi::New(kUniqueSmi));
+ if ((i % 100) != 0) {
+ // Usually, we just cooperate.
+ isolate_->thread_registry()->CheckSafepoint();
+ } else {
+ // But occasionally, organize a rendezvous.
+ isolate_->thread_registry()->SafepointThreads();
+ ObjectCounter counter(isolate_, &smi);
+ isolate_->thread_registry()->VisitObjectPointers(&counter);
{
MutexLocker ml(mutex_);
- if (*total_done_ == kTaskCount) {
- break;
+ EXPECT_EQ(*expected_count_, counter.count());
+ }
+ UserTag& tag = UserTag::Handle(zone, isolate_->current_tag());
+ if (tag.raw() != isolate_->default_tag()) {
+ String& label = String::Handle(zone, tag.label());
+ EXPECT(label.Equals("foo"));
Ivan Posva 2015/08/03 16:07:46 Isn't this a potential source for flaky failures d
koda 2015/08/03 16:15:47 Compilation changes the VM tag, not the user tag.
+ MutexLocker ml(mutex_);
+ if (*expected_count_ == kTaskCount && !local_done_) {
+ // Success for the first time! Remember that we are done, and
+ // update the total count.
+ local_done_ = true;
+ ++*total_done_;
}
}
+ isolate_->thread_registry()->ResumeAllThreads();
Ivan Posva 2015/08/03 16:07:46 Is there a surviving All here?
koda 2015/08/03 16:15:47 Yes. I can rename it in a future CL.
+ }
+ // Check whether everyone is done.
+ {
+ MutexLocker ml(mutex_);
+ if (*total_done_ == kTaskCount) {
+ // Another task might be at SafepointThreads when resuming. Ensure its
+ // expectation reflects reality, since we pop our handles here.
+ --*expected_count_;
+ break;
+ }
+ }
}
Thread::ExitIsolateAsHelper();
{
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698