Chromium Code Reviews| Index: runtime/vm/thread_test.cc |
| diff --git a/runtime/vm/thread_test.cc b/runtime/vm/thread_test.cc |
| index 790596982a137901e5d30cdb0ee504d03dedde00..5c1e9ca9428e7a938c1182d87dea1dcc8300aa83 100644 |
| --- a/runtime/vm/thread_test.cc |
| +++ b/runtime/vm/thread_test.cc |
| @@ -325,21 +325,33 @@ TEST_CASE(ManySimpleTasksWithZones) { |
| // Confirm all expected entries are in the JSON output. |
| for (intptr_t i = 0; i < kTaskCount + 1; i++) { |
| Thread* thread = threads[i]; |
| + |
| + // Skip checking the current thread since we'll be allocating |
| + // thread_info_buf into the current thread's zone, messing with the test |
| + // values. |
| + if (thread == current_thread) { |
| + continue; |
| + } |
|
siva
2017/03/22 17:50:55
How did the current_thread get into the threads ar
bkonyi
2017/03/22 18:01:48
Good catch. I guess when I originally wrote this t
|
| + |
| StackZone stack_zone(current_thread); |
| Zone* current_zone = current_thread->zone(); |
| // Check the thread exists and is the correct size. |
| - char* thread_info_buf = |
| - OS::SCreate(current_zone, |
| - "\"type\":\"_Thread\"," |
| - "\"id\":\"threads\\/%" Pd |
| - "\"," |
| - "\"kind\":\"%s\"," |
| - "\"_memoryHighWatermark\":\"%" Pu "\"", |
| - OSThread::ThreadIdToIntPtr(thread->os_thread()->trace_id()), |
| - Thread::TaskKindToCString(thread->task_kind()), |
| - thread->memory_high_watermark()); |
| - |
| + char* thread_info_buf = OS::SCreate( |
| + current_zone, |
| + "\"type\":\"_Thread\"," |
| + "\"id\":\"threads\\/%" Pd |
| + "\"," |
| + "\"kind\":\"%s\"," |
| + "\"_zoneHighWatermark\":\"%" Pu |
| + "\"," |
| + "\"_zoneCapacity\":\"%" Pu |
| + "\"," |
| + "\"_zoneUsage\":\"%" Pu "\"", |
| + OSThread::ThreadIdToIntPtr(thread->os_thread()->trace_id()), |
| + Thread::TaskKindToCString(thread->task_kind()), |
| + thread->zone_high_watermark(), thread->current_zone_capacity(), |
| + thread->current_zone_memory_usage()); |
| EXPECT_SUBSTRING(thread_info_buf, json); |
| } |