summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoao Eduardo Luis <joao.luis@inktank.com>2013-06-17 14:43:36 +0100
committerSage Weil <sage@inktank.com>2013-07-24 09:12:49 -0700
commit5b0967f03efb1be210b52f24f095f023fe1bc539 (patch)
tree524fcbf24f88d64a9b9c24e749c554f7f4e3015c
parent115468c73f121653eec2efc030d5ba998d834e43 (diff)
downloadceph-5b0967f03efb1be210b52f24f095f023fe1bc539.tar.gz
test: test_store_tool: global init before using LevelDBStore
Fixes a segfault Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com> (cherry picked from commit a7a7d3fc8a2ba4a30ef136a32f2903d157b3e19a)
-rw-r--r--src/test/ObjectMap/test_store_tool/test_store_tool.cc26
1 files changed, 22 insertions, 4 deletions
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 4ab62892880..ace91220df6 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<const char*> 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);