Index: runtime/vm/verified_memory_test.cc |
diff --git a/runtime/vm/verified_memory_test.cc b/runtime/vm/verified_memory_test.cc |
index 6d972167f9462b599008cd493077c51f7d57f2ee..90c21ec7fa72a9a54d833e20cce3cd1c891b89b5 100644 |
--- a/runtime/vm/verified_memory_test.cc |
+++ b/runtime/vm/verified_memory_test.cc |
@@ -15,12 +15,20 @@ void Init() { |
} |
+void Shutdown() { |
+#if defined(DEBUG) |
+ FLAG_verified_mem = false; |
+#endif |
+} |
+ |
+ |
UNIT_TEST_CASE(VerifiedMemoryReserve) { |
Init(); |
const intptr_t kReservationSize = 64 * KB; |
VirtualMemory* vm = VerifiedMemory::Reserve(kReservationSize); |
EXPECT_EQ(kReservationSize, vm->size()); |
delete vm; |
+ Shutdown(); |
} |
@@ -31,6 +39,7 @@ UNIT_TEST_CASE(VerifiedMemoryCommit) { |
EXPECT_EQ(kReservationSize, vm->size()); |
vm->Commit(false); |
delete vm; |
+ Shutdown(); |
} |
@@ -53,6 +62,7 @@ UNIT_TEST_CASE(VerifiedMemoryBasic) { |
*unverified = 123; |
VerifiedMemory::Verify(reinterpret_cast<uword>(addr), 3 * sizeof(double)); |
delete vm; |
+ Shutdown(); |
} |
@@ -72,6 +82,7 @@ UNIT_TEST_CASE(VerifiedMemoryAccept) { |
VerifiedMemory::Accept(reinterpret_cast<uword>(addr), 2 * sizeof(double)); |
VerifiedMemory::Verify(reinterpret_cast<uword>(addr), 3 * sizeof(double)); |
delete vm; |
+ Shutdown(); |
} |
@@ -86,6 +97,7 @@ UNIT_TEST_CASE(VerifyImplicit_Crash) { |
double* addr = reinterpret_cast<double*>(vm->address()); |
addr[0] = 0.5; // Forget to use Write. |
VerifiedMemory::Write(&addr[0], 1.5); |
+ Shutdown(); |
} |
@@ -101,6 +113,7 @@ UNIT_TEST_CASE(VerifyExplicit_Crash) { |
addr[1] = 3.5; // Forget to use Write. |
VerifiedMemory::Write(&addr[2], 2.5); |
VerifiedMemory::Verify(reinterpret_cast<uword>(addr), 3 * sizeof(double)); |
+ Shutdown(); |
} |
} // namespace dart |