+ fprintf(stderr, "\nNonblock tests\n\n");
+ for (x= 0; tests[x].function_name; x++)
+ {
+ if (wildcard)
+ if (strcmp(wildcard, tests[x].function_name))
+ continue;
+
+ memcached_st *memc;
+ memcached_return rc;
+ struct timeval start_time, end_time;
+
+ memc= memcached_create(NULL);
+ assert(memc);
+
+ rc= memcached_server_push(memc, servers);
+ assert(rc == MEMCACHED_SUCCESS);
+
+ fprintf(stderr, "Testing %s", tests[x].function_name);
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, NULL);
+ gettimeofday(&start_time, NULL);
+ tests[x].function(memc);
+ gettimeofday(&end_time, NULL);
+ long int load_time= timedif(end_time, start_time);
+ fprintf(stderr, "\t\t\t\t\t %ld.%03ld [ ok ]\n", load_time / 1000,
+ load_time % 1000);
+ assert(memc);
+ memcached_free(memc);
+ }
+ }
+
+ if ((test_to_run && !strcmp(test_to_run, "nodelay")) || !test_to_run)
+ {
+ fprintf(stderr, "\nTCP Nodelay tests\n\n");
+ for (x= 0; tests[x].function_name; x++)
+ {
+ if (wildcard)
+ if (strcmp(wildcard, tests[x].function_name))
+ continue;
+
+ memcached_st *memc;
+ memcached_return rc;
+ struct timeval start_time, end_time;
+
+ memc= memcached_create(NULL);
+ assert(memc);
+
+ rc= memcached_server_push(memc, servers);
+ assert(rc == MEMCACHED_SUCCESS);
+
+ fprintf(stderr, "Testing %s", tests[x].function_name);
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, NULL);
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, NULL);
+ gettimeofday(&start_time, NULL);
+ tests[x].function(memc);
+ gettimeofday(&end_time, NULL);
+ long int load_time= timedif(end_time, start_time);
+ fprintf(stderr, "\t\t\t\t\t %ld.%03ld [ ok ]\n", load_time / 1000,
+ load_time % 1000);
+ assert(memc);
+ memcached_free(memc);
+ }
+ }
+
+ if ((test_to_run && !strcmp(test_to_run, "md5")) || !test_to_run)
+ {
+ fprintf(stderr, "\nMD5 Hashing\n\n");
+ for (x= 0; tests[x].function_name; x++)
+ {
+ if (wildcard)
+ if (strcmp(wildcard, tests[x].function_name))
+ continue;
+
+ memcached_st *memc;
+ memcached_return rc;
+ struct timeval start_time, end_time;
+
+ memc= memcached_create(NULL);
+ assert(memc);
+
+ rc= memcached_server_push(memc, servers);
+ assert(rc == MEMCACHED_SUCCESS);
+
+ fprintf(stderr, "Testing %s", tests[x].function_name);
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_MD5_HASHING, NULL);
+ gettimeofday(&start_time, NULL);
+ tests[x].function(memc);
+ gettimeofday(&end_time, NULL);
+ long int load_time= timedif(end_time, start_time);
+ fprintf(stderr, "\t\t\t\t\t %ld.%03ld [ ok ]\n", load_time / 1000,
+ load_time % 1000);
+ assert(memc);
+ memcached_free(memc);
+ }
+ }
+
+ if ((test_to_run && !strcmp(test_to_run, "user")) || !test_to_run)
+ {
+ fprintf(stderr, "\nUser Supplied tests\n\n");
+ for (x= 0; user_tests[x].function_name; x++)
+ {
+ if (wildcard)
+ if (strcmp(wildcard, tests[x].function_name))
+ continue;
+
+ memcached_st *memc;
+ memcached_return rc;
+ struct timeval start_time, end_time;
+
+ memc= memcached_create(NULL);
+ assert(memc);
+
+ rc= memcached_server_push(memc, servers);
+ assert(rc == MEMCACHED_SUCCESS);
+
+ fprintf(stderr, "Testing %s", user_tests[x].function_name);
+ gettimeofday(&start_time, NULL);
+ user_tests[x].function(memc);
+ gettimeofday(&end_time, NULL);
+ long int load_time= timedif(end_time, start_time);
+ fprintf(stderr, "\t\t\t\t\t %ld.%03ld [ ok ]\n", load_time / 1000,
+ load_time % 1000);
+ assert(memc);
+ memcached_free(memc);
+ }