flush
[awesomized/libmemcached] / tests / libmemcached-1.0 / mem_functions.cc
index 321a35dbac19e613ffa21813853ea15895f3efac..090c90d94c097d8b5b27dae37747ec936973afe3 100644 (file)
@@ -35,8 +35,8 @@
  *
  */
 
-#include <mem_config.h>
-#include <libtest/test.hpp>
+#include "mem_config.h"
+#include "libtest/test.hpp"
 
 #if defined(HAVE_LIBUUID) && HAVE_LIBUUID
 # include <uuid/uuid.h>
   Test cases
 */
 
-#include <libmemcached-1.0/memcached.h>
+#include "libmemcached-1.0/memcached.h"
 #include "libmemcached/is.h"
 #include "libmemcached/server_instance.h"
 
-#include <libhashkit-1.0/hashkit.h>
+#include "libhashkit-1.0/hashkit.h"
 
-#include <libtest/memcached.hpp>
+#include "libtest/memcached.hpp"
 
 #include <cerrno>
 #include <memory>
 
 #include <iostream>
 
-#include <libtest/server.h>
+#include "libtest/server.h"
 
-#include "clients/generator.h"
+#include "bin/generator.h"
 
 #define SMALL_STRING_LEN 1024
 
-#include <libtest/test.hpp>
+#include "libtest/test.hpp"
 
 using namespace libtest;
 
-#include <libmemcachedutil-1.0/util.h>
+#include "libmemcachedutil-1.0/util.h"
 
 #include "tests/hash_results.h"
 
@@ -466,7 +466,7 @@ test_return_t libmemcached_string_behavior_test(memcached_st *)
   {
     test_true(libmemcached_string_behavior(memcached_behavior_t(x)));
   }
-  test_compare(37, int(MEMCACHED_BEHAVIOR_MAX));
+  test_compare(38, int(MEMCACHED_BEHAVIOR_MAX));
 
   return TEST_SUCCESS;
 }
@@ -496,7 +496,7 @@ test_return_t memcached_return_t_TEST(memcached_st *memc)
                         4159057246U, 3425930182U, 2593724503U,  1868899624U,
                         1769812374U, 2302537950U, 1110330676U, 3365377466U, 
                         1336171666U, 3021258493U, 2334992265U, 3861994737U, 
-                        3582734124U, 3365377466U };
+                        3582734124U, 3889811103, 3365377466U };
 
   // You have updated the memcache_error messages but not updated docs/tests.
   for (int rc= int(MEMCACHED_SUCCESS); rc < int(MEMCACHED_MAXIMUM_RETURN); ++rc)
@@ -512,7 +512,7 @@ test_return_t memcached_return_t_TEST(memcached_st *memc)
     }
     test_compare(values[rc], hash_val);
   }
-  test_compare(49, int(MEMCACHED_MAXIMUM_RETURN));
+  test_compare(50, int(MEMCACHED_MAXIMUM_RETURN));
 
   return TEST_SUCCESS;
 }
@@ -717,7 +717,7 @@ test_return_t cas_test(memcached_st *memc)
 
   test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0));
 
-  test_skip(true, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, true));
+  test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, true));
 
   test_compare(MEMCACHED_SUCCESS, 
                memcached_set(memc,
@@ -1880,8 +1880,8 @@ test_return_t block_add_regression(memcached_st *memc)
       Error << memcached_last_error_message(memc);
       return TEST_SKIPPED;
     }
-    test_compare(*memc, MEMCACHED_SUCCESS);
-    test_compare(rc, MEMCACHED_SUCCESS);
+    test_compare(MEMCACHED_SUCCESS,*memc);
+    test_compare(MEMCACHED_SUCCESS, rc);
   }
 
   return TEST_SUCCESS;
@@ -4166,7 +4166,7 @@ test_return_t regression_bug_442914(memcached_st *original_memc)
 
   for (uint32_t x= 0; x < 250; ++x)
   {
-    char key[250];
+    char key[251];
     size_t len= (size_t)snprintf(key, sizeof(key), "%0250u", x);
     memcached_return_t rc= memcached_delete(memc, key, len, 0);
     char error_buffer[2048]= { 0 };
@@ -4176,7 +4176,7 @@ test_return_t regression_bug_442914(memcached_st *original_memc)
 
   // Delete, and then delete again to look for not found
   {
-    char key[250];
+    char key[251];
     size_t len= snprintf(key, sizeof(key), "%037u", 251U);
     memcached_return_t rc= memcached_delete(memc, key, len, 0);
     test_true(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED);
@@ -4462,7 +4462,7 @@ test_return_t test_multiple_get_last_disconnect(memcached_st *)
 
 test_return_t test_verbosity(memcached_st *memc)
 {
-  memcached_verbosity(memc, 3);
+  test_compare(MEMCACHED_SUCCESS, memcached_verbosity(memc, 0));
 
   return TEST_SUCCESS;
 }
@@ -4848,7 +4848,7 @@ test_return_t regression_bug_1251482(memcached_st*)
 
   memcached_behavior_set(&memc, MEMCACHED_BEHAVIOR_RETRY_TIMEOUT, 0);
 
-  for (size_t x= 4; x; --x)
+  for (size_t x= 0; x < 5; ++x)
   {
     size_t value_length;
     memcached_return_t rc;
@@ -4858,7 +4858,11 @@ test_return_t regression_bug_1251482(memcached_st*)
 
     test_false(value);
     test_compare(0LLU, value_length);
-    test_compare(MEMCACHED_CONNECTION_FAILURE, rc);
+    if (x) {
+      test_ne_compare(MEMCACHED_SUCCESS, rc);
+    } else {
+      test_compare(MEMCACHED_CONNECTION_FAILURE, rc);
+    }
   }
 
   return TEST_SUCCESS;
@@ -5056,7 +5060,7 @@ test_return_t regression_bug_(memcached_st *memc)
   return TEST_SUCCESS;
 }
 
-test_return_t kill_HUP_TEST(memcached_st *original_memc)
+test_return_t kill_TEST(memcached_st *original_memc)
 {
   memcached_st *memc= create_single_instance_memcached(original_memc, 0);
   test_true(memc);
@@ -5073,14 +5077,17 @@ test_return_t kill_HUP_TEST(memcached_st *original_memc)
                              test_literal_param(__func__), // Keys
                              test_literal_param(__func__), // Values
                              0, 0));
-  test_true_got(kill(pid, SIGHUP) == 0, strerror(errno));
+  test_true_got(kill(pid, SIGTERM) == 0, strerror(errno));
 
   memcached_return_t ret= memcached_set(memc, 
                                         test_literal_param(__func__), // Keys
                                         test_literal_param(__func__), // Values
                                         0, 0);
-  test_compare(ret, memc);
-  test_compare(MEMCACHED_CONNECTION_FAILURE, memc);
+  if (ret == MEMCACHED_ERRNO) {
+    test_compare(EPIPE, memcached_last_error_errno(memc));
+  } else {
+    test_compare(MEMCACHED_CONNECTION_FAILURE, ret);
+  }
 
   memcached_free(memc);