|
@@ -178,74 +178,6 @@ TEST_F(MemorySegmentMappedTest, badDeallocate) {
|
|
|
EXPECT_TRUE(segment_->allMemoryDeallocated());
|
|
|
}
|
|
|
|
|
|
-TEST_F(MemorySegmentMappedTest, DISABLED_basics) {
|
|
|
- MemorySegmentMapped segment(mapped_file);
|
|
|
-
|
|
|
- // By default, nothing is allocated.
|
|
|
- EXPECT_TRUE(segment.allMemoryDeallocated());
|
|
|
-
|
|
|
-#if 0
|
|
|
- void* ptr = segment->allocate(1024);
|
|
|
-
|
|
|
- // Now, we have an allocation:
|
|
|
- EXPECT_FALSE(segment->allMemoryDeallocated());
|
|
|
-
|
|
|
- void* ptr2 = segment->allocate(42);
|
|
|
-
|
|
|
- // Still:
|
|
|
- EXPECT_FALSE(segment->allMemoryDeallocated());
|
|
|
-
|
|
|
- // These should not fail, because the buffers have been allocated.
|
|
|
- EXPECT_NO_FATAL_FAILURE(memset(ptr, 0, 1024));
|
|
|
- EXPECT_NO_FATAL_FAILURE(memset(ptr, 0, 42));
|
|
|
-
|
|
|
- segment->deallocate(ptr, 1024);
|
|
|
-
|
|
|
- // Still:
|
|
|
- EXPECT_FALSE(segment->allMemoryDeallocated());
|
|
|
-
|
|
|
- segment->deallocate(ptr2, 42);
|
|
|
-
|
|
|
- // Now, we have an deallocated everything:
|
|
|
- EXPECT_TRUE(segment->allMemoryDeallocated());
|
|
|
-#endif
|
|
|
-}
|
|
|
-
|
|
|
-/*
|
|
|
-TEST(MemorySegmentLocal, TestBadDeallocate) {
|
|
|
- auto_ptr<MemorySegment> segment(new MemorySegmentLocal());
|
|
|
-
|
|
|
- // By default, nothing is allocated.
|
|
|
- EXPECT_TRUE(segment->allMemoryDeallocated());
|
|
|
-
|
|
|
- void* ptr = segment->allocate(1024);
|
|
|
-
|
|
|
- // Now, we have an allocation:
|
|
|
- EXPECT_FALSE(segment->allMemoryDeallocated());
|
|
|
-
|
|
|
- // This should not throw
|
|
|
- EXPECT_NO_THROW(segment->deallocate(ptr, 1024));
|
|
|
-
|
|
|
- // Now, we have an deallocated everything:
|
|
|
- EXPECT_TRUE(segment->allMemoryDeallocated());
|
|
|
-
|
|
|
- ptr = segment->allocate(1024);
|
|
|
-
|
|
|
- // Now, we have another allocation:
|
|
|
- EXPECT_FALSE(segment->allMemoryDeallocated());
|
|
|
-
|
|
|
- // This should throw as the size passed to deallocate() is larger
|
|
|
- // than what was allocated.
|
|
|
- EXPECT_THROW(segment->deallocate(ptr, 2048), isc::OutOfRange);
|
|
|
-
|
|
|
- // This should not throw
|
|
|
- EXPECT_NO_THROW(segment->deallocate(ptr, 1024));
|
|
|
-
|
|
|
- // Now, we have an deallocated everything:
|
|
|
- EXPECT_TRUE(segment->allMemoryDeallocated());
|
|
|
-}
|
|
|
-*/
|
|
|
-
|
|
|
/*
|
|
|
TEST(MemorySegmentLocal, TestNullDeallocate) {
|
|
|
auto_ptr<MemorySegment> segment(new MemorySegmentLocal());
|