Skip to content

Commit

Permalink
Fix Unit test when run on tmpfs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dhruba committed Oct 15, 2013
1 parent da2fd00 commit 8457b74
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion util/env_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,10 @@ TEST(EnvPosixTest, PosixRandomRWFileTest) {

unique_ptr<RandomRWFile> 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());
Expand Down

0 comments on commit 8457b74

Please sign in to comment.