From: Joao Eduardo Luis Date: Tue, 1 Oct 2013 13:28:58 +0000 (+0100) Subject: test: test_store_tool: add 'crc ' command X-Git-Tag: mark-v0.70-wip~3^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=18fcd91319be2be11e643eb40c5bd0beee21cf51;p=ceph.git test: test_store_tool: add 'crc ' command Returns the CRC of contents for a given key with a given prefix. Signed-off-by: Joao Eduardo Luis --- 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 f81598ccfb8d..66d55bee5871 100644 --- a/src/test/ObjectMap/test_store_tool/test_store_tool.cc +++ b/src/test/ObjectMap/test_store_tool/test_store_tool.cc @@ -111,7 +111,7 @@ void usage(const char *pname) << " list [prefix]\n" << " exists [key]\n" << " get \n" - << " verify \n" + << " crc \n" << " get-size\n" << std::endl; } @@ -183,8 +183,23 @@ int main(int argc, const char *argv[]) bl.hexdump(os); std::cout << os.str() << std::endl; - } else if (cmd == "verify") { - assert(0); + } else if (cmd == "crc") { + if (argc < 5) { + usage(argv[0]); + return 1; + } + string prefix(argv[3]); + string key(argv[4]); + + bool exists = false; + bufferlist bl = st.get(prefix, key, exists); + std::cout << "(" << prefix << ", " << key << ") "; + if (!exists) { + std::cout << " does not exist" << std::endl; + return 1; + } + std::cout << " crc " << bl.crc32c(0) << std::endl; + } else if (cmd == "get-size") { std::cout << "estimated store size: " << st.get_size() << std::endl; } else {