summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-08-02 11:54:53 -0700
committerSage Weil <sage@inktank.com>2013-08-02 11:54:53 -0700
commit9797986697622217cb03b3420a70a49eddb6b02d (patch)
treeb0e96a13827ff6bd825dbbc45546707cf408c28f /src/test
parentea1243a1122bd48c9f514b92f6c5d83391e814e5 (diff)
parentef036bd4bc0e79bff8a5805800fbdeb0cc2db6ae (diff)
downloadceph-9797986697622217cb03b3420a70a49eddb6b02d.tar.gz
Merge remote-tracking branch 'gh/next'
Diffstat (limited to 'src/test')
-rw-r--r--src/test/admin_socket.cc40
-rw-r--r--src/test/system/systest_runnable.cc4
2 files changed, 31 insertions, 13 deletions
diff --git a/src/test/admin_socket.cc b/src/test/admin_socket.cc
index 8f67918e644..6f2a215b565 100644
--- a/src/test/admin_socket.cc
+++ b/src/test/admin_socket.cc
@@ -70,10 +70,19 @@ TEST(AdminSocket, SendNoOp) {
}
class MyTest : public AdminSocketHook {
- bool call(std::string command, std::string args, std::string format, bufferlist& result) {
+ bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) {
+ std::vector<std::string> args;
+ cmd_getval(g_ceph_context, cmdmap, "args", args);
result.append(command);
result.append("|");
- result.append(args);
+ string resultstr;
+ for (std::vector<std::string>::iterator it = args.begin();
+ it != args.end(); ++it) {
+ if (it != args.begin())
+ resultstr += ' ';
+ resultstr += *it;
+ }
+ result.append(resultstr);
return true;
}
};
@@ -93,10 +102,19 @@ TEST(AdminSocket, RegisterCommand) {
}
class MyTest2 : public AdminSocketHook {
- bool call(std::string command, std::string args, std::string format, bufferlist& result) {
+ bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) {
+ std::vector<std::string> args;
+ cmd_getval(g_ceph_context, cmdmap, "args", args);
result.append(command);
result.append("|");
- result.append(args);
+ string resultstr;
+ for (std::vector<std::string>::iterator it = args.begin();
+ it != args.end(); ++it) {
+ if (it != args.begin())
+ resultstr += ' ';
+ resultstr += *it;
+ }
+ result.append(resultstr);
return true;
}
};
@@ -108,23 +126,23 @@ TEST(AdminSocket, RegisterCommandPrefixes) {
ASSERT_EQ(true, asoct.shutdown());
ASSERT_EQ(true, asoct.init(get_rand_socket_path()));
AdminSocketClient client(get_rand_socket_path());
- ASSERT_EQ(0, asoct.m_asokc->register_command("test", "test", new MyTest(), ""));
- ASSERT_EQ(0, asoct.m_asokc->register_command("test command", "test command", new MyTest2(), ""));
+ ASSERT_EQ(0, asoct.m_asokc->register_command("test", "test name=args,type=CephString,n=N", new MyTest(), ""));
+ ASSERT_EQ(0, asoct.m_asokc->register_command("test command", "test command name=args,type=CephString,n=N", new MyTest2(), ""));
string result;
ASSERT_EQ("", client.do_request("{\"prefix\":\"test\"}", &result));
ASSERT_EQ("test|", result);
ASSERT_EQ("", client.do_request("{\"prefix\":\"test command\"}", &result));
ASSERT_EQ("test command|", result);
- ASSERT_EQ("", client.do_request("{\"prefix\":\"test command post\"}", &result));
+ ASSERT_EQ("", client.do_request("{\"prefix\":\"test command\",\"args\":[\"post\"]}", &result));
ASSERT_EQ("test command|post", result);
- ASSERT_EQ("", client.do_request("{\"prefix\":\"test command post\"}", &result));
+ ASSERT_EQ("", client.do_request("{\"prefix\":\"test command\",\"args\":[\" post\"]}", &result));
ASSERT_EQ("test command| post", result);
- ASSERT_EQ("", client.do_request("{\"prefix\":\"test this thing\"}", &result));
+ ASSERT_EQ("", client.do_request("{\"prefix\":\"test\",\"args\":[\"this thing\"]}", &result));
ASSERT_EQ("test|this thing", result);
- ASSERT_EQ("", client.do_request("{\"prefix\":\"test command post\"}", &result));
+ ASSERT_EQ("", client.do_request("{\"prefix\":\"test\",\"args\":[\" command post\"]}", &result));
ASSERT_EQ("test| command post", result);
- ASSERT_EQ("", client.do_request("{\"prefix\":\"test this thing\"}", &result));
+ ASSERT_EQ("", client.do_request("{\"prefix\":\"test\",\"args\":[\" this thing\"]}", &result));
ASSERT_EQ("test| this thing", result);
ASSERT_EQ(true, asoct.shutdown());
}
diff --git a/src/test/system/systest_runnable.cc b/src/test/system/systest_runnable.cc
index c0bc977618f..ec9b823db14 100644
--- a/src/test/system/systest_runnable.cc
+++ b/src/test/system/systest_runnable.cc
@@ -229,9 +229,9 @@ set_argv(int argc, const char **argv)
if (m_argv_orig != NULL) {
for (int i = 0; i < m_argc; ++i)
free((void*)(m_argv_orig[i]));
- delete m_argv_orig;
+ delete[] m_argv_orig;
m_argv_orig = NULL;
- delete m_argv;
+ delete[] m_argv;
m_argv = NULL;
m_argc = 0;
}