提交 8457b74c 编写于 作者: D Dhruba Borthakur

Fix Unit test when run on tmpfs

Summary:
tmpfs might not support fallocate(). Fix unit test so that this
does not cause a unit test to fail.

Test Plan: ./env_test

Reviewers: emayanke, igor, kailiu

Reviewed By: kailiu

CC: leveldb

Differential Revision: https://reviews.facebook.net/D13455
上级 da2fd001
...@@ -364,7 +364,10 @@ TEST(EnvPosixTest, PosixRandomRWFileTest) { ...@@ -364,7 +364,10 @@ TEST(EnvPosixTest, PosixRandomRWFileTest) {
unique_ptr<RandomRWFile> file; unique_ptr<RandomRWFile> file;
ASSERT_OK(env_->NewRandomRWFile(fname, &file, soptions)); 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(100, Slice("Hello world")));
ASSERT_OK(file.get()->Write(105, Slice("Hello world"))); ASSERT_OK(file.get()->Write(105, Slice("Hello world")));
ASSERT_OK(file.get()->Sync()); ASSERT_OK(file.get()->Sync());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册