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

Unified Diff: runtime/vm/malloc_hooks_test.cc

Issue 2666133002: Added new type of unit test, RAW_UNIT_TEST_CASE, which is used for tests that can be flaky if run w… (Closed)
Patch Set: Fixed name of UNIT_TEST_CASE macro Created 3 years, 11 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/vm/isolate_test.cc ('k') | runtime/vm/memory_region_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/malloc_hooks_test.cc
diff --git a/runtime/vm/malloc_hooks_test.cc b/runtime/vm/malloc_hooks_test.cc
index b0c5d361228f27db9c2e9d4d010d4c5f9044b816..5054a5047dd0f09c6f4de145c68b79e9b8676740 100644
--- a/runtime/vm/malloc_hooks_test.cc
+++ b/runtime/vm/malloc_hooks_test.cc
@@ -15,9 +15,6 @@
namespace dart {
-// Note: for these tests, there is no need to call MallocHooks::Init() or
-// MallocHooks::TearDown() as this is all done by the VM test framework.
-
static void MallocHookTestBufferInitializer(volatile char* buffer,
uintptr_t size) {
// Run through the buffer and do something. If we don't do this and the memory
@@ -29,10 +26,10 @@ static void MallocHookTestBufferInitializer(volatile char* buffer,
UNIT_TEST_CASE(BasicMallocHookTest) {
+ MallocHooks::InitOnce();
MallocHooks::ResetStats();
EXPECT_EQ(0L, MallocHooks::allocation_count());
EXPECT_EQ(0L, MallocHooks::heap_allocated_memory_in_bytes());
-
const intptr_t buffer_size = 10;
char* buffer = new char[buffer_size];
MallocHookTestBufferInitializer(buffer, buffer_size);
@@ -44,10 +41,12 @@ UNIT_TEST_CASE(BasicMallocHookTest) {
delete[] buffer;
EXPECT_EQ(0L, MallocHooks::allocation_count());
EXPECT_EQ(0L, MallocHooks::heap_allocated_memory_in_bytes());
+ MallocHooks::TearDown();
}
UNIT_TEST_CASE(FreeUnseenMemoryMallocHookTest) {
+ MallocHooks::InitOnce();
const intptr_t pre_hook_buffer_size = 3;
char* pre_hook_buffer = new char[pre_hook_buffer_size];
MallocHookTestBufferInitializer(pre_hook_buffer, pre_hook_buffer_size);
@@ -73,6 +72,7 @@ UNIT_TEST_CASE(FreeUnseenMemoryMallocHookTest) {
delete[] buffer;
EXPECT_EQ(0L, MallocHooks::allocation_count());
EXPECT_EQ(0L, MallocHooks::heap_allocated_memory_in_bytes());
+ MallocHooks::TearDown();
}
}; // namespace dart
« no previous file with comments | « runtime/vm/isolate_test.cc ('k') | runtime/vm/memory_region_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698