diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2017-06-09 19:24:30 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2017-06-09 19:24:30 -0700 |
commit | e4030ab4f47065c362901109c74ca8e791c2de0a (patch) | |
tree | c1678f5a72d3888ad5e4621073bbe4fa698883b5 /src/leveldb/util/env_test.cc | |
parent | 1b708f2cf3e6e6a17c5b6dbf2909a2ed2e35755a (diff) | |
parent | cf44e4ca7762742c6c3154447b40869ec9d041db (diff) |
Update to LevelDB 1.20
Diffstat (limited to 'src/leveldb/util/env_test.cc')
-rw-r--r-- | src/leveldb/util/env_test.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/leveldb/util/env_test.cc b/src/leveldb/util/env_test.cc index b72cb44384..839ae56a1a 100644 --- a/src/leveldb/util/env_test.cc +++ b/src/leveldb/util/env_test.cc @@ -10,29 +10,31 @@ namespace leveldb { static const int kDelayMicros = 100000; +static const int kReadOnlyFileLimit = 4; +static const int kMMapLimit = 4; -class EnvPosixTest { +class EnvTest { private: port::Mutex mu_; std::string events_; public: Env* env_; - EnvPosixTest() : env_(Env::Default()) { } + EnvTest() : env_(Env::Default()) { } }; static void SetBool(void* ptr) { reinterpret_cast<port::AtomicPointer*>(ptr)->NoBarrier_Store(ptr); } -TEST(EnvPosixTest, RunImmediately) { +TEST(EnvTest, RunImmediately) { port::AtomicPointer called (NULL); env_->Schedule(&SetBool, &called); - Env::Default()->SleepForMicroseconds(kDelayMicros); + env_->SleepForMicroseconds(kDelayMicros); ASSERT_TRUE(called.NoBarrier_Load() != NULL); } -TEST(EnvPosixTest, RunMany) { +TEST(EnvTest, RunMany) { port::AtomicPointer last_id (NULL); struct CB { @@ -59,7 +61,7 @@ TEST(EnvPosixTest, RunMany) { env_->Schedule(&CB::Run, &cb3); env_->Schedule(&CB::Run, &cb4); - Env::Default()->SleepForMicroseconds(kDelayMicros); + env_->SleepForMicroseconds(kDelayMicros); void* cur = last_id.Acquire_Load(); ASSERT_EQ(4, reinterpret_cast<uintptr_t>(cur)); } @@ -78,7 +80,7 @@ static void ThreadBody(void* arg) { s->mu.Unlock(); } -TEST(EnvPosixTest, StartThread) { +TEST(EnvTest, StartThread) { State state; state.val = 0; state.num_running = 3; @@ -92,7 +94,7 @@ TEST(EnvPosixTest, StartThread) { if (num == 0) { break; } - Env::Default()->SleepForMicroseconds(kDelayMicros); + env_->SleepForMicroseconds(kDelayMicros); } ASSERT_EQ(state.val, 3); } |