Skip to content

Commit 05c1686

Browse files
committed
Relax env_test::AllocateTest
1 parent ff1b5df commit 05c1686

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

util/env_test.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -306,16 +306,16 @@ TEST(EnvPosixTest, AllocateTest) {
306306
// we only require that number of allocated blocks is at least what we expect.
307307
// It looks like some FS give us more blocks that we asked for. That's fine.
308308
// It might be worth investigating further.
309-
ASSERT_LE((unsigned int)(kPreallocateSize / kBlockSize), f_stat.st_blocks);
309+
auto st_blocks = f_stat.st_blocks;
310+
ASSERT_LE((unsigned int)(kPreallocateSize / kBlockSize), st_blocks);
310311

311312
// close the file, should deallocate the blocks
312313
wfile.reset();
313314

314315
stat(fname.c_str(), &f_stat);
315316
ASSERT_EQ((unsigned int)data.size(), f_stat.st_size);
316317
// verify that preallocated blocks were deallocated on file close
317-
size_t data_blocks_pages = ((data.size() + kPageSize - 1) / kPageSize);
318-
ASSERT_EQ((unsigned int)(data_blocks_pages * kPageSize / kBlockSize), f_stat.st_blocks);
318+
ASSERT_GT(st_blocks, f_stat.st_blocks);
319319
}
320320
#endif
321321

0 commit comments

Comments
 (0)