Index: test/cctest/test-platform-linux.cc |
diff --git a/test/cctest/test-platform-linux.cc b/test/cctest/test-platform-linux.cc |
index e0eae026cc7171c696586b27884890fe53a5077e..f289e948284cc1ec2f2e170b70c4063b289177c5 100644 |
--- a/test/cctest/test-platform-linux.cc |
+++ b/test/cctest/test-platform-linux.cc |
@@ -39,6 +39,20 @@ |
using namespace ::v8::internal; |
+TEST(VirtualMemory) { |
+ VirtualMemory* vm = new VirtualMemory(1 * MB); |
+ CHECK(vm->IsReserved()); |
+ void* block_addr = vm->address(); |
+ size_t block_size = 4 * KB; |
+ CHECK(vm->Commit(block_addr, block_size, false)); |
+ // Check whether we can write to memory. |
+ int* addr = static_cast<int*>(block_addr); |
+ addr[KB-1] = 2; |
+ CHECK(vm->Uncommit(block_addr, block_size)); |
+ delete vm; |
+} |
+ |
+ |
TEST(GetCurrentProcessId) { |
CHECK_EQ(static_cast<int>(getpid()), OS::GetCurrentProcessId()); |
} |