提交 e7697b8c 编写于 作者: S Siying Dong 提交者: Facebook Github Bot

Fix LITE unit tests

Summary: Closes https://github.com/facebook/rocksdb/pull/2649

Differential Revision: D5505778

Pulled By: siying

fbshipit-source-id: 7e935603ede3d958ea087ed6b8cfc4121e8797bc
上级 3ce20e98
...@@ -204,7 +204,6 @@ TEST_F(DBIOFailureTest, ManifestWriteError) { ...@@ -204,7 +204,6 @@ TEST_F(DBIOFailureTest, ManifestWriteError) {
ASSERT_EQ("bar2", Get("foo2")); ASSERT_EQ("bar2", Get("foo2"));
} }
} }
#endif // ROCKSDB_LITE
TEST_F(DBIOFailureTest, PutFailsParanoid) { TEST_F(DBIOFailureTest, PutFailsParanoid) {
// Test the following: // Test the following:
...@@ -559,6 +558,7 @@ TEST_F(DBIOFailureTest, CompactionSstSyncError) { ...@@ -559,6 +558,7 @@ TEST_F(DBIOFailureTest, CompactionSstSyncError) {
ASSERT_EQ("bar3", Get(1, "foo")); ASSERT_EQ("bar3", Get(1, "foo"));
} }
#endif // !(defined NDEBUG) || !defined(OS_WIN) #endif // !(defined NDEBUG) || !defined(OS_WIN)
#endif // ROCKSDB_LITE
} // namespace rocksdb } // namespace rocksdb
int main(int argc, char** argv) { int main(int argc, char** argv) {
......
...@@ -2236,6 +2236,7 @@ TEST_F(DBTest2, LowPriWrite) { ...@@ -2236,6 +2236,7 @@ TEST_F(DBTest2, LowPriWrite) {
ASSERT_EQ(1, rate_limit_count.load()); ASSERT_EQ(1, rate_limit_count.load());
} }
#ifndef ROCKSDB_LITE
TEST_F(DBTest2, RateLimitedCompactionReads) { TEST_F(DBTest2, RateLimitedCompactionReads) {
// compaction input has 512KB data // compaction input has 512KB data
const int kNumKeysPerFile = 128; const int kNumKeysPerFile = 128;
...@@ -2299,7 +2300,7 @@ TEST_F(DBTest2, RateLimitedCompactionReads) { ...@@ -2299,7 +2300,7 @@ TEST_F(DBTest2, RateLimitedCompactionReads) {
options.rate_limiter->GetTotalBytesThrough(Env::IO_LOW))); options.rate_limiter->GetTotalBytesThrough(Env::IO_LOW)));
} }
} }
#endif // ROCKSDB_LITE
} // namespace rocksdb } // namespace rocksdb
int main(int argc, char** argv) { int main(int argc, char** argv) {
......
...@@ -42,13 +42,24 @@ SpecialEnv::SpecialEnv(Env* base) ...@@ -42,13 +42,24 @@ SpecialEnv::SpecialEnv(Env* base)
non_writable_count_ = 0; non_writable_count_ = 0;
table_write_callback_ = nullptr; table_write_callback_ = nullptr;
} }
#ifndef ROCKSDB_LITE
ROT13BlockCipher rot13Cipher_(16); ROT13BlockCipher rot13Cipher_(16);
#endif // ROCKSDB_LITE
DBTestBase::DBTestBase(const std::string path) DBTestBase::DBTestBase(const std::string path)
: mem_env_(!getenv("MEM_ENV") ? nullptr : new MockEnv(Env::Default())), : mem_env_(!getenv("MEM_ENV") ? nullptr : new MockEnv(Env::Default())),
encrypted_env_(!getenv("ENCRYPTED_ENV") ? nullptr : NewEncryptedEnv(mem_env_ ? mem_env_ : Env::Default(), new CTREncryptionProvider(rot13Cipher_))), #ifndef ROCKSDB_LITE
env_(new SpecialEnv(encrypted_env_ ? encrypted_env_ : (mem_env_ ? mem_env_ : Env::Default()))), encrypted_env_(
!getenv("ENCRYPTED_ENV")
? nullptr
: NewEncryptedEnv(mem_env_ ? mem_env_ : Env::Default(),
new CTREncryptionProvider(rot13Cipher_))),
#else
encrypted_env_(nullptr),
#endif // ROCKSDB_LITE
env_(new SpecialEnv(encrypted_env_
? encrypted_env_
: (mem_env_ ? mem_env_ : Env::Default()))),
option_config_(kDefault) { option_config_(kDefault) {
env_->SetBackgroundThreads(1, Env::LOW); env_->SetBackgroundThreads(1, Env::LOW);
env_->SetBackgroundThreads(1, Env::HIGH); env_->SetBackgroundThreads(1, Env::HIGH);
......
...@@ -143,7 +143,13 @@ TEST_F(WritableFileWriterTest, IncrementalBuffer) { ...@@ -143,7 +143,13 @@ TEST_F(WritableFileWriterTest, IncrementalBuffer) {
env_options.writable_file_max_buffer_size = env_options.writable_file_max_buffer_size =
(attempt < kNumAttempts / 2) ? 512 * 1024 : 700 * 1024; (attempt < kNumAttempts / 2) ? 512 * 1024 : 700 * 1024;
std::string actual; std::string actual;
unique_ptr<FakeWF> wf(new FakeWF(&actual, attempt % 2 == 1, no_flush)); unique_ptr<FakeWF> wf(new FakeWF(&actual,
#ifndef ROCKSDB_LITE
attempt % 2 == 1,
#else
false,
#endif
no_flush));
unique_ptr<WritableFileWriter> writer( unique_ptr<WritableFileWriter> writer(
new WritableFileWriter(std::move(wf), env_options)); new WritableFileWriter(std::move(wf), env_options));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册