Add in a test to do memcached_set() after a kill has been issued.
authorBrian Aker <brian@tangent.org>
Tue, 14 Feb 2012 23:27:33 +0000 (15:27 -0800)
committerBrian Aker <brian@tangent.org>
Tue, 14 Feb 2012 23:27:33 +0000 (15:27 -0800)
tests/libmemcached-1.0/all_tests.h
tests/libmemcached-1.0/mem_functions.cc
tests/libmemcached-1.0/mem_functions.h

index a0103968e5db5e8b3a104d4154a9ab3f8e3c1603..c9134a519c9c3769765e50a03f488ab3644d34fd 100644 (file)
@@ -122,6 +122,11 @@ test_st touch_tests[] ={
   {0, 0, 0}
 };
 
+test_st kill_TESTS[] ={
+  {"kill(HUP)", 0, (test_callback_fn*)kill_HUP_TEST},
+  {0, 0, 0}
+};
+
 test_st memcached_stat_tests[] ={
   {"memcached_stat() INVALID ARG", 0, (test_callback_fn*)memcached_stat_TEST},
   {"memcached_stat()", 0, (test_callback_fn*)memcached_stat_TEST2},
@@ -467,5 +472,6 @@ collection_st collection[] ={
   {"touch", 0, 0, touch_tests},
   {"touch", (test_callback_fn*)pre_binary, 0, touch_tests},
   {"memcached_stat()", 0, 0, memcached_stat_tests},
+  {"kill()", 0, 0, kill_TESTS},
   {0, 0, 0, 0}
 };
index aae725bf11390653a571aea7d42bc19d394799b5..b3f6fbe0718bf3fea1a5924d5085c20f0676a51f 100644 (file)
@@ -4955,3 +4955,31 @@ test_return_t regression_bug_(memcached_st *memc)
 
   return TEST_SUCCESS;
 }
+
+test_return_t kill_HUP_TEST(memcached_st *original_memc)
+{
+  memcached_st *memc= create_single_instance_memcached(original_memc, 0);
+  test_true(memc);
+
+  memcached_server_instance_st instance= memcached_server_instance_by_position(memc, 0);
+
+  pid_t pid;
+  test_true((pid= libmemcached_util_getpid(memcached_server_name(instance),
+                                           memcached_server_port(instance), NULL)) > -1);
+
+
+  test_compare(MEMCACHED_SUCCESS,
+               memcached_set(memc, 
+                             test_literal_param(__func__), // Keys
+                             test_literal_param(__func__), // Values
+                             0, 0));
+  test_true_got(kill(pid, SIGHUP) == 0, strerror(errno));
+
+  test_compare(MEMCACHED_SUCCESS,
+               memcached_set(memc, 
+                             test_literal_param(__func__), // Keys
+                             test_literal_param(__func__), // Values
+                             0, 0));
+
+  return TEST_SUCCESS;
+}
index a843374329ca565df4de183ef751513271ab597e..7126f7fcb4b4ed9d36286ffa46d2b4fa7ec33480 100644 (file)
@@ -178,3 +178,4 @@ test_return_t util_version_test(memcached_st *memc);
 test_return_t version_string_test(memcached_st *);
 test_return_t wrong_failure_counter_test(memcached_st *memc);
 test_return_t wrong_failure_counter_two_test(memcached_st *memc);
+test_return_t kill_HUP_TEST(memcached_st *memc);