From 4afa9110e04f6cb06287dcd520bc7330b84d8207 Mon Sep 17 00:00:00 2001 From: Adam Klein Date: Thu, 27 Apr 2017 11:48:47 -0700 Subject: [PATCH] [cctest] Fix more flakiness in Heap-related cctests on nosnap builds These tests assume that a newly-created Isolate is pristine, but that's not true for nosnap builds. TBR=ulan@chromium.org Change-Id: Ie5d0fb0450f285c8eeb8e088feef6729102c0f14 Reviewed-on: https://chromium-review.googlesource.com/489063 Reviewed-by: Adam Klein Commit-Queue: Adam Klein Cr-Commit-Position: refs/heads/master@{#44952} --- test/cctest/heap/test-array-buffer-tracker.cc | 4 ++++ test/cctest/heap/test-heap.cc | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/cctest/heap/test-array-buffer-tracker.cc b/test/cctest/heap/test-array-buffer-tracker.cc index 4c668f636d..ff505a986d 100644 --- a/test/cctest/heap/test-array-buffer-tracker.cc +++ b/test/cctest/heap/test-array-buffer-tracker.cc @@ -310,6 +310,10 @@ UNINITIALIZED_TEST(ArrayBuffer_SemiSpaceCopyMultipleTasks) { v8::Context::New(isolate)->Enter(); Heap* heap = i_isolate->heap(); + // Ensure heap is in a clean state. + heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, + GarbageCollectionReason::kTesting); + Local ab1 = v8::ArrayBuffer::New(isolate, 100); Handle buf1 = v8::Utils::OpenHandle(*ab1); heap::FillCurrentPage(heap->new_space()); diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc index 25e1a66470..d6532fa104 100644 --- a/test/cctest/heap/test-heap.cc +++ b/test/cctest/heap/test-heap.cc @@ -2106,8 +2106,7 @@ TEST(GrowAndShrinkNewSpace) { } // Make sure we're in a consistent state to start out. - CcTest::CollectGarbage(NEW_SPACE); - CcTest::CollectGarbage(NEW_SPACE); + CcTest::CollectAllGarbage(); // Explicitly growing should double the space capacity. size_t old_capacity, new_capacity;