projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Merge in fix so that we don't have to do weight on the const root
[m6w6/libmemcached]
/
tests
/
atomsmasher.c
diff --git
a/tests/atomsmasher.c
b/tests/atomsmasher.c
index b7e5924e0d2a364041e061c124bc9930c22b3710..8563e4ec19e66bb4cf7c47de93839db3e80efac0 100644
(file)
--- a/
tests/atomsmasher.c
+++ b/
tests/atomsmasher.c
@@
-12,29
+12,25
@@
/*
Sample test application.
*/
/*
Sample test application.
*/
-#include "libmemcached/common.h"
+#include "config.h"
+
+#include "libmemcached/memcached.h"
+#include "libmemcached/watchpoint.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
-#include "server.h"
-#include "../clients/generator.h"
-#include "../clients/execute.h"
-
-#ifndef INT64_MAX
-#define INT64_MAX LONG_MAX
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX INT_MAX
-#endif
-
+#include <clients/generator.h>
+#include <clients/execute.h>
-#include "test.h"
+#include <libtest/server.h>
+#include <libtest/test.h>
/* Number of items generated for tests */
#define GLOBAL_COUNT 100000
/* Number of items generated for tests */
#define GLOBAL_COUNT 100000
@@
-47,25
+43,27
@@
static pairs_st *global_pairs;
static char *global_keys[GLOBAL_COUNT];
static size_t global_keys_length[GLOBAL_COUNT];
static char *global_keys[GLOBAL_COUNT];
static size_t global_keys_length[GLOBAL_COUNT];
-static test_return_t cleanup_pairs(memcached_st *memc
__attribute__((unused))
)
+static test_return_t cleanup_pairs(memcached_st *memc)
{
{
+ (void)memc;
pairs_free(global_pairs);
pairs_free(global_pairs);
- return
0
;
+ return
EXIT_SUCCESS
;
}
}
-static test_return_t generate_pairs(memcached_st *memc
__attribute__((unused))
)
+static test_return_t generate_pairs(memcached_st *memc)
{
{
+ (void)memc;
global_pairs= pairs_generate(GLOBAL_COUNT, 400);
global_count= GLOBAL_COUNT;
for (size_t x= 0; x < global_count; x++)
{
global_pairs= pairs_generate(GLOBAL_COUNT, 400);
global_count= GLOBAL_COUNT;
for (size_t x= 0; x < global_count; x++)
{
- global_keys[x]= global_pairs[x].key;
+ global_keys[x]= global_pairs[x].key;
global_keys_length[x]= global_pairs[x].key_length;
}
global_keys_length[x]= global_pairs[x].key_length;
}
- return
0
;
+ return
EXIT_SUCCESS
;
}
static test_return_t drizzle(memcached_st *memc)
}
static test_return_t drizzle(memcached_st *memc)
@@
-101,12
+99,12
@@
infinite:
WATCHPOINT_ERROR(rc);
WATCHPOINT_ASSERT(rc);
}
WATCHPOINT_ERROR(rc);
WATCHPOINT_ASSERT(rc);
}
- }
+ }
else
{
else
{
- rc= memcached_set(memc, global_pairs[test_bit].key,
+ rc= memcached_set(memc, global_pairs[test_bit].key,
global_pairs[test_bit].key_length,
global_pairs[test_bit].key_length,
- global_pairs[test_bit].value,
+ global_pairs[test_bit].value,
global_pairs[test_bit].value_length,
0, 0);
if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_BUFFERED)
global_pairs[test_bit].value_length,
0, 0);
if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_BUFFERED)
@@
-130,7
+128,7
@@
static test_return_t pre_nonblock(memcached_st *memc)
return TEST_SUCCESS;
}
return TEST_SUCCESS;
}
-/*
+/*
Set the value, then quit to make sure it is flushed.
Come back in and test that add fails.
*/
Set the value, then quit to make sure it is flushed.
Come back in and test that add fails.
*/
@@
-143,12
+141,12
@@
static test_return_t add_test(memcached_st *memc)
setting_value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK);
setting_value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK);
- rc= memcached_set(memc, key, strlen(key),
+ rc= memcached_set(memc, key, strlen(key),
value, strlen(value),
(time_t)0, (uint32_t)0);
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
memcached_quit(memc);
value, strlen(value),
(time_t)0, (uint32_t)0);
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
memcached_quit(memc);
- rc= memcached_add(memc, key, strlen(key),
+ rc= memcached_add(memc, key, strlen(key),
value, strlen(value),
(time_t)0, (uint32_t)0);
value, strlen(value),
(time_t)0, (uint32_t)0);
@@
-162,7
+160,7
@@
static test_return_t add_test(memcached_st *memc)
test_true(rc == MEMCACHED_NOTSTORED);
}
test_true(rc == MEMCACHED_NOTSTORED);
}
- return
0
;
+ return
EXIT_SUCCESS
;
}
/*
}
/*
@@
-175,7
+173,7
@@
static test_return_t many_adds(memcached_st *memc)
{
add_test(memc);
}
{
add_test(memc);
}
- return
0
;
+ return
EXIT_SUCCESS
;
}
test_st smash_tests[] ={
}
test_st smash_tests[] ={
@@
-196,8
+194,9
@@
struct benchmark_state_st
memcached_st *clone;
} benchmark_state;
memcached_st *clone;
} benchmark_state;
-static test_return_t memcached_create_benchmark(memcached_st *memc
__attribute__((unused))
)
+static test_return_t memcached_create_benchmark(memcached_st *memc)
{
{
+ (void)memc;
benchmark_state.create_init= true;
for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
benchmark_state.create_init= true;
for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
@@
-226,8
+225,9
@@
static test_return_t memcached_clone_benchmark(memcached_st *memc)
return TEST_SUCCESS;
}
return TEST_SUCCESS;
}
-static test_return_t pre_allocate(memcached_st *memc
__attribute__((unused))
)
+static test_return_t pre_allocate(memcached_st *memc)
{
{
+ (void)memc;
memset(&benchmark_state, 0, sizeof(benchmark_state));
benchmark_state.create= (memcached_st *)calloc(BENCHMARK_TEST_LOOP, sizeof(memcached_st));
memset(&benchmark_state, 0, sizeof(benchmark_state));
benchmark_state.create= (memcached_st *)calloc(BENCHMARK_TEST_LOOP, sizeof(memcached_st));
@@
-238,8
+238,9
@@
static test_return_t pre_allocate(memcached_st *memc __attribute__((unused)))
return TEST_SUCCESS;
}
return TEST_SUCCESS;
}
-static test_return_t post_allocate(memcached_st *memc
__attribute__((unused))
)
+static test_return_t post_allocate(memcached_st *memc)
{
{
+ (void)memc;
for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
{
if (benchmark_state.create_init)
for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
{
if (benchmark_state.create_init)