From: Joao Eduardo Luis Date: Mon, 17 Jun 2013 13:43:36 +0000 (+0100) Subject: test: test_store_tool: global init before using LevelDBStore X-Git-Tag: v0.61.7~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5b0967f03efb1be210b52f24f095f023fe1bc539;p=ceph.git test: test_store_tool: global init before using LevelDBStore Fixes a segfault Signed-off-by: Joao Eduardo Luis Reviewed-by: Sage Weil (cherry picked from commit a7a7d3fc8a2ba4a30ef136a32f2903d157b3e19a) --- diff --git a/src/test/ObjectMap/test_store_tool/test_store_tool.cc b/src/test/ObjectMap/test_store_tool/test_store_tool.cc index 4ab628928804..ace91220df66 100644 --- a/src/test/ObjectMap/test_store_tool/test_store_tool.cc +++ b/src/test/ObjectMap/test_store_tool/test_store_tool.cc @@ -19,6 +19,12 @@ #include "os/LevelDBStore.h" +#include "common/ceph_argparse.h" +#include "global/global_init.h" +#include "common/errno.h" +#include "common/safe_io.h" +#include "common/config.h" + using namespace std; class StoreTool @@ -98,15 +104,27 @@ void usage(const char *pname) << std::endl; } -int main(int argc, char *argv[]) +int main(int argc, const char *argv[]) { - if (argc < 3) { + vector args; + argv_to_vec(argc, argv, args); + env_to_vec(args); + + global_init( + NULL, args, + CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + common_init_finish(g_ceph_context); + + + if (args.size() < 2) { usage(argv[0]); return 1; } - string path(argv[1]); - string cmd(argv[2]); + string path(args[0]); + string cmd(args[1]); + + std::cout << "path: " << path << " cmd " << cmd << std::endl; StoreTool st(path);