good for merge On Thu, 2010-04-15 at 18:53 +1000, Angus Salkeld wrote: > Signed-off-by: Angus Salkeld <[email protected]> > --- > cts/agents/confdb_test_agent.c | 27 +++++++++++++++++++ > cts/agents/cpg_test_agent.c | 43 +++++++++++++++++------------ > cts/agents/syncv2.c | 2 - > cts/agents/votequorum_test_agent.c | 25 +++++++++++++++++ > cts/corosync.py | 4 +++ > cts/corotests.py | 51 ++++++++++++++++++++++++++++++++++- > 6 files changed, 130 insertions(+), 22 deletions(-) > > diff --git a/cts/agents/confdb_test_agent.c b/cts/agents/confdb_test_agent.c > index f90b1d0..289384d 100644 > --- a/cts/agents/confdb_test_agent.c > +++ b/cts/agents/confdb_test_agent.c > @@ -567,6 +567,31 @@ send_response: > } > > > +static void context_test (int sock) > +{ > + confdb_handle_t handle; > + char response[100]; > + char *cmp; > + int res; > + > + snprintf (response, 100, "%s", OK_STR); > + > + res = confdb_initialize (&handle, &valid_callbacks); > + if (res != CS_OK) { > + syslog (LOG_ERR, "Could not initialize confdb error %d\n", res); > + goto send_response; > + } > + > + confdb_context_set (handle, response); > + confdb_context_get (handle, (const void**)&cmp); > + if (response != cmp) { > + snprintf (response, 100, "%s", FAIL_STR); > + } > + > +send_response: > + send (sock, response, strlen (response) + 1, 0); > + confdb_finalize (handle); > +} > > static void do_command (int sock, char* func, char*args[], int num_args) > { > @@ -583,6 +608,8 @@ static void do_command (int sock, char* func, > char*args[], int num_args) > object_find_test (sock); > } else if (strcmp ("notification_test", func) == 0) { > notification_test (sock); > + } else if (strcmp ("context_test", func) == 0) { > + context_test (sock); > } else if (strcmp ("are_you_ok_dude", func) == 0) { > snprintf (response, 100, "%s", OK_STR); > send (sock, response, strlen (response) + 1, 0); > diff --git a/cts/agents/cpg_test_agent.c b/cts/agents/cpg_test_agent.c > index d7645c2..1f5babc 100644 > --- a/cts/agents/cpg_test_agent.c > +++ b/cts/agents/cpg_test_agent.c > @@ -449,6 +449,23 @@ static void msg_blaster (int sock, char* num_to_send_str) > send_some_more_messages_normal (); > } > > + > +static void context_test (int sock) > +{ > + char response[100]; > + char *cmp; > + > + cpg_context_set (cpg_handle, response); > + cpg_context_get (cpg_handle, &cmp); > + if (response != cmp) { > + snprintf (response, 100, "%s", FAIL_STR); > + } > + else { > + snprintf (response, 100, "%s", OK_STR); > + } > + send (sock, response, strlen (response) + 1, 0); > +} > + > static void msg_blaster_zcb (int sock, char* num_to_send_str) > { > my_msgs_to_send = atoi (num_to_send_str); > @@ -552,36 +569,26 @@ static void do_command (int sock, char* func, > char*args[], int num_args) > cpg_local_get (cpg_handle, &local_nodeid); > snprintf (response, 100, "%u",local_nodeid); > send (sock, response, strlen (response) + 1, 0); > - > - } else if (strcmp ("cpg_finalize",func) == 0) { > + } else if (strcmp ("cpg_finalize", func) == 0) { > > cpg_finalize (cpg_handle); > poll_dispatch_delete (ta_poll_handle_get(), cpg_fd); > cpg_fd = -1; > > - } else if (strcmp ("record_config_events",func) == 0) { > - > + } else if (strcmp ("record_config_events", func) == 0) { > record_config_events (); > - > - } else if (strcmp ("record_messages",func) == 0) { > - > + } else if (strcmp ("record_messages", func) == 0) { > record_messages (); > - > - } else if (strcmp ("read_config_event",func) == 0) { > - > + } else if (strcmp ("read_config_event", func) == 0) { > read_config_event (sock); > - > - } else if (strcmp ("read_messages",func) == 0) { > - > + } else if (strcmp ("read_messages", func) == 0) { > read_messages (sock, args[0]); > - > } else if (strcmp ("msg_blaster_zcb", func) == 0) { > - > msg_blaster_zcb (sock, args[0]); > - > - } else if (strcmp ("msg_blaster",func) == 0) { > - > + } else if (strcmp ("msg_blaster", func) == 0) { > msg_blaster (sock, args[0]); > + } else if (strcmp ("context_test", func) == 0) { > + context_test (sock); > } else if (strcmp ("are_you_ok_dude", func) == 0) { > snprintf (response, 100, "%s", OK_STR); > send (sock, response, strlen (response) + 1, 0); > diff --git a/cts/agents/syncv2.c b/cts/agents/syncv2.c > index e5645a4..68595e9 100644 > --- a/cts/agents/syncv2.c > +++ b/cts/agents/syncv2.c > @@ -274,8 +274,6 @@ static int tst_sv2_sync_process (void) > { > num_sync_processes++; > > - log_printf (LOGSYS_LEVEL_INFO, "sync: process %d", num_sync_processes); > - > if (num_sync_processes > 3) { > return 0; > } else { > diff --git a/cts/agents/votequorum_test_agent.c > b/cts/agents/votequorum_test_agent.c > index 23b90d3..bbfb52e 100644 > --- a/cts/agents/votequorum_test_agent.c > +++ b/cts/agents/votequorum_test_agent.c > @@ -265,6 +265,29 @@ send_response: > send (sock, response, strlen (response), 0); > } > > +static void context_test (int sock) > +{ > + char response[100]; > + char *cmp; > + > + snprintf (response, 100, "%s", OK_STR); > + > + votequorum_context_set (vq_handle, response); > + votequorum_context_get (vq_handle, (void**)&cmp); > + if (response != cmp) { > + snprintf (response, 100, "%s", FAIL_STR); > + syslog (LOG_ERR, "votequorum context not the same"); > + } > + > + quorum_context_set (q_handle, response); > + quorum_context_get (q_handle, (const void**)&cmp); > + if (response != cmp) { > + snprintf (response, 100, "%s", FAIL_STR); > + syslog (LOG_ERR, "quorum context not the same"); > + } > + send (sock, response, strlen (response) + 1, 0); > +} > + > static void do_command (int sock, char* func, char*args[], int num_args) > { > char response[100]; > @@ -282,6 +305,8 @@ static void do_command (int sock, char* func, > char*args[], int num_args) > getquorate (sock); > } else if (strcmp ("init", func) == 0) { > lib_init (sock); > + } else if (strcmp ("context_test", func) == 0) { > + context_test (sock); > } else if (strcmp ("are_you_ok_dude", func) == 0) { > snprintf (response, 100, "%s", OK_STR); > send (sock, response, strlen (response) + 1, 0); > diff --git a/cts/corosync.py b/cts/corosync.py > index b18cf6a..3ba1450 100644 > --- a/cts/corosync.py > +++ b/cts/corosync.py > @@ -566,6 +566,10 @@ class CpgTestAgent(TestAgent): > else: > return msg > > + def context_test(self): > + self.send (["context_test"]) > + return self.read () > + > ################################################################### > class ConfdbTestAgent(TestAgent): > > diff --git a/cts/corotests.py b/cts/corotests.py > index f13829c..c1680e5 100644 > --- a/cts/corotests.py > +++ b/cts/corotests.py > @@ -86,6 +86,19 @@ class CoroTest(CTSTest): > self.CM.apply_default_config() > return CTSTest.teardown(self, node) > > +################################################################### > +class CpgContextTest(CoroTest): > + def __init__(self, cm): > + CoroTest.__init__(self, cm) > + self.name="CpgContextTest" > + > + def __call__(self, node): > + self.incr("calls") > + res = self.CM.cpg_agent[node].context_test() > + if 'OK' in res: > + return self.success() > + else: > + return self.failure('context_test failed') > > ################################################################### > class CpgConfigChangeBase(CoroTest): > @@ -548,6 +561,20 @@ class ConfdbReplaceTest(CoroTest): > else: > return self.failure('set_get_test failed') > > +################################################################### > +class ConfdbContextTest(CoroTest): > + def __init__(self, cm): > + CoroTest.__init__(self, cm) > + self.name="ConfdbContextTest" > + > + def __call__(self, node): > + self.incr("calls") > + res = self.CM.confdb_agent[node].context_test() > + if 'OK' in res: > + return self.success() > + else: > + return self.failure('context_test failed') > + > > ################################################################### > class ConfdbIncrementTest(CoroTest): > @@ -843,12 +870,29 @@ class VoteQuorumGoUp(VoteQuorumBase): > > return self.success() > > +################################################################### > +class VoteQuorumContextTest(CoroTest): > + > + def __init__(self, cm): > + CoroTest.__init__(self, cm) > + self.name="VoteQuorumContextTest" > + self.expected = len(self.CM.Env["nodes"]) > + self.config['quorum/provider'] = 'corosync_votequorum' > + self.config['quorum/expected_votes'] = self.expected > + > + def __call__(self, node): > + self.incr("calls") > + res = self.CM.votequorum_agent[node].context_test() > + if 'OK' in res: > + return self.success() > + else: > + return self.failure('context_test failed') > > > ################################################################### > class GenSimulStart(CoroTest): > -################################################################### > '''Start all the nodes ~ simultaneously''' > + > def __init__(self, cm): > CoroTest.__init__(self,cm) > self.name="GenSimulStart" > @@ -876,8 +920,8 @@ class GenSimulStart(CoroTest): > > ################################################################### > class GenSimulStop(CoroTest): > -################################################################### > '''Stop all the nodes ~ simultaneously''' > + > def __init__(self, cm): > CoroTest.__init__(self,cm) > self.name="GenSimulStop" > @@ -920,6 +964,9 @@ AllTestClasses.append(ConfdbReplaceTest) > AllTestClasses.append(ConfdbIncrementTest) > AllTestClasses.append(ConfdbObjectFindTest) > AllTestClasses.append(ConfdbNotificationTest) > +AllTestClasses.append(ConfdbContextTest) > +AllTestClasses.append(CpgContextTest) > +AllTestClasses.append(VoteQuorumContextTest) > AllTestClasses.append(SamTest1) > AllTestClasses.append(SamTest2) > AllTestClasses.append(SamTest3)
_______________________________________________ Openais mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/openais
