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

Side by Side Diff: dm-bht_unittest.cc

Issue 6811030: verity: remove the depth parameter from bht_create (Closed) Base URL: http://git.chromium.org/git/dm-verity.git@master
Patch Set: Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (C) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (C) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by the GPL v2 license that can 2 // Use of this source code is governed by the GPL v2 license that can
3 // be found in the LICENSE file. 3 // be found in the LICENSE file.
4 // 4 //
5 // Basic unittesting of dm-bht using google-gtest. 5 // Basic unittesting of dm-bht using google-gtest.
6 6
7 #include <base/basictypes.h> 7 #include <base/basictypes.h>
8 #include <base/logging.h> 8 #include <base/logging.h>
9 #include <base/scoped_ptr.h> 9 #include <base/scoped_ptr.h>
10 #include <gtest/gtest.h> 10 #include <gtest/gtest.h>
(...skipping 11 matching lines...) Expand all
22 #endif 22 #endif
23 } 23 }
24 24
25 void *my_memalign(size_t boundary, size_t size) { 25 void *my_memalign(size_t boundary, size_t size) {
26 void * memptr; 26 void * memptr;
27 if (posix_memalign(&memptr, boundary, size)) 27 if (posix_memalign(&memptr, boundary, size))
28 return NULL; 28 return NULL;
29 return memptr; 29 return memptr;
30 } 30 }
31 31
32
33
34 TEST(DmBht, CreateFailOnOverflow) {
35 struct dm_bht bht;
36 // This should fail.
37 EXPECT_EQ(-EINVAL, dm_bht_create(&bht, 32, 1, "sha256"));
Will Drewry 2011/04/07 22:45:17 Again, might be worth trying a _really_ large bloc
38 }
39
40 // Simple test to help valgrind/tcmalloc catch bad mem management 32 // Simple test to help valgrind/tcmalloc catch bad mem management
41 TEST(DmBht, CreateZeroPopulateDestroy) { 33 TEST(DmBht, CreateZeroPopulateDestroy) {
42 struct dm_bht bht; 34 struct dm_bht bht;
43 // This should fail. 35 // This should fail.
44 unsigned int blocks = 16384; 36 unsigned int blocks = 16384;
45 u8 *data = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE); 37 u8 *data = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE);
46 38
47 // Store all the block hashes of blocks of 0. 39 // Store all the block hashes of blocks of 0.
48 memset(reinterpret_cast<void *>(data), 0, sizeof(data)); 40 memset(reinterpret_cast<void *>(data), 0, sizeof(data));
49 EXPECT_EQ(0, dm_bht_create(&bht, 2, blocks, "sha256")); 41 EXPECT_EQ(0, dm_bht_create(&bht, blocks, "sha256"));
50 dm_bht_set_read_cb(&bht, dm_bht_zeroread_callback); 42 dm_bht_set_read_cb(&bht, dm_bht_zeroread_callback);
51 do { 43 do {
52 EXPECT_EQ(dm_bht_store_block(&bht, blocks - 1, data), 0); 44 EXPECT_EQ(dm_bht_store_block(&bht, blocks - 1, data), 0);
53 } while (--blocks > 0); 45 } while (--blocks > 0);
54 EXPECT_EQ(0, dm_bht_compute(&bht, NULL)); 46 EXPECT_EQ(0, dm_bht_compute(&bht, NULL));
55 EXPECT_EQ(0, dm_bht_destroy(&bht)); 47 EXPECT_EQ(0, dm_bht_destroy(&bht));
56 free(data); 48 free(data);
57 } 49 }
58 50
59 class MemoryBhtTest : public ::testing::Test { 51 class MemoryBhtTest : public ::testing::Test {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 sector_t count, 86 sector_t count,
95 struct dm_bht_entry *entry) { 87 struct dm_bht_entry *entry) {
96 MemoryBhtTest *mbht = reinterpret_cast<MemoryBhtTest *>(mbht_instance); 88 MemoryBhtTest *mbht = reinterpret_cast<MemoryBhtTest *>(mbht_instance);
97 mbht->Read(start, dst, count); 89 mbht->Read(start, dst, count);
98 dm_bht_read_completed(entry, 0); 90 dm_bht_read_completed(entry, 0);
99 return 0; 91 return 0;
100 } 92 }
101 93
102 protected: 94 protected:
103 // Creates a new dm_bht and sets it in the existing MemoryBht. 95 // Creates a new dm_bht and sets it in the existing MemoryBht.
104 void NewBht(const unsigned int depth, 96 void NewBht(const unsigned int total_blocks,
105 const unsigned int total_blocks,
106 const char *digest_algorithm) { 97 const char *digest_algorithm) {
107 bht_.reset(new dm_bht()); 98 bht_.reset(new dm_bht());
108 EXPECT_EQ(0, dm_bht_create(bht_.get(),depth, total_blocks, 99 EXPECT_EQ(0, dm_bht_create(bht_.get(), total_blocks,
109 digest_algorithm)); 100 digest_algorithm));
110 if (hash_data_.get() == NULL) { 101 if (hash_data_.get() == NULL) {
111 sectors_ = dm_bht_sectors(bht_.get()); 102 sectors_ = dm_bht_sectors(bht_.get());
112 hash_data_.reset(new u8[to_bytes(sectors_)]); 103 hash_data_.reset(new u8[to_bytes(sectors_)]);
113 } 104 }
114 dm_bht_set_write_cb(bht_.get(), MemoryBhtTest::WriteCallback); 105 dm_bht_set_write_cb(bht_.get(), MemoryBhtTest::WriteCallback);
115 dm_bht_set_read_cb(bht_.get(), MemoryBhtTest::ReadCallback); 106 dm_bht_set_read_cb(bht_.get(), MemoryBhtTest::ReadCallback);
116 } 107 }
117 void SetupBht(const unsigned int depth, 108 void SetupBht(const unsigned int total_blocks,
118 const unsigned int total_blocks,
119 const char *digest_algorithm) { 109 const char *digest_algorithm) {
120 NewBht(depth, total_blocks, digest_algorithm); 110 NewBht(total_blocks, digest_algorithm);
121 111
122 u8 *data = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE); 112 u8 *data = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE);
123 113
124 memset(data, 0, PAGE_SIZE); 114 memset(data, 0, PAGE_SIZE);
125 115
126 unsigned int blocks = total_blocks; 116 unsigned int blocks = total_blocks;
127 do { 117 do {
128 EXPECT_EQ(dm_bht_store_block(bht_.get(), blocks - 1, data), 0); 118 EXPECT_EQ(dm_bht_store_block(bht_.get(), blocks - 1, data), 0);
129 } while (--blocks > 0); 119 } while (--blocks > 0);
130 120
131 dm_bht_set_read_cb(bht_.get(), dm_bht_zeroread_callback); 121 dm_bht_set_read_cb(bht_.get(), dm_bht_zeroread_callback);
132 EXPECT_EQ(0, dm_bht_compute(bht_.get(), NULL)); 122 EXPECT_EQ(0, dm_bht_compute(bht_.get(), NULL));
133 EXPECT_EQ(0, dm_bht_sync(bht_.get(), reinterpret_cast<void *>(this))); 123 EXPECT_EQ(0, dm_bht_sync(bht_.get(), reinterpret_cast<void *>(this)));
134 u8 digest[1024]; 124 u8 digest[1024];
135 dm_bht_root_hexdigest(bht_.get(), digest, sizeof(digest)); 125 dm_bht_root_hexdigest(bht_.get(), digest, sizeof(digest));
136 LOG(INFO) << "MemoryBhtTest root is " << digest; 126 LOG(INFO) << "MemoryBhtTest root is " << digest;
137 EXPECT_EQ(0, dm_bht_destroy(bht_.get())); 127 EXPECT_EQ(0, dm_bht_destroy(bht_.get()));
138 // bht is now dead and mbht_ is a prepared hash image 128 // bht is now dead and mbht_ is a prepared hash image
139 129
140 NewBht(depth, total_blocks, digest_algorithm); 130 NewBht(total_blocks, digest_algorithm);
141 131
142 // Load the tree from the pre-populated hash data 132 // Load the tree from the pre-populated hash data
143 for (blocks = 0; blocks < total_blocks; blocks += bht_->node_count) { 133 for (blocks = 0; blocks < total_blocks; blocks += bht_->node_count) {
144 EXPECT_GE(dm_bht_populate(bht_.get(), 134 EXPECT_GE(dm_bht_populate(bht_.get(),
145 reinterpret_cast<void *>(this), 135 reinterpret_cast<void *>(this),
146 blocks), 136 blocks),
147 DM_BHT_ENTRY_REQUESTED); 137 DM_BHT_ENTRY_REQUESTED);
148 // Since we're testing synchronously, a second run through should yield 138 // Since we're testing synchronously, a second run through should yield
149 // READY. 139 // READY.
150 EXPECT_GE(dm_bht_populate(bht_.get(), 140 EXPECT_GE(dm_bht_populate(bht_.get(),
(...skipping 12 matching lines...) Expand all
163 TEST_F(MemoryBhtTest, CreateThenVerifyOk) { 153 TEST_F(MemoryBhtTest, CreateThenVerifyOk) {
164 static const unsigned int total_blocks = 16384; 154 static const unsigned int total_blocks = 16384;
165 // Set the root hash for a 0-filled image 155 // Set the root hash for a 0-filled image
166 static const char kRootDigest[] = 156 static const char kRootDigest[] =
167 "45d65d6f9e5a962f4d80b5f1bd7a918152251c27bdad8c5f52b590c129833372"; 157 "45d65d6f9e5a962f4d80b5f1bd7a918152251c27bdad8c5f52b590c129833372";
168 // A page of all zeros 158 // A page of all zeros
169 u8 *zero_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE); 159 u8 *zero_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE);
170 160
171 memset(zero_page, 0, PAGE_SIZE); 161 memset(zero_page, 0, PAGE_SIZE);
172 162
173 SetupBht(2, total_blocks, "sha256"); 163 SetupBht(total_blocks, "sha256");
174 dm_bht_set_root_hexdigest(bht_.get(), 164 dm_bht_set_root_hexdigest(bht_.get(),
175 reinterpret_cast<const u8 *>(kRootDigest)); 165 reinterpret_cast<const u8 *>(kRootDigest));
176 166
177 for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) {
178 DLOG(INFO) << "verifying block: " << blocks;
179 EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page));
180 }
181
182 EXPECT_EQ(0, dm_bht_destroy(bht_.get()));
183 free(zero_page);
184 }
185
186 TEST_F(MemoryBhtTest, CreateThenVerifyMultipleLevels) {
187 static const unsigned int total_blocks = 16384;
Will Drewry 2011/04/07 22:45:17 Should this test go away or should it just be chan
188 // Set the root hash for a 0-filled image
189 static const char kRootDigest[] =
190 "c86619624d3456f711dbb94d4ad79a4b029f6fd3b5a4a90b155c856bf5b3409b";
191 // A page of all zeros
192 u8 *zero_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE);
193
194 memset(zero_page, 0, PAGE_SIZE);
195
196 SetupBht(4, total_blocks, "sha256");
197 dm_bht_set_root_hexdigest(bht_.get(),
198 reinterpret_cast<const u8 *>(kRootDigest));
199
200 for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) {
201 DLOG(INFO) << "verifying block: " << blocks;
202 EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page));
203 }
204
205 EXPECT_EQ(0, dm_bht_destroy(bht_.get()));
206 free(zero_page);
207 }
208
209 TEST_F(MemoryBhtTest, CreateThenVerifyZeroDepth) {
210 static const unsigned int total_blocks = 16384;
211 // Set the root hash for a 0-filled image
212 static const char kRootDigest[] =
213 "45d65d6f9e5a962f4d80b5f1bd7a918152251c27bdad8c5f52b590c129833372";
214 // A page of all zeros
215 u8 *zero_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE);
216
217 memset(zero_page, 0, PAGE_SIZE);
218
219 SetupBht(0, total_blocks, "sha256");
220 dm_bht_set_root_hexdigest(bht_.get(),
221 reinterpret_cast<const u8 *>(kRootDigest));
222
223 for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) { 167 for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) {
224 DLOG(INFO) << "verifying block: " << blocks; 168 DLOG(INFO) << "verifying block: " << blocks;
225 EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page)); 169 EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page));
226 } 170 }
227 171
228 EXPECT_EQ(0, dm_bht_destroy(bht_.get())); 172 EXPECT_EQ(0, dm_bht_destroy(bht_.get()));
229 free(zero_page); 173 free(zero_page);
230 } 174 }
231 175
232 TEST_F(MemoryBhtTest, CreateThenVerifyRealParameters) { 176 TEST_F(MemoryBhtTest, CreateThenVerifyRealParameters) {
233 static const unsigned int total_blocks = 217600; 177 static const unsigned int total_blocks = 217600;
234 // Set the root hash for a 0-filled image 178 // Set the root hash for a 0-filled image
235 static const char kRootDigest[] = 179 static const char kRootDigest[] =
236 "15d5a180b5080a1d43e3fbd1f2cd021d0fc3ea91a8e330bad468b980c2fd4d8b"; 180 "15d5a180b5080a1d43e3fbd1f2cd021d0fc3ea91a8e330bad468b980c2fd4d8b";
237 // A page of all zeros 181 // A page of all zeros
238 u8 *zero_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE); 182 u8 *zero_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE);
239 183
240 memset(zero_page, 0, PAGE_SIZE); 184 memset(zero_page, 0, PAGE_SIZE);
241 185
242 SetupBht(3, total_blocks, "sha256"); 186 SetupBht(total_blocks, "sha256");
243 dm_bht_set_root_hexdigest(bht_.get(), 187 dm_bht_set_root_hexdigest(bht_.get(),
244 reinterpret_cast<const u8 *>(kRootDigest)); 188 reinterpret_cast<const u8 *>(kRootDigest));
245 189
246 for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) { 190 for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) {
247 DLOG(INFO) << "verifying block: " << blocks; 191 DLOG(INFO) << "verifying block: " << blocks;
248 EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page)); 192 EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page));
249 } 193 }
250 194
251 EXPECT_EQ(0, dm_bht_destroy(bht_.get())); 195 EXPECT_EQ(0, dm_bht_destroy(bht_.get()));
252 free(zero_page); 196 free(zero_page);
253 } 197 }
254 198
255 TEST_F(MemoryBhtTest, CreateThenVerifyOddLeafCount) { 199 TEST_F(MemoryBhtTest, CreateThenVerifyOddLeafCount) {
256 static const unsigned int total_blocks = 16383; 200 static const unsigned int total_blocks = 16383;
257 // Set the root hash for a 0-filled image 201 // Set the root hash for a 0-filled image
258 static const char kRootDigest[] = 202 static const char kRootDigest[] =
259 "c78d187c430465bd7831fe4908247b6ab5107e3a826d933b71e85aa9a932e03c"; 203 "dc8cec4220d388b05ba75c853f858bb8cc25edfb1d5d2f3be6bdf9edfa66dc6a";
260 // A page of all zeros 204 // A page of all zeros
261 u8 *zero_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE); 205 u8 *zero_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE);
262 206
263 memset(zero_page, 0, PAGE_SIZE); 207 memset(zero_page, 0, PAGE_SIZE);
264 208
265 SetupBht(4, total_blocks, "sha256"); 209 SetupBht(total_blocks, "sha256");
266 dm_bht_set_root_hexdigest(bht_.get(), 210 dm_bht_set_root_hexdigest(bht_.get(),
267 reinterpret_cast<const u8 *>(kRootDigest)); 211 reinterpret_cast<const u8 *>(kRootDigest));
268 212
269 for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) { 213 for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) {
270 DLOG(INFO) << "verifying block: " << blocks; 214 DLOG(INFO) << "verifying block: " << blocks;
271 EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page)); 215 EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page));
272 } 216 }
273 217
274 EXPECT_EQ(0, dm_bht_destroy(bht_.get())); 218 EXPECT_EQ(0, dm_bht_destroy(bht_.get()));
275 free(zero_page); 219 free(zero_page);
276 } 220 }
277 221
278 TEST_F(MemoryBhtTest, CreateThenVerifyOddNodeCount) { 222 TEST_F(MemoryBhtTest, CreateThenVerifyOddNodeCount) {
279 static const unsigned int total_blocks = 16000; 223 static const unsigned int total_blocks = 16000;
280 // Set the root hash for a 0-filled image 224 // Set the root hash for a 0-filled image
281 static const char kRootDigest[] = 225 static const char kRootDigest[] =
282 "13e04b6aa410187b900834aa23e45f3e5240b0c4d2fadb2d8836a357c33499f0"; 226 "10832dd62c427bcf68c56c8de0d1f9c32b61d9e5ddf43c77c56a97b372ad4b07";
283 // A page of all zeros 227 // A page of all zeros
284 u8 *zero_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE); 228 u8 *zero_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE);
285 229
286 memset(zero_page, 0, PAGE_SIZE); 230 memset(zero_page, 0, PAGE_SIZE);
287 231
288 SetupBht(4, total_blocks, "sha256"); 232 SetupBht(total_blocks, "sha256");
289 dm_bht_set_root_hexdigest(bht_.get(), 233 dm_bht_set_root_hexdigest(bht_.get(),
290 reinterpret_cast<const u8 *>(kRootDigest)); 234 reinterpret_cast<const u8 *>(kRootDigest));
291 235
292 for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) { 236 for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) {
293 DLOG(INFO) << "verifying block: " << blocks; 237 DLOG(INFO) << "verifying block: " << blocks;
294 EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page)); 238 EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page));
295 } 239 }
296 240
297 EXPECT_EQ(0, dm_bht_destroy(bht_.get())); 241 EXPECT_EQ(0, dm_bht_destroy(bht_.get()));
298 free(zero_page); 242 free(zero_page);
299 } 243 }
300 244
301 TEST_F(MemoryBhtTest, CreateThenVerifyBadHashBlock) { 245 TEST_F(MemoryBhtTest, CreateThenVerifyBadHashBlock) {
302 static const unsigned int total_blocks = 16384; 246 static const unsigned int total_blocks = 16384;
303 // Set the root hash for a 0-filled image 247 // Set the root hash for a 0-filled image
304 static const char kRootDigest[] = 248 static const char kRootDigest[] =
305 "45d65d6f9e5a962f4d80b5f1bd7a918152251c27bdad8c5f52b590c129833372"; 249 "45d65d6f9e5a962f4d80b5f1bd7a918152251c27bdad8c5f52b590c129833372";
306 // A page of all zeros 250 // A page of all zeros
307 u8 *zero_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE); 251 u8 *zero_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE);
308 252
309 memset(zero_page, 0, PAGE_SIZE); 253 memset(zero_page, 0, PAGE_SIZE);
310 254
311 SetupBht(2, total_blocks, "sha256"); 255 SetupBht(total_blocks, "sha256");
312 256
313 dm_bht_set_root_hexdigest(bht_.get(), 257 dm_bht_set_root_hexdigest(bht_.get(),
314 reinterpret_cast<const u8 *>(kRootDigest)); 258 reinterpret_cast<const u8 *>(kRootDigest));
315 259
316 // TODO(wad) add tests for partial tree validity/verification 260 // TODO(wad) add tests for partial tree validity/verification
317 261
318 // Corrupt one has hblock 262 // Corrupt one has hblock
319 static const unsigned int kBadBlock = 256; 263 static const unsigned int kBadBlock = 256;
320 u8 *bad_hash_block= (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE); 264 u8 *bad_hash_block= (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE);
321 memset(bad_hash_block, 'A', PAGE_SIZE); 265 memset(bad_hash_block, 'A', PAGE_SIZE);
(...skipping 18 matching lines...) Expand all
340 zero_page), 284 zero_page),
341 0); 285 0);
342 286
343 EXPECT_EQ(0, dm_bht_destroy(bht_.get())); 287 EXPECT_EQ(0, dm_bht_destroy(bht_.get()));
344 free(bad_hash_block); 288 free(bad_hash_block);
345 free(zero_page); 289 free(zero_page);
346 } 290 }
347 291
348 TEST_F(MemoryBhtTest, CreateThenVerifyBadDataBlock) { 292 TEST_F(MemoryBhtTest, CreateThenVerifyBadDataBlock) {
349 static const unsigned int total_blocks = 384; 293 static const unsigned int total_blocks = 384;
350 SetupBht(2, total_blocks, "sha256"); 294 SetupBht(total_blocks, "sha256");
351 // Set the root hash for a 0-filled image 295 // Set the root hash for a 0-filled image
352 static const char kRootDigest[] = 296 static const char kRootDigest[] =
353 "45d65d6f9e5a962f4d80b5f1bd7a918152251c27bdad8c5f52b590c129833372"; 297 "45d65d6f9e5a962f4d80b5f1bd7a918152251c27bdad8c5f52b590c129833372";
354 dm_bht_set_root_hexdigest(bht_.get(), 298 dm_bht_set_root_hexdigest(bht_.get(),
355 reinterpret_cast<const u8 *>(kRootDigest)); 299 reinterpret_cast<const u8 *>(kRootDigest));
356 // A corrupt page 300 // A corrupt page
357 u8 *bad_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE); 301 u8 *bad_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE);
358 302
359 memset(bad_page, 'A', PAGE_SIZE); 303 memset(bad_page, 'A', PAGE_SIZE);
360 304
361 305
362 EXPECT_LT(dm_bht_verify_block(bht_.get(), 0, bad_page), 0); 306 EXPECT_LT(dm_bht_verify_block(bht_.get(), 0, bad_page), 0);
363 EXPECT_LT(dm_bht_verify_block(bht_.get(), 127, bad_page), 0); 307 EXPECT_LT(dm_bht_verify_block(bht_.get(), 127, bad_page), 0);
364 EXPECT_LT(dm_bht_verify_block(bht_.get(), 128, bad_page), 0); 308 EXPECT_LT(dm_bht_verify_block(bht_.get(), 128, bad_page), 0);
365 EXPECT_LT(dm_bht_verify_block(bht_.get(), 255, bad_page), 0); 309 EXPECT_LT(dm_bht_verify_block(bht_.get(), 255, bad_page), 0);
366 EXPECT_LT(dm_bht_verify_block(bht_.get(), 256, bad_page), 0); 310 EXPECT_LT(dm_bht_verify_block(bht_.get(), 256, bad_page), 0);
367 EXPECT_LT(dm_bht_verify_block(bht_.get(), 383, bad_page), 0); 311 EXPECT_LT(dm_bht_verify_block(bht_.get(), 383, bad_page), 0);
368 312
369 EXPECT_EQ(0, dm_bht_destroy(bht_.get())); 313 EXPECT_EQ(0, dm_bht_destroy(bht_.get()));
370 free(bad_page); 314 free(bad_page);
371 } 315 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698