Enable a few unit tests to use custom Env objects (#9087)
Summary: Allow compaction_job_test, db_io_failure_test, dbformat_test, deletefile_test, and fault_injection_test to use a custom Env object. Also move ```RegisterCustomObjects``` declaration to a header file to simplify things. Pull Request resolved: https://github.com/facebook/rocksdb/pull/9087 Test Plan: Run manually using "buck test rocksdb/src:compaction_job_test_fbcode" etc. Reviewed By: riversand963 Differential Revision: D32007222 Pulled By: anand1976 fbshipit-source-id: 99af58559e25bf61563dfa95dc46e31fa7375792
This commit is contained in:
parent
78556c14dd
commit
dddb791c18
@ -1018,14 +1018,6 @@ TEST_P(DBBlobBasicIOErrorTest, CompactionFilterReadBlob_IOError) {
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -592,14 +592,6 @@ TEST_F(DBBlobCompactionTest, MergeBlobWithBase) {
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -74,14 +74,6 @@ TEST_F(DBBlobCorruptionTest, VerifyWholeBlobFileChecksum) {
|
|||||||
#endif // !ROCKSDB_LITE
|
#endif // !ROCKSDB_LITE
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -564,14 +564,6 @@ TEST_F(DBBlobIndexTest, IntegratedBlobIterate) {
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -3433,14 +3433,6 @@ TEST(ColumnFamilyTest, ValidateBlobGCForceThreshold) {
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "db/version_set.h"
|
#include "db/version_set.h"
|
||||||
#include "file/writable_file_writer.h"
|
#include "file/writable_file_writer.h"
|
||||||
#include "rocksdb/cache.h"
|
#include "rocksdb/cache.h"
|
||||||
|
#include "rocksdb/convenience.h"
|
||||||
#include "rocksdb/db.h"
|
#include "rocksdb/db.h"
|
||||||
#include "rocksdb/file_system.h"
|
#include "rocksdb/file_system.h"
|
||||||
#include "rocksdb/options.h"
|
#include "rocksdb/options.h"
|
||||||
@ -73,9 +74,7 @@ class CompactionJobTestBase : public testing::Test {
|
|||||||
protected:
|
protected:
|
||||||
CompactionJobTestBase(std::string dbname, const Comparator* ucmp,
|
CompactionJobTestBase(std::string dbname, const Comparator* ucmp,
|
||||||
std::function<std::string(uint64_t)> encode_u64_ts)
|
std::function<std::string(uint64_t)> encode_u64_ts)
|
||||||
: env_(Env::Default()),
|
: dbname_(std::move(dbname)),
|
||||||
fs_(env_->GetFileSystem()),
|
|
||||||
dbname_(std::move(dbname)),
|
|
||||||
ucmp_(ucmp),
|
ucmp_(ucmp),
|
||||||
db_options_(),
|
db_options_(),
|
||||||
mutable_cf_options_(cf_options_),
|
mutable_cf_options_(cf_options_),
|
||||||
@ -91,7 +90,13 @@ class CompactionJobTestBase : public testing::Test {
|
|||||||
preserve_deletes_seqnum_(0),
|
preserve_deletes_seqnum_(0),
|
||||||
mock_table_factory_(new mock::MockTableFactory()),
|
mock_table_factory_(new mock::MockTableFactory()),
|
||||||
error_handler_(nullptr, db_options_, &mutex_),
|
error_handler_(nullptr, db_options_, &mutex_),
|
||||||
encode_u64_ts_(std::move(encode_u64_ts)) {}
|
encode_u64_ts_(std::move(encode_u64_ts)) {
|
||||||
|
Env* base_env = Env::Default();
|
||||||
|
EXPECT_OK(
|
||||||
|
test::CreateEnvFromSystem(ConfigOptions(), &base_env, &env_guard_));
|
||||||
|
env_ = base_env;
|
||||||
|
fs_ = env_->GetFileSystem();
|
||||||
|
}
|
||||||
|
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
EXPECT_OK(env_->CreateDirIfMissing(dbname_));
|
EXPECT_OK(env_->CreateDirIfMissing(dbname_));
|
||||||
@ -386,6 +391,7 @@ class CompactionJobTestBase : public testing::Test {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<Env> env_guard_;
|
||||||
Env* env_;
|
Env* env_;
|
||||||
std::shared_ptr<FileSystem> fs_;
|
std::shared_ptr<FileSystem> fs_;
|
||||||
std::string dbname_;
|
std::string dbname_;
|
||||||
@ -1403,6 +1409,7 @@ TEST_F(CompactionJobTimestampTest, SomeKeysExpired) {
|
|||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
RegisterCustomObjects(argc, argv);
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,14 +806,6 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -890,14 +890,6 @@ TEST_F(CorruptionTest, VerifyWholeTableChecksum) {
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -3860,14 +3860,6 @@ INSTANTIATE_TEST_CASE_P(DBBasicTestDeadline, DBBasicTestDeadline,
|
|||||||
std::make_tuple(true, true)));
|
std::make_tuple(true, true)));
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -588,5 +588,6 @@ TEST_F(DBIOFailureTest, CompactionSstSyncError) {
|
|||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
RegisterCustomObjects(argc, argv);
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
|
@ -1681,14 +1681,6 @@ TEST_F(DBSSTTest, DBWithSFMForBlobFilesAtomicFlush) {
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -6956,14 +6956,6 @@ TEST_F(DBTest, MemoryUsageWithMaxWriteBufferSizeToMaintain) {
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -6765,14 +6765,6 @@ TEST_F(DBTest2, RenameDirectory) {
|
|||||||
}
|
}
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -3084,14 +3084,6 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -785,14 +785,6 @@ INSTANTIATE_TEST_CASE_P(DBWriteBufferManagerTest, DBWriteBufferManagerTest,
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -461,5 +461,6 @@ INSTANTIATE_TEST_CASE_P(DBWriteTestInstance, DBWriteTest,
|
|||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
RegisterCustomObjects(argc, argv);
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
||||||
|
|
||||||
#include "db/dbformat.h"
|
#include "db/dbformat.h"
|
||||||
|
|
||||||
#include "test_util/testharness.h"
|
#include "test_util/testharness.h"
|
||||||
|
#include "test_util/testutil.h"
|
||||||
|
|
||||||
namespace ROCKSDB_NAMESPACE {
|
namespace ROCKSDB_NAMESPACE {
|
||||||
|
|
||||||
@ -202,5 +204,6 @@ TEST_F(FormatTest, RangeTombstoneSerializeEndKey) {
|
|||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
RegisterCustomObjects(argc, argv);
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
|
@ -596,14 +596,6 @@ TEST_F(DeleteFileTest, DeleteNonDefaultColumnFamily) {
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -1806,14 +1806,6 @@ INSTANTIATE_TEST_CASE_P(ExternalSSTFileBasicTest, ExternalSSTFileBasicTest,
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "env/mock_env.h"
|
#include "env/mock_env.h"
|
||||||
#include "file/filename.h"
|
#include "file/filename.h"
|
||||||
#include "rocksdb/cache.h"
|
#include "rocksdb/cache.h"
|
||||||
|
#include "rocksdb/convenience.h"
|
||||||
#include "rocksdb/db.h"
|
#include "rocksdb/db.h"
|
||||||
#include "rocksdb/env.h"
|
#include "rocksdb/env.h"
|
||||||
#include "rocksdb/table.h"
|
#include "rocksdb/table.h"
|
||||||
@ -81,7 +82,11 @@ class FaultInjectionTest
|
|||||||
sync_use_compact_(true),
|
sync_use_compact_(true),
|
||||||
base_env_(nullptr),
|
base_env_(nullptr),
|
||||||
env_(nullptr),
|
env_(nullptr),
|
||||||
db_(nullptr) {}
|
db_(nullptr) {
|
||||||
|
EXPECT_OK(
|
||||||
|
test::CreateEnvFromSystem(ConfigOptions(), &system_env_, &env_guard_));
|
||||||
|
EXPECT_NE(system_env_, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
~FaultInjectionTest() override {
|
~FaultInjectionTest() override {
|
||||||
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing();
|
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing();
|
||||||
@ -94,7 +99,7 @@ class FaultInjectionTest
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (option_config_ == kMultiLevels) {
|
if (option_config_ == kMultiLevels) {
|
||||||
base_env_.reset(MockEnv::Create(Env::Default()));
|
base_env_.reset(MockEnv::Create(system_env_));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -146,8 +151,7 @@ class FaultInjectionTest
|
|||||||
assert(tiny_cache_ == nullptr);
|
assert(tiny_cache_ == nullptr);
|
||||||
assert(env_ == nullptr);
|
assert(env_ == nullptr);
|
||||||
|
|
||||||
env_ =
|
env_ = new FaultInjectionTestEnv(base_env_ ? base_env_.get() : system_env_);
|
||||||
new FaultInjectionTestEnv(base_env_ ? base_env_.get() : Env::Default());
|
|
||||||
|
|
||||||
options_ = CurrentOptions();
|
options_ = CurrentOptions();
|
||||||
options_.env = env_;
|
options_.env = env_;
|
||||||
@ -345,6 +349,10 @@ class FaultInjectionTest
|
|||||||
ASSERT_OK(static_cast<DBImpl*>(db_->GetRootDB())->TEST_WaitForCompact());
|
ASSERT_OK(static_cast<DBImpl*>(db_->GetRootDB())->TEST_WaitForCompact());
|
||||||
ASSERT_OK(db_->Put(WriteOptions(), "", ""));
|
ASSERT_OK(db_->Put(WriteOptions(), "", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Env* system_env_;
|
||||||
|
std::shared_ptr<Env> env_guard_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FaultInjectionTestSplitted : public FaultInjectionTest {};
|
class FaultInjectionTestSplitted : public FaultInjectionTest {};
|
||||||
@ -552,5 +560,6 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
RegisterCustomObjects(argc, argv);
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
|
@ -308,14 +308,6 @@ TEST_F(ObsoleteFilesTest, BlobFiles) {
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -415,14 +415,6 @@ TEST_F(SstFileReaderTimestampTest, TimestampSizeMismatch) {
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -30,6 +30,10 @@
|
|||||||
#include "test_util/sync_point.h"
|
#include "test_util/sync_point.h"
|
||||||
#include "util/random.h"
|
#include "util/random.h"
|
||||||
|
|
||||||
|
#ifndef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
||||||
|
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace ROCKSDB_NAMESPACE {
|
namespace ROCKSDB_NAMESPACE {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
|
@ -25,6 +25,14 @@
|
|||||||
#include "table/internal_iterator.h"
|
#include "table/internal_iterator.h"
|
||||||
#include "util/mutexlock.h"
|
#include "util/mutexlock.h"
|
||||||
|
|
||||||
|
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
||||||
|
extern "C" {
|
||||||
|
void RegisterCustomObjects(int argc, char** argv);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void RegisterCustomObjects(int argc, char** argv);
|
||||||
|
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
||||||
|
|
||||||
namespace ROCKSDB_NAMESPACE {
|
namespace ROCKSDB_NAMESPACE {
|
||||||
class FileSystem;
|
class FileSystem;
|
||||||
class MemTableRepFactory;
|
class MemTableRepFactory;
|
||||||
|
@ -970,14 +970,6 @@ TEST_F(LdbCmdTest, RenameDbAndLoadOptions) {
|
|||||||
}
|
}
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -397,14 +397,6 @@ TEST_F(SSTDumpToolTest, RawOutput) {
|
|||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
extern "C" {
|
|
||||||
void RegisterCustomObjects(int argc, char** argv);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
||||||
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
Loading…
Reference in New Issue
Block a user