Extending test cases (Hsieh has benchmarks now run by default)
author <brian@gir.local> <>
Sun, 2 Dec 2007 00:30:41 +0000 (16:30 -0800)
committer <brian@gir.local> <>
Sun, 2 Dec 2007 00:30:41 +0000 (16:30 -0800)
tests/function.c
tests/test.c

index fe4b2d8686db645486393f659398266d35662f32..2450b0dd7f7cdc7f5f31170b6688ddd7db92e91f 100644 (file)
@@ -1672,7 +1672,16 @@ memcached_return pre_hash_ketama(memcached_st *memc)
 memcached_return enable_consistent(memcached_st *memc)
 {
   memcached_server_distribution value= MEMCACHED_DISTRIBUTION_CONSISTENT;
+  memcached_hash hash;
   memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, &value);
+  pre_hsieh(memc);
+
+  value= (memcached_server_distribution)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION);
+  assert(value == MEMCACHED_DISTRIBUTION_CONSISTENT);
+
+  hash= (memcached_hash)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_HASH);
+  assert(hash == MEMCACHED_HASH_HSIEH);
+
 
   return MEMCACHED_SUCCESS;
 }
@@ -1866,6 +1875,8 @@ collection_st collection[] ={
   {"user", 0, 0, user_tests},
   {"generate", 0, 0, generate_tests},
   {"generate_hsieh", pre_hsieh, 0, generate_tests},
+  {"generate_hsieh_consistent", enable_consistent, 0, generate_tests},
+  {"generate_md5", pre_md5, 0, generate_tests},
   {"generate_nonblock", pre_nonblock, 0, generate_tests},
   {0, 0, 0, 0}
 };
index 765149ecb66c7279c155cd7709919648ed132f36..990f15e7483afc02e4dc2d22f79404aa4274ce20 100644 (file)
@@ -10,6 +10,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <time.h>
+#include <fnmatch.h>
 
 #include "test.h"
 
@@ -119,7 +120,7 @@ int main(int argc, char *argv[])
     test_st *run;
 
     run= next->tests;
-    if (collection_to_run && strcmp(collection_to_run, next->name))
+    if (collection_to_run && fnmatch(collection_to_run, next->name, FNM_CASEFOLD))
       continue;
 
     fprintf(stderr, "\n%s\n\n", next->name);
@@ -131,7 +132,7 @@ int main(int argc, char *argv[])
       memcached_return rc;
       struct timeval start_time, end_time;
 
-      if (wildcard && strcmp(wildcard, run->name))
+      if (wildcard && fnmatch(wildcard, run->name, FNM_CASEFOLD))
         continue;
 
       fprintf(stderr, "Testing %s", run->name);