Update tests for testplus.
authorBrian Aker <brian@gaz>
Thu, 14 Jan 2010 19:51:32 +0000 (11:51 -0800)
committerBrian Aker <brian@gaz>
Thu, 14 Jan 2010 19:51:32 +0000 (11:51 -0800)
tests/atomsmasher.c
tests/include.am
tests/libmemcached_world.h
tests/plus.cpp

index 3d58960e9b4feb838fbc22534e19f95a91759950..490a3f92f202ffc8d8317efee6253b8cd15dd80b 100644 (file)
@@ -14,7 +14,6 @@
 */
 #include "libmemcached/common.h"
 
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -90,9 +89,13 @@ infinite:
       return_value= memcached_get(memc, global_keys[test_bit], global_keys_length[test_bit],
                                   &return_value_length, &flags, &rc);
       if (rc == MEMCACHED_SUCCESS && return_value)
+      {
         free(return_value);
+      }
       else if (rc == MEMCACHED_NOTFOUND)
+      {
         continue;
+      }
       else
       {
         WATCHPOINT_ERROR(rc);
@@ -117,45 +120,14 @@ infinite:
   if (getenv("MEMCACHED_ATOM_BURIN_IN"))
     goto infinite;
 
-  return 0;
+  return TEST_SUCCESS;
 }
 
-static memcached_return_t pre_nonblock(memcached_st *memc)
+static test_return_t pre_nonblock(memcached_st *memc)
 {
   memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0);
 
-  return MEMCACHED_SUCCESS;
-}
-
-static memcached_return_t pre_md5(memcached_st *memc)
-{
-  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_MD5);
-
-  return MEMCACHED_SUCCESS;
-}
-
-static memcached_return_t pre_hsieh(memcached_st *memc)
-{
-  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_HSIEH);
-
-  return MEMCACHED_SUCCESS;
-}
-
-static memcached_return_t enable_consistent(memcached_st *memc)
-{
-  memcached_server_distribution_t value= MEMCACHED_DISTRIBUTION_CONSISTENT;
-  memcached_hash_t hash;
-  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, value);
-  pre_hsieh(memc);
-
-  value= (memcached_server_distribution_t)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION);
-  assert(value == MEMCACHED_DISTRIBUTION_CONSISTENT);
-
-  hash= (memcached_hash_t)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_HASH);
-  assert(hash == MEMCACHED_HASH_HSIEH);
-
-
-  return MEMCACHED_SUCCESS;
+  return TEST_SUCCESS;
 }
 
 /* 
@@ -217,9 +189,6 @@ test_st smash_tests[] ={
 
 collection_st collection[] ={
   {"smash", 0, 0, smash_tests},
-  {"smash_hsieh", (test_callback_fn)pre_hsieh, 0, smash_tests},
-  {"smash_hsieh_consistent", (test_callback_fn)enable_consistent, 0, smash_tests},
-  {"smash_md5", (test_callback_fn)pre_md5, 0, smash_tests},
   {"smash_nonblock", (test_callback_fn)pre_nonblock, 0, smash_tests},
   {0, 0, 0, 0}
 };
index ab48b42f124d8ef4740f7167b135e80363ec9169..1c54c1f568e0661f11dea73ade637b2f5138d87d 100644 (file)
@@ -118,6 +118,8 @@ MEMSLAP_COMMAND= clients/memslap $(COLLECTION) $(SUITE)
 
 MEM_COMMAND= tests/testapp $(COLLECTION) $(SUITE)
 
+PLUS_COMMAND= tests/testplus $(COLLECTION) $(SUITE)
+
 ATOM_COMMAND= tests/atomsmasher $(COLLECTION) $(SUITE)
 
 HASH_COMMAND= tests/testhashkit $(COLLECTION) $(SUITE)
@@ -128,6 +130,9 @@ test-mem: tests/testapp
 test-atom: tests/atomsmasher
        $(ATOM_COMMAND)
 
+test-plus: tests/testplus
+       $(PLUS_COMMAND)
+
 test-hash: tests/testhashkit
        $(HASH_COMMAND)
 
@@ -137,6 +142,9 @@ gdb-mem: tests/testapp
 gdb-atom: tests/atomsmasher
        $(DEBUG_COMMAND)  $(ATOM_COMMAND)
 
+gdb-plus: tests/testplus
+       $(DEBUG_COMMAND)  $(PLUS_COMMAND)
+
 gdb-hash: tests/testhashkit
        $(DEBUG_COMMAND) $(HASH_COMMAND)
 
@@ -149,6 +157,9 @@ valgrind-mem: tests/testapp
 valgrind-atom: tests/atomsmasher
        $(VALGRIND_COMMAND)  $(ATOM_COMMAND)
 
+valgrind-plus: tests/testplus
+       $(VALGRIND_COMMAND)  $(PLUS_COMMAND)
+
 valgrind-hash: tests/testhashkit
        $(VALGRIND_COMMAND) $(HASH_COMMAND)
 
index d51d3ad7bc0e6439c6e775e6994cb9f07b0b1e29..aab09ea3e5ed0cfcfd6d27503bc3ecfb5b3bcf16 100644 (file)
@@ -111,7 +111,7 @@ test_return_t world_pre_run(libmemcached_test_container_st *container)
 
 test_return_t world_post_run(libmemcached_test_container_st *container)
 {
-  assert(container->memc);
+  test_truth(container->memc);
 
   return TEST_SUCCESS;
 }
index 7a37ee17faeceb0d26623d975de3b14f7a4b28ec..f9cbdd5e748b8b72afea8a81522df9b7ce899c83 100644 (file)
@@ -309,5 +309,8 @@ void get_world(world_st *world)
   world->test.post_run= reinterpret_cast<test_callback_fn>(world_post_run);
   world->test.on_error= reinterpret_cast<test_callback_error_fn>(world_on_error);
 
+  world->collection.startup= reinterpret_cast<test_callback_fn>(world_container_startup);
+  world->collection.shutdown= reinterpret_cast<test_callback_fn>(world_container_shutdown);
+
   world->runner= &defualt_libmemcached_runner;
 }