#include "common/Thread.h"
#include "erasure-code/ErasureCodePlugin.h"
#include "global/global_context.h"
-#include "common/config.h"
+#include "common/config_proxy.h"
#include "gtest/gtest.h"
ErasureCodeInterfaceRef erasure_code;
pthread_cleanup_push(cleanup, NULL);
instance.factory("hangs",
- g_conf->get_val<std::string>("erasure_code_dir"),
+ g_conf().get_val<std::string>("erasure_code_dir"),
profile, &erasure_code, &cerr);
pthread_cleanup_pop(0);
return NULL;
TEST_F(ErasureCodePluginRegistryTest, all)
{
ErasureCodeProfile profile;
- const char* env = getenv("CEPH_LIB");
- string directory(env ? env : ".libs");
+ string directory = g_conf().get_val<std::string>("erasure_code_dir");
ErasureCodeInterfaceRef erasure_code;
ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
EXPECT_FALSE(erasure_code);
EXPECT_EQ(-EIO, instance.factory("invalid",
- g_conf->get_val<std::string>("erasure_code_dir"),
+ g_conf().get_val<std::string>("erasure_code_dir"),
profile, &erasure_code, &cerr));
EXPECT_FALSE(erasure_code);
EXPECT_EQ(-EXDEV, instance.factory("missing_version",
- g_conf->get_val<std::string>("erasure_code_dir"),
+ g_conf().get_val<std::string>("erasure_code_dir"),
profile,
&erasure_code, &cerr));
EXPECT_FALSE(erasure_code);
EXPECT_EQ(-ENOENT, instance.factory("missing_entry_point",
- g_conf->get_val<std::string>("erasure_code_dir"),
+ g_conf().get_val<std::string>("erasure_code_dir"),
profile,
&erasure_code, &cerr));
EXPECT_FALSE(erasure_code);
EXPECT_EQ(-ESRCH, instance.factory("fail_to_initialize",
- g_conf->get_val<std::string>("erasure_code_dir"),
+ g_conf().get_val<std::string>("erasure_code_dir"),
profile,
&erasure_code, &cerr));
EXPECT_FALSE(erasure_code);
EXPECT_EQ(-EBADF, instance.factory("fail_to_register",
- g_conf->get_val<std::string>("erasure_code_dir"),
+ g_conf().get_val<std::string>("erasure_code_dir"),
profile,
&erasure_code, &cerr));
EXPECT_FALSE(erasure_code);
EXPECT_EQ(0, instance.factory("example",
- g_conf->get_val<std::string>("erasure_code_dir"),
+ g_conf().get_val<std::string>("erasure_code_dir"),
profile, &erasure_code, &cerr));
EXPECT_TRUE(erasure_code.get());
ErasureCodePlugin *plugin = 0;
/*
* Local Variables:
- * compile-command: "cd ../.. ; make -j4 &&
+ * compile-command: "cd ../../../build ; make -j4 &&
* make unittest_erasure_code_plugin &&
* valgrind --tool=memcheck \
- * ./unittest_erasure_code_plugin \
+ * ./bin/unittest_erasure_code_plugin \
* --gtest_filter=*.* --log-to-stderr=true --debug-osd=20"
* End:
*/