diff --git a/util/env_test.cc b/util/env_test.cc index 2163ad14b067700b61f6f66ca6e09acec4e74974..2584b4a3c2ca4603c1c4b83c315410d47bbc07a8 100644 --- a/util/env_test.cc +++ b/util/env_test.cc @@ -364,7 +364,10 @@ TEST(EnvPosixTest, PosixRandomRWFileTest) { unique_ptr file; ASSERT_OK(env_->NewRandomRWFile(fname, &file, soptions)); - ASSERT_OK(file.get()->Allocate(0, 10*1024*1024)); + // If you run the unit test on tmpfs, then tmpfs might not + // support ftruncate. It is still better to trigger that + // code-path instead of eliminating it completely. + file.get()->Allocate(0, 10*1024*1024); ASSERT_OK(file.get()->Write(100, Slice("Hello world"))); ASSERT_OK(file.get()->Write(105, Slice("Hello world"))); ASSERT_OK(file.get()->Sync());