Index: dm-bht_unittest.cc |
diff --git a/dm-bht_unittest.cc b/dm-bht_unittest.cc |
index f0c090ca72ff66714de9f4b7d22db507de2393d0..d7cf61ad1d6fa564024d84bb1dfaf4036d5b6072 100644 |
--- a/dm-bht_unittest.cc |
+++ b/dm-bht_unittest.cc |
@@ -172,7 +172,8 @@ TEST_F(MemoryBhtTest, CreateThenVerifyOk) { |
for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) { |
DLOG(INFO) << "verifying block: " << blocks; |
- EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page)); |
+ EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, |
+ virt_to_page(zero_page), 0)); |
} |
EXPECT_EQ(0, dm_bht_destroy(bht_.get())); |
@@ -195,7 +196,8 @@ TEST_F(MemoryBhtTest, CreateThenVerifySingleLevel) { |
for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) { |
DLOG(INFO) << "verifying block: " << blocks; |
- EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page)); |
+ EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, |
+ virt_to_page(zero_page), 0)); |
} |
EXPECT_EQ(0, dm_bht_destroy(bht_.get())); |
@@ -218,7 +220,8 @@ TEST_F(MemoryBhtTest, CreateThenVerifyRealParameters) { |
for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) { |
DLOG(INFO) << "verifying block: " << blocks; |
- EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page)); |
+ EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, |
+ virt_to_page(zero_page), 0)); |
} |
EXPECT_EQ(0, dm_bht_destroy(bht_.get())); |
@@ -241,7 +244,8 @@ TEST_F(MemoryBhtTest, CreateThenVerifyOddLeafCount) { |
for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) { |
DLOG(INFO) << "verifying block: " << blocks; |
- EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page)); |
+ EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, |
+ virt_to_page(zero_page), 0)); |
} |
EXPECT_EQ(0, dm_bht_destroy(bht_.get())); |
@@ -264,7 +268,8 @@ TEST_F(MemoryBhtTest, CreateThenVerifyOddNodeCount) { |
for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) { |
DLOG(INFO) << "verifying block: " << blocks; |
- EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page)); |
+ EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, |
+ virt_to_page(zero_page), 0)); |
} |
EXPECT_EQ(0, dm_bht_destroy(bht_.get())); |
@@ -295,23 +300,25 @@ TEST_F(MemoryBhtTest, CreateThenVerifyBadHashBlock) { |
EXPECT_EQ(dm_bht_store_block(bht_.get(), kBadBlock, bad_hash_block), 0); |
// Attempt to verify both the bad block and all the neighbors. |
- EXPECT_LT(dm_bht_verify_block(bht_.get(), kBadBlock + 1, zero_page), 0); |
+ EXPECT_LT(dm_bht_verify_block(bht_.get(), kBadBlock + 1, |
+ virt_to_page(zero_page), 0), 0); |
- EXPECT_LT(dm_bht_verify_block(bht_.get(), kBadBlock + 2, zero_page), 0); |
+ EXPECT_LT(dm_bht_verify_block(bht_.get(), kBadBlock + 2, |
+ virt_to_page(zero_page), 0), 0); |
EXPECT_LT(dm_bht_verify_block(bht_.get(), kBadBlock + (bht_->node_count / 2), |
- zero_page), |
- 0); |
+ virt_to_page(zero_page), 0), 0); |
- EXPECT_LT(dm_bht_verify_block(bht_.get(), kBadBlock, zero_page), 0); |
+ EXPECT_LT(dm_bht_verify_block(bht_.get(), kBadBlock, |
+ virt_to_page(zero_page), 0), 0); |
// Verify that the prior entry is untouched and still safe |
- EXPECT_EQ(dm_bht_verify_block(bht_.get(), kBadBlock - 1, zero_page), 0); |
+ EXPECT_EQ(dm_bht_verify_block(bht_.get(), kBadBlock - 1, |
+ virt_to_page(zero_page), 0), 0); |
// Same for the next entry |
EXPECT_EQ(dm_bht_verify_block(bht_.get(), kBadBlock + bht_->node_count, |
- zero_page), |
- 0); |
+ virt_to_page(zero_page), 0), 0); |
EXPECT_EQ(0, dm_bht_destroy(bht_.get())); |
free(bad_hash_block); |
@@ -332,12 +339,12 @@ TEST_F(MemoryBhtTest, CreateThenVerifyBadDataBlock) { |
memset(bad_page, 'A', PAGE_SIZE); |
- EXPECT_LT(dm_bht_verify_block(bht_.get(), 0, bad_page), 0); |
- EXPECT_LT(dm_bht_verify_block(bht_.get(), 127, bad_page), 0); |
- EXPECT_LT(dm_bht_verify_block(bht_.get(), 128, bad_page), 0); |
- EXPECT_LT(dm_bht_verify_block(bht_.get(), 255, bad_page), 0); |
- EXPECT_LT(dm_bht_verify_block(bht_.get(), 256, bad_page), 0); |
- EXPECT_LT(dm_bht_verify_block(bht_.get(), 383, bad_page), 0); |
+ EXPECT_LT(dm_bht_verify_block(bht_.get(), 0, virt_to_page(bad_page), 0), 0); |
+ EXPECT_LT(dm_bht_verify_block(bht_.get(), 127, virt_to_page(bad_page), 0), 0); |
+ EXPECT_LT(dm_bht_verify_block(bht_.get(), 128, virt_to_page(bad_page), 0), 0); |
+ EXPECT_LT(dm_bht_verify_block(bht_.get(), 255, virt_to_page(bad_page), 0), 0); |
+ EXPECT_LT(dm_bht_verify_block(bht_.get(), 256, virt_to_page(bad_page), 0), 0); |
+ EXPECT_LT(dm_bht_verify_block(bht_.get(), 383, virt_to_page(bad_page), 0), 0); |
EXPECT_EQ(0, dm_bht_destroy(bht_.get())); |
free(bad_page); |