Use Env::LoadEnv to create custom Env objects (#6196)
Summary: As title. Previous assumption was that the underlying lib can always return a shared_ptr<Env>. This is too strong. Therefore, we use Env::LoadEnv to relax it. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6196 Test Plan: make check Differential Revision: D19133199 Pulled By: riversand963 fbshipit-source-id: c83a0c02a42610d077054f2de1acfc45126b3a75
This commit is contained in:
parent
68d5d82d1f
commit
7678cf2df7
@ -67,9 +67,9 @@ class ColumnFamilyTestBase : public testing::Test {
|
|||||||
#ifndef ROCKSDB_LITE
|
#ifndef ROCKSDB_LITE
|
||||||
const char* test_env_uri = getenv("TEST_ENV_URI");
|
const char* test_env_uri = getenv("TEST_ENV_URI");
|
||||||
if (test_env_uri) {
|
if (test_env_uri) {
|
||||||
Status s = ObjectRegistry::NewInstance()->NewSharedObject(test_env_uri,
|
Env* test_env = nullptr;
|
||||||
&env_guard_);
|
Status s = Env::LoadEnv(test_env_uri, &test_env, &env_guard_);
|
||||||
base_env = env_guard_.get();
|
base_env = test_env;
|
||||||
EXPECT_OK(s);
|
EXPECT_OK(s);
|
||||||
EXPECT_NE(Env::Default(), base_env);
|
EXPECT_NE(Env::Default(), base_env);
|
||||||
}
|
}
|
||||||
|
@ -53,9 +53,9 @@ DBTestBase::DBTestBase(const std::string path)
|
|||||||
#ifndef ROCKSDB_LITE
|
#ifndef ROCKSDB_LITE
|
||||||
const char* test_env_uri = getenv("TEST_ENV_URI");
|
const char* test_env_uri = getenv("TEST_ENV_URI");
|
||||||
if (test_env_uri) {
|
if (test_env_uri) {
|
||||||
Status s = ObjectRegistry::NewInstance()->NewSharedObject(test_env_uri,
|
Env* test_env = nullptr;
|
||||||
&env_guard_);
|
Status s = Env::LoadEnv(test_env_uri, &test_env, &env_guard_);
|
||||||
base_env = env_guard_.get();
|
base_env = test_env;
|
||||||
EXPECT_OK(s);
|
EXPECT_OK(s);
|
||||||
EXPECT_NE(Env::Default(), base_env);
|
EXPECT_NE(Env::Default(), base_env);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user