Merge code fix for replication non-block test failing instead of skipping on
[awesomized/libmemcached] / tests / function.c
index a580f396d1820e06ea532fa7689b130d423448d3..fadd41cd91de481c92db54ecd047d543d8e2cb89 100644 (file)
@@ -1845,6 +1845,7 @@ static test_return_t  behavior_test(memcached_st *memc)
   value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS);
   memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, value + 1);
   test_truth((value + 1) == memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS));
+
   return TEST_SUCCESS;
 }
 
@@ -3520,6 +3521,7 @@ static test_return_t pre_binary(memcached_st *memc)
   return rc == MEMCACHED_SUCCESS ? TEST_SUCCESS : TEST_SKIPPED;
 }
 
+
 static test_return_t pre_replication(memcached_st *memc)
 {
   test_return_t test_rc;
@@ -3541,16 +3543,21 @@ static test_return_t pre_replication(memcached_st *memc)
   return rc == MEMCACHED_SUCCESS ? TEST_SUCCESS : TEST_SKIPPED;
 }
 
+
 static test_return_t pre_replication_noblock(memcached_st *memc)
 {
-  test_return_t rc= MEMCACHED_FAILURE;
-  if (pre_replication(memc) == TEST_SUCCESS &&
-      pre_nonblock(memc) == TEST_SUCCESS)
-    rc= TEST_SUCCESS;
+  test_return_t rc;
+
+  rc= pre_replication(memc);
+  if (rc != TEST_SUCCESS)
+    return rc;
+
+  rc= pre_nonblock(memc);
 
   return rc;
 }
 
+
 static void my_free(memcached_st *ptr __attribute__((unused)), void *mem)
 {
 #ifdef HARD_MALLOC_TESTS
@@ -3561,6 +3568,7 @@ static void my_free(memcached_st *ptr __attribute__((unused)), void *mem)
 #endif
 }
 
+
 static void *my_malloc(memcached_st *ptr __attribute__((unused)), const size_t size)
 {
 #ifdef HARD_MALLOC_TESTS
@@ -3581,6 +3589,7 @@ static void *my_malloc(memcached_st *ptr __attribute__((unused)), const size_t s
   return ret;
 }
 
+
 static void *my_realloc(memcached_st *ptr __attribute__((unused)), void *mem, const size_t size)
 {
 #ifdef HARD_MALLOC_TESTS
@@ -3599,6 +3608,7 @@ static void *my_realloc(memcached_st *ptr __attribute__((unused)), void *mem, co
 #endif
 }
 
+
 static void *my_calloc(memcached_st *ptr __attribute__((unused)), size_t nelem, const size_t size)
 {
 #ifdef HARD_MALLOC_TESTS
@@ -3614,6 +3624,7 @@ static void *my_calloc(memcached_st *ptr __attribute__((unused)), size_t nelem,
 #endif
 }
 
+
 static test_return_t set_prefix(memcached_st *memc)
 {
   memcached_return_t rc;
@@ -3683,6 +3694,7 @@ static test_return_t set_prefix(memcached_st *memc)
   return TEST_SUCCESS;
 }
 
+
 #ifdef MEMCACHED_ENABLE_DEPRECATED
 static test_return_t deprecated_set_memory_alloc(memcached_st *memc)
 {
@@ -3731,6 +3743,7 @@ static test_return_t deprecated_set_memory_alloc(memcached_st *memc)
 }
 #endif
 
+
 static test_return_t set_memory_alloc(memcached_st *memc)
 {
   memcached_return_t rc;
@@ -5520,7 +5533,6 @@ test_st tests[] ={
   {"clone_test", 0, (test_callback_fn)clone_test },
   {"connection_test", 0, (test_callback_fn)connection_test},
   {"callback_test", 0, (test_callback_fn)callback_test},
-  {"behavior_test", 0, (test_callback_fn)behavior_test},
   {"userdata_test", 0, (test_callback_fn)userdata_test},
   {"error", 0, (test_callback_fn)error_test },
   {"set", 0, (test_callback_fn)set_test },
@@ -5555,8 +5567,6 @@ test_st tests[] ={
   {"add_host_test", 0, (test_callback_fn)add_host_test },
   {"add_host_test_1", 0, (test_callback_fn)add_host_test1 },
   {"get_stats_keys", 0, (test_callback_fn)get_stats_keys },
-  {"behavior_test", 0, (test_callback_fn)get_stats_keys },
-  {"callback_test", 0, (test_callback_fn)get_stats_keys },
   {"version_string_test", 0, (test_callback_fn)version_string_test},
   {"bad_key", 1, (test_callback_fn)bad_key_test },
   {"memcached_server_cursor", 1, (test_callback_fn)memcached_server_cursor_test },
@@ -5571,6 +5581,11 @@ test_st tests[] ={
   {0, 0, 0}
 };
 
+test_st behavior_tests[] ={
+  {"behavior_test", 0, (test_callback_fn)behavior_test},
+  {0, 0, 0}
+};
+
 test_st async_tests[] ={
   {"add", 1, (test_callback_fn)add_wrapper },
   {0, 0, 0}
@@ -5790,6 +5805,7 @@ collection_st collection[] ={
   {"replication", (test_callback_fn)pre_replication, 0, replication_tests},
   {"replication_noblock", (test_callback_fn)pre_replication_noblock, 0, replication_tests},
   {"regression", 0, 0, regression_tests},
+  {"behaviors", 0, 0, behavior_tests},
   {0, 0, 0, 0}
 };