From c7076a7a0510eb69ced78ac7cdb03442c810e63c Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Mon, 21 Apr 2014 12:12:02 -0700 Subject: [PATCH] Fix Allocate test Summary: For some reason, on a subset of our continuous build machines, preallocation is allocating 8 block more than it should be. Let's relax the test a little bit -- now we require the test to allocate *at least* the number of blocks as we told them to. Test Plan: no Reviewers: ljin, haobo, sdong Reviewed By: ljin CC: leveldb Differential Revision: https://reviews.facebook.net/D18141 --- util/env_test.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/env_test.cc b/util/env_test.cc index fc2656a02f..6ccfc90013 100644 --- a/util/env_test.cc +++ b/util/env_test.cc @@ -302,7 +302,11 @@ TEST(EnvPosixTest, AllocateTest) { stat(fname.c_str(), &f_stat); ASSERT_EQ((unsigned int)data.size(), f_stat.st_size); // verify that blocks are preallocated - ASSERT_EQ((unsigned int)(kPreallocateSize / kBlockSize), f_stat.st_blocks); + // Note here that we don't check the exact number of blocks preallocated -- + // we only require that number of allocated blocks is at least what we expect. + // It looks like some FS give us more blocks that we asked for. That's fine. + // It might be worth investigating further. + ASSERT_LE((unsigned int)(kPreallocateSize / kBlockSize), f_stat.st_blocks); // close the file, should deallocate the blocks wfile.reset();