Better reporting on errors from mget.
[awesomized/libmemcached] / tests / mem_functions.c
index 740e34de1fbd98e57d0648bf9b74bb566b8dd12f..a38c49c4be678a0cd1bb556ff74333b3f382a2bb 100644 (file)
@@ -1031,7 +1031,7 @@ static test_return_t set_test3(memcached_st *memc)
   {
     char key[16];
 
-    sprintf(key, "foo%u", x);
+    snprintf(key, sizeof(key), "foo%u", x);
 
     rc= memcached_set(memc, key, strlen(key),
                       value, value_length,
@@ -3162,7 +3162,7 @@ static test_return_t output_ketama_weighted_keys(memcached_st *trash)
   for (int x= 0; x < 10000; x++)
   {
     char key[10];
-    sprintf(key, "%d", x);
+    snprintf(key, sizeof(key), "%d", x);
 
     uint32_t server_idx = memcached_generate_hash(memc, key, strlen(key));
     char *hostname = memc->hosts[server_idx].hostname;
@@ -3361,7 +3361,9 @@ static test_return_t generate_large_pairs(memcached_st *memc __attribute__((unus
 
 static test_return_t generate_data(memcached_st *memc)
 {
-  execute_set(memc, global_pairs, global_count);
+  unsigned int check_execute= execute_set(memc, global_pairs, global_count);
+
+  test_true(check_execute == global_count);
 
   return TEST_SUCCESS;
 }
@@ -3371,7 +3373,9 @@ static test_return_t generate_data_with_stats(memcached_st *memc)
   memcached_stat_st *stat_p;
   memcached_return_t rc;
   uint32_t host_index= 0;
-  execute_set(memc, global_pairs, global_count);
+  unsigned int check_execute= execute_set(memc, global_pairs, global_count);
+
+  test_true(check_execute == global_count);
 
   //TODO: hosts used size stats
   stat_p= memcached_stat(memc, NULL, &rc);
@@ -3622,7 +3626,7 @@ static test_return_t pre_nonblock_binary(memcached_st *memc)
   // will not toggle protocol on an connection.
   memcached_version(memc_clone);
 
-  if (libmemcached_util_version_check(memc_clone, 1, 3, 0))
+  if (libmemcached_util_version_check(memc_clone, 1, 4, 4))
   {
     memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0);
     rc = memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1);
@@ -3748,7 +3752,7 @@ static test_return_t pre_binary(memcached_st *memc)
 {
   memcached_return_t rc= MEMCACHED_FAILURE;
 
-  if (libmemcached_util_version_check(memc, 1, 3, 0))
+  if (libmemcached_util_version_check(memc, 1, 4, 4))
   {
     rc = memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1);
     test_true(rc == MEMCACHED_SUCCESS);
@@ -5983,7 +5987,7 @@ static test_return_t regression_bug_583031(memcached_st *unused)
 
     (void)memcached_get(memc, "dsf", 3, &length, &flags, &rc);
 
-    test_true(rc == MEMCACHED_TIMEOUT);
+    test_true_got(rc == MEMCACHED_TIMEOUT, memcached_strerror(NULL, rc));
 
     memcached_free(memc);