#include <libtest/server.h>
+#include <tests/debug.h>
+
using namespace libtest;
/* Number of items generated for tests */
static char *global_keys[GLOBAL_COUNT];
static size_t global_keys_length[GLOBAL_COUNT];
-static test_return_t cleanup_pairs(memcached_st *memc)
+static test_return_t cleanup_pairs(memcached_st *)
{
- (void)memc;
pairs_free(global_pairs);
return TEST_SUCCESS;
}
-static test_return_t generate_pairs(memcached_st *memc)
+static test_return_t generate_pairs(memcached_st *)
{
- (void)memc;
global_pairs= pairs_generate(GLOBAL_COUNT, 400);
global_count= GLOBAL_COUNT;
static test_return_t drizzle(memcached_st *memc)
{
- memcached_return_t rc;
- char *return_value;
- size_t return_value_length;
- uint32_t flags;
-
infinite:
for (size_t x= 0; x < TEST_COUNTER; x++)
{
+ memcached_return_t rc;
+ char *return_value;
+ size_t return_value_length;
+ uint32_t flags;
+
uint32_t test_bit;
uint8_t which;
}
if (getenv("MEMCACHED_ATOM_BURIN_IN"))
+ {
goto infinite;
+ }
return TEST_SUCCESS;
}
*/
static test_return_t add_test(memcached_st *memc)
{
- memcached_return_t rc;
const char *key= "foo";
const char *value= "when we sanitize";
- unsigned long long setting_value;
-
- setting_value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK);
+ memcached_return_t rc;
rc= memcached_set(memc, key, strlen(key),
value, strlen(value),
(time_t)0, (uint32_t)0);
value, strlen(value),
(time_t)0, (uint32_t)0);
+ if (rc == MEMCACHED_CONNECTION_FAILURE)
+ {
+ print_servers(memc);
+ }
+
/* Too many broken OS'es have broken loopback in async, so we can't be sure of the result */
- if (setting_value)
+ if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK))
{
test_true(rc == MEMCACHED_NOTSTORED or rc == MEMCACHED_STORED);
}
*/
static test_return_t many_adds(memcached_st *memc)
{
+ test_true(memc);
for (size_t x= 0; x < TEST_COUNTER; x++)
{
- add_test(memc);
+ test_compare_got(TEST_SUCCESS, add_test(memc), x);
}
return TEST_SUCCESS;
}
test_st smash_tests[] ={
- {"generate_pairs", 1, (test_callback_fn*)generate_pairs },
- {"drizzle", 1, (test_callback_fn*)drizzle },
- {"cleanup", 1, (test_callback_fn*)cleanup_pairs },
- {"many_adds", 1, (test_callback_fn*)many_adds },
+ {"generate_pairs", true, (test_callback_fn*)generate_pairs },
+ {"drizzle", true, (test_callback_fn*)drizzle },
+ {"cleanup", true, (test_callback_fn*)cleanup_pairs },
+ {"many_adds", true, (test_callback_fn*)many_adds },
{0, 0, 0}
};
memcached_st *clone;
} benchmark_state;
-static test_return_t memcached_create_benchmark(memcached_st *memc)
+static test_return_t memcached_create_benchmark(memcached_st *)
{
- (void)memc;
benchmark_state.create_init= true;
for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
return TEST_SUCCESS;
}
-static test_return_t pre_allocate(memcached_st *memc)
+static test_return_t pre_allocate(memcached_st *)
{
- (void)memc;
memset(&benchmark_state, 0, sizeof(benchmark_state));
benchmark_state.create= (memcached_st *)calloc(BENCHMARK_TEST_LOOP, sizeof(memcached_st));
return TEST_SUCCESS;
}
-static test_return_t post_allocate(memcached_st *memc)
+static test_return_t post_allocate(memcached_st *)
{
- (void)memc;
for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
{
if (benchmark_state.create_init)
+ {
memcached_free(&benchmark_state.create[x]);
+ }
if (benchmark_state.clone_init)
+ {
memcached_free(&benchmark_state.clone[x]);
+ }
}
free(benchmark_state.create);