projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Fix compilation on Linux (lacks ntohll etc)
[m6w6/libmemcached]
/
tests
/
atomsmasher.c
diff --git
a/tests/atomsmasher.c
b/tests/atomsmasher.c
index 11b4258f55f9387c9d16d51533cd9981cc7ba2cd..3b4879df4bef1c1c260935867fbfbae4ad42f94f 100644
(file)
--- a/
tests/atomsmasher.c
+++ b/
tests/atomsmasher.c
@@
-1,6
+1,8
@@
/*
Sample test application.
*/
/*
Sample test application.
*/
+#include "libmemcached/common.h"
+
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@
-11,7
+13,6
@@
#include <unistd.h>
#include <time.h>
#include "server.h"
#include <unistd.h>
#include <time.h>
#include "server.h"
-#include "../libmemcached/common.h"
#include "../clients/generator.h"
#include "../clients/execute.h"
#include "../clients/generator.h"
#include "../clients/execute.h"
@@
-36,14
+37,14
@@
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];
-
uint8_t cleanup_pairs(memcached_st *memc
)
+
static test_return cleanup_pairs(memcached_st *memc __attribute__((unused))
)
{
pairs_free(global_pairs);
return 0;
}
{
pairs_free(global_pairs);
return 0;
}
-
uint8_t generate_pairs(memcached_st *memc
)
+
static test_return generate_pairs(memcached_st *memc __attribute__((unused))
)
{
unsigned long long x;
global_pairs= pairs_generate(GLOBAL_COUNT, 400);
{
unsigned long long x;
global_pairs= pairs_generate(GLOBAL_COUNT, 400);
@@
-58,7
+59,7
@@
uint8_t generate_pairs(memcached_st *memc)
return 0;
}
return 0;
}
-
uint8_t
drizzle(memcached_st *memc)
+
static test_return
drizzle(memcached_st *memc)
{
unsigned int x;
memcached_return rc;
{
unsigned int x;
memcached_return rc;
@@
-72,8
+73,8
@@
infinite:
uint32_t test_bit;
uint8_t which;
uint32_t test_bit;
uint8_t which;
- test_bit=
random() % GLOBAL_COUNT
;
- which=
random() % 2
;
+ test_bit=
(uint32_t)(random() % GLOBAL_COUNT)
;
+ which=
(uint8_t)(random() % 2)
;
if (which == 0)
{
if (which == 0)
{
@@
-110,28
+111,28
@@
infinite:
return 0;
}
return 0;
}
-memcached_return pre_nonblock(memcached_st *memc)
+
static
memcached_return pre_nonblock(memcached_st *memc)
{
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0);
return MEMCACHED_SUCCESS;
}
{
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0);
return MEMCACHED_SUCCESS;
}
-memcached_return pre_md5(memcached_st *memc)
+
static
memcached_return pre_md5(memcached_st *memc)
{
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_MD5);
return MEMCACHED_SUCCESS;
}
{
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_MD5);
return MEMCACHED_SUCCESS;
}
-memcached_return pre_hsieh(memcached_st *memc)
+
static
memcached_return pre_hsieh(memcached_st *memc)
{
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_HSIEH);
return MEMCACHED_SUCCESS;
}
{
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_HSIEH);
return MEMCACHED_SUCCESS;
}
-memcached_return enable_consistent(memcached_st *memc)
+
static
memcached_return enable_consistent(memcached_st *memc)
{
memcached_server_distribution value= MEMCACHED_DISTRIBUTION_CONSISTENT;
memcached_hash hash;
{
memcached_server_distribution value= MEMCACHED_DISTRIBUTION_CONSISTENT;
memcached_hash hash;
@@
-152,11
+153,11
@@
memcached_return enable_consistent(memcached_st *memc)
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.
*/
-
uint8_t
add_test(memcached_st *memc)
+
static test_return
add_test(memcached_st *memc)
{
memcached_return rc;
{
memcached_return rc;
- char *key= "foo";
- char *value= "when we sanitize";
+ c
onst c
har *key= "foo";
+ c
onst c
har *value= "when we sanitize";
unsigned long long setting_value;
setting_value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK);
unsigned long long setting_value;
setting_value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK);
@@
-172,7
+173,7
@@
uint8_t add_test(memcached_st *memc)
/* Too many broken OS'es have broken loopback in async, so we can't be sure of the result */
if (setting_value)
/* Too many broken OS'es have broken loopback in async, so we can't be sure of the result */
if (setting_value)
- assert(rc == MEMCACHED_NOTSTORED || MEMCACHED_STORED);
+ assert(rc == MEMCACHED_NOTSTORED ||
rc ==
MEMCACHED_STORED);
else
assert(rc == MEMCACHED_NOTSTORED);
else
assert(rc == MEMCACHED_NOTSTORED);
@@
-183,10
+184,11
@@
uint8_t add_test(memcached_st *memc)
* repeating add_tests many times
* may show a problem in timing
*/
* repeating add_tests many times
* may show a problem in timing
*/
-
uint8_t
many_adds(memcached_st *memc)
+
static test_return
many_adds(memcached_st *memc)
{
unsigned int i;
{
unsigned int i;
- for (i = 0; i < TEST_COUNTER; i++){
+ for (i = 0; i < TEST_COUNTER; i++)
+ {
add_test(memc);
}
return 0;
add_test(memc);
}
return 0;
@@
-212,7
+214,7
@@
collection_st collection[] ={
#define SERVERS_TO_CREATE 5
#define SERVERS_TO_CREATE 5
-void *world_create(void)
+
static
void *world_create(void)
{
server_startup_st *construct;
{
server_startup_st *construct;
@@
-225,7
+227,7
@@
void *world_create(void)
return construct;
}
return construct;
}
-void world_destroy(void *p)
+
static
void world_destroy(void *p)
{
server_startup_st *construct= (server_startup_st *)p;
memcached_server_st *servers= (memcached_server_st *)construct->servers;
{
server_startup_st *construct= (server_startup_st *)p;
memcached_server_st *servers= (memcached_server_st *)construct->servers;