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
This commit is contained in:
parent
da2fd001a6
commit
8457b74c26
@ -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());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user