#include <unistd.h>
#include <time.h>
#include "../lib/common.h"
+#include "../src/generator.h"
+#include "../src/execute.h"
#include "test.h"
+#define GLOBAL_COUNT 100000
+static pairs_st *global_pairs;
+static char *global_keys[GLOBAL_COUNT];
+static size_t global_keys_length[GLOBAL_COUNT];
+
void init_test(memcached_st *not_used)
{
memcached_st memc;
memcached_result_length(results)));
}
- WATCHPOINT;
memcached_result_free(&results_obj);
- WATCHPOINT;
}
void mget_result_alloc_test(memcached_st *memc)
memcached_string_free(string);
}
+void generate_data(memcached_st *memc)
+{
+ unsigned long long x;
+ global_pairs= pairs_generate(GLOBAL_COUNT);
+ execute_set(memc, global_pairs, GLOBAL_COUNT);
+
+ for (x= 0; x < GLOBAL_COUNT; x++)
+ {
+ global_keys[x]= global_pairs[x].key;
+ global_keys_length[x]= global_pairs[x].key_length;
+ }
+}
+
+void get_read(memcached_st *memc)
+{
+ unsigned int x;
+ memcached_return rc;
+
+ {
+ char *return_value;
+ size_t return_value_length;
+ uint16_t flags;
+
+ for (x= 0; x < GLOBAL_COUNT; x++)
+ {
+ return_value= memcached_get(memc, global_keys[x], global_keys_length[x],
+ &return_value_length, &flags, &rc);
+ /*
+ assert(return_value);
+ assert(rc == MEMCACHED_SUCCESS);
+ */
+ if (rc == MEMCACHED_SUCCESS && return_value)
+ free(return_value);
+ }
+ }
+}
+
+void mget_read(memcached_st *memc)
+{
+ memcached_return rc;
+
+ rc= memcached_mget(memc, global_keys, global_keys_length, GLOBAL_COUNT);
+ assert(rc == MEMCACHED_SUCCESS);
+ /* Turn this into a help function */
+ {
+ char return_key[MEMCACHED_MAX_KEY];
+ size_t return_key_length;
+ char *return_value;
+ size_t return_value_length;
+ uint16_t flags;
+
+ while ((return_value= memcached_fetch(memc, return_key, &return_key_length,
+ &return_value_length, &flags, &rc)))
+ {
+ assert(return_value);
+ assert(rc == MEMCACHED_SUCCESS);
+ free(return_value);
+ }
+ }
+}
+
+void mget_read_result(memcached_st *memc)
+{
+ memcached_return rc;
+
+ rc= memcached_mget(memc, global_keys, global_keys_length, GLOBAL_COUNT);
+ assert(rc == MEMCACHED_SUCCESS);
+ /* Turn this into a help function */
+ {
+ memcached_result_st results_obj;
+ memcached_result_st *results;
+
+ results= memcached_result_create(memc, &results_obj);
+
+ while ((results= memcached_fetch_result(memc, &results_obj, &rc)))
+ {
+ assert(results);
+ assert(rc == MEMCACHED_SUCCESS);
+ }
+
+ memcached_result_free(&results_obj);
+ }
+}
+
+void free_data(memcached_st *memc)
+{
+ pairs_free(global_pairs);
+}
+
void add_host_test1(memcached_st *memc)
{
unsigned int x;
{0, 0, 0}
};
+test_st generate_tests[] ={
+ {"generate_data", 0, generate_data },
+ {"get_read", 0, get_read },
+ {"mget_read", 0, mget_read },
+ {"mget_read_result", 0, mget_read_result },
+ {0, 0, 0}
+};
+
collection_st collection[] ={
{"block", 0, 0, tests},
{"string", 0, 0, string_tests},
{"result", 0, 0, result_tests},
{"user", 0, 0, user_tests},
+ {"generate", 0, 0, generate_tests},
{0, 0, 0, 0}
};
Found key bytes_written
Found key limit_maxbytes
Found key threads
-Error 0 -> SUCCESS
-Error 1 -> FAILURE
-Error 2 -> HOSTNAME LOOKUP FAILURE
-Error 3 -> CONNECTION FAILURE
-Error 4 -> CONNECTION BIND FAILURE
-Error 5 -> WRITE FAILURE
-Error 6 -> READ FAILURE
-Error 7 -> UNKNOWN READ FAILURE
-Error 8 -> PROTOCOL ERROR
-Error 9 -> CLIENT ERROR
-Error 10 -> SERVER ERROR
-Error 11 -> CONNECTION SOCKET CREATE FAILURE
-Error 12 -> CONNECTION DATA EXISTS
-Error 13 -> CONNECTION DATA DOES NOT EXIST
-Error 14 -> NOT STORED
-Error 15 -> STORED
-Error 16 -> NOT FOUND
-Error 17 -> MEMORY ALLOCATION FAILURE
-Error 18 -> PARTIAL READ
-Error 19 -> SOME ERRORS WERE REPORTED
-Error 20 -> NO SERVERS DEFINED
-Error 21 -> SERVER END
-Error 22 -> SERVER DELETE
-Error 23 -> SERVER VALUE
-Error 24 -> STAT VALUE
-Error 25 -> SYSTEM ERROR
-Error 26 -> COULD NOT OPEN UNIX SOCKET
-Error 27 -> ACTION NOT SUPPORTED
-Found key pid
-Found key uptime
-Found key time
-Found key version
-Found key pointer_size
-Found key rusage_user
-Found key rusage_system
-Found key rusage_user_seconds
-Found key rusage_user_microseconds
-Found key rusage_system_seconds
-Found key rusage_system_microseconds
-Found key curr_items
-Found key total_items
-Found key bytes
-Found key curr_connections
-Found key total_connections
-Found key connection_structures
-Found key cmd_get
-Found key cmd_set
-Found key get_hits
-Found key get_misses
-Found key evictions
-Found key bytes_read
-Found key bytes_written
-Found key limit_maxbytes
-Found key threads
-Found key pid
-Found key uptime
-Found key time
-Found key version
-Found key pointer_size
-Found key rusage_user
-Found key rusage_system
-Found key rusage_user_seconds
-Found key rusage_user_microseconds
-Found key rusage_system_seconds
-Found key rusage_system_microseconds
-Found key curr_items
-Found key total_items
-Found key bytes
-Found key curr_connections
-Found key total_connections
-Found key connection_structures
-Found key cmd_get
-Found key cmd_set
-Found key get_hits
-Found key get_misses
-Found key evictions
-Found key bytes_read
-Found key bytes_written
-Found key limit_maxbytes
-Found key threads
-Found key pid
-Found key uptime
-Found key time
-Found key version
-Found key pointer_size
-Found key rusage_user
-Found key rusage_system
-Found key rusage_user_seconds
-Found key rusage_user_microseconds
-Found key rusage_system_seconds
-Found key rusage_system_microseconds
-Found key curr_items
-Found key total_items
-Found key bytes
-Found key curr_connections
-Found key total_connections
-Found key connection_structures
-Found key cmd_get
-Found key cmd_set
-Found key get_hits
-Found key get_misses
-Found key evictions
-Found key bytes_read
-Found key bytes_written
-Found key limit_maxbytes
-Found key threads