memcached/.git
memcached/.gitignore
memcached/memcached
+memcached/memcached.spec
-.TH "HASHKIT_CLONE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_CLONE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_clone \- libhashkit Documentation
.
-.TH "HASHKIT_CRC32" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_CRC32" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_crc32 \- libhashkit Documentation
.
-.TH "HASHKIT_CREATE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_CREATE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_create \- libhashkit Documentation
.
-.TH "HASHKIT_FNV1_32" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_FNV1_32" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_fnv1_32 \- libhashkit Documentation
.
-.TH "HASHKIT_FNV1_64" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_FNV1_64" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_fnv1_64 \- libhashkit Documentation
.
-.TH "HASHKIT_FNV1A_32" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_FNV1A_32" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_fnv1a_32 \- libhashkit Documentation
.
-.TH "HASHKIT_FNV1A_64" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_FNV1A_64" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_fnv1a_64 \- libhashkit Documentation
.
-.TH "HASHKIT_FREE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_FREE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_free \- libhashkit Documentation
.
-.TH "HASHKIT_FUNCTIONS" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_FUNCTIONS" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_functions \- libhashkit Documentation
.
-.TH "HASHKIT_HSIEH" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_HSIEH" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_hsieh \- libhashkit Documentation
.
-.TH "HASHKIT_IS_ALLOCATED" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_IS_ALLOCATED" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_is_allocated \- libhashkit Documentation
.
-.TH "HASHKIT_JENKINS" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_JENKINS" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_jenkins \- libhashkit Documentation
.
-.TH "HASHKIT_MD5" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_MD5" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_md5 \- libhashkit Documentation
.
-.TH "HASHKIT_MURMUR" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_MURMUR" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_murmur \- libhashkit Documentation
.
-.TH "HASHKIT_VALUE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "HASHKIT_VALUE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
hashkit_value \- libhashkit Documentation
.
-.TH "LIBHASHKIT" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "LIBHASHKIT" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
libhashkit \- libhashkit Documentation
.
-.TH "LIBMEMCACHED" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "LIBMEMCACHED" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
libmemcached \- Introducing the C Client Library for memcached
.
-.TH "LIBMEMCACHED_CHECK_CONFIGURATION" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "LIBMEMCACHED_CHECK_CONFIGURATION" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
libmemcached_check_configuration \- libmemcached Documentation
.
-.TH "LIBMEMCACHED_CONFIGURATION" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "LIBMEMCACHED_CONFIGURATION" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
libmemcached_configuration \- libmemcached Documentation
.
-.TH "LIBMEMCACHED_EXAMPLES" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "LIBMEMCACHED_EXAMPLES" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
libmemcached_examples \- libmemcached Documentation
.
-.TH "LIBMEMCACHEDUTIL" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "LIBMEMCACHEDUTIL" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
libmemcachedutil \- libmemcached Documentation
.
-.TH "MEMASLAP" "1" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMASLAP" "1" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memaslap \- libmemcached Documentation
.
-.TH "MEMCACHED" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached \- libmemcached Documentation
.
-.TH "MEMCACHED_ADD" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_ADD" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_add \- Storing and Replacing Data
.
-.TH "MEMCACHED_ADD_BY_KEY" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_ADD_BY_KEY" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_add_by_key \- Storing and Replacing Data
.
-.TH "MEMCACHED_ANALYZE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_ANALYZE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_analyze \- libmemcached Documentation
.
-.TH "MEMCACHED_APPEND" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_APPEND" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_append \- Appending to or Prepending to data on the server
.
-.TH "MEMCACHED_APPEND_BY_KEY" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_APPEND_BY_KEY" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_append_by_key \- Appending to or Prepending to data on the server
.
-.TH "MEMCACHED_AUTO" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_AUTO" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_auto \- Incrementing and Decrementing Values
.
-.TH "MEMCACHED_BEHAVIOR" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_BEHAVIOR" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_behavior \- libmemcached Documentation
.
-.TH "MEMCACHED_BEHAVIOR_GET" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_BEHAVIOR_GET" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_behavior_get \- libmemcached Documentation
.
-.TH "MEMCACHED_BEHAVIOR_SET" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_BEHAVIOR_SET" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_behavior_set \- libmemcached Documentation
.
-.TH "MEMCACHED_CALLBACK" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_CALLBACK" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_callback \- libmemcached Documentation
.
-.TH "MEMCACHED_CALLBACK_GET" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_CALLBACK_GET" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_callback_get \- libmemcached Documentation
.
-.TH "MEMCACHED_CALLBACK_SET" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_CALLBACK_SET" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_callback_set \- libmemcached Documentation
.
-.TH "MEMCACHED_CAS" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_CAS" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_cas \- Working with data on the server in an atomic fashion
.
-.TH "MEMCACHED_CAS_BY_KEY" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_CAS_BY_KEY" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_cas_by_key \- Storing and Replacing Data
.
-.TH "MEMCACHED_CLONE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_CLONE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_clone \- libmemcached Documentation
.
-.TH "MEMCACHED_CREATE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_CREATE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_create \- libmemcached Documentation
.
-.TH "MEMCACHED_DECREMENT" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_DECREMENT" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_decrement \- Incrementing and Decrementing Values
.
-.TH "MEMCACHED_DECREMENT_WITH_INITIAL" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_DECREMENT_WITH_INITIAL" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_decrement_with_initial \- Incrementing and Decrementing Values
.
-.TH "MEMCACHED_DELETE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_DELETE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_delete \- libmemcached Documentation
.
-.TH "MEMCACHED_DELETE_BY_KEY" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_DELETE_BY_KEY" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_delete_by_key \- libmemcached Documentation
.
-.TH "MEMCACHED_DESTROY_SASL_AUTH_DATA" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_DESTROY_SASL_AUTH_DATA" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_destroy_sasl_auth_data \- libmemcached Documentation
.
-.TH "MEMCACHED_DUMP" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_DUMP" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_dump \- libmemcached Documentation
.
-.TH "MEMCACHED_EXIST" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_EXIST" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_exist \- libmemcached Documentation
.
-.TH "MEMCACHED_EXIST_BY_KEY" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_EXIST_BY_KEY" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_exist_by_key \- libmemcached Documentation
.
-.TH "MEMCACHED_FETCH" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_FETCH" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_fetch \- Retrieving data from the server
.
-.TH "MEMCACHED_FETCH_EXECUTE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_FETCH_EXECUTE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_fetch_execute \- Retrieving data from the server
.
-.TH "MEMCACHED_FETCH_RESULT" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_FETCH_RESULT" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_fetch_result \- Retrieving data from the server
.
-.TH "MEMCACHED_FLUSH" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_FLUSH" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_flush \- libmemcached Documentation
.
-.TH "MEMCACHED_FLUSH_BUFFERS" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_FLUSH_BUFFERS" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_flush_buffers \- libmemcached Documentation
.
-.TH "MEMCACHED_FREE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_FREE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_free \- libmemcached Documentation
.
-.TH "MEMCACHED_GENERATE_HASH" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_GENERATE_HASH" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_generate_hash \- Generating hash values directly
.
-.TH "MEMCACHED_GENERATE_HASH_VALUE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_GENERATE_HASH_VALUE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_generate_hash_value \- Generating hash values directly
.
-.TH "MEMCACHED_GET" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_GET" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_get \- Retrieving data from the server
.
-.TH "MEMCACHED_GET_BY_KEY" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_GET_BY_KEY" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_get_by_key \- Retrieving data from the server
.
-.TH "MEMCACHED_GET_MEMORY_ALLOCATORS" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_GET_MEMORY_ALLOCATORS" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_get_memory_allocators \- libmemcached Documentation
.
-.TH "MEMCACHED_GET_SASL_CALLBACKS" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_GET_SASL_CALLBACKS" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_get_sasl_callbacks \- libmemcached Documentation
.
-.TH "MEMCACHED_GET_USER_DATA" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_GET_USER_DATA" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_get_user_data \- libmemcached Documentation
.
-.TH "MEMCACHED_INCREMENT" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_INCREMENT" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_increment \- Incrementing and Decrementing Values
.
-.TH "MEMCACHED_INCREMENT_WITH_INITIAL" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_INCREMENT_WITH_INITIAL" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_increment_with_initial \- Incrementing and Decrementing Values
.
-.TH "MEMCACHED_LAST_ERROR_MESSAGE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_LAST_ERROR_MESSAGE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_last_error_message \- libmemcached Documentation
.
-.TH "MEMCACHED_LIB_VERSION" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_LIB_VERSION" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_lib_version \- libmemcached Documentation
.
-.TH "MEMCACHED_MEMORY_ALLOCATORS" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_MEMORY_ALLOCATORS" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_memory_allocators \- libmemcached Documentation
.
-.TH "MEMCACHED_MGET" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_MGET" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_mget \- Retrieving data from the server
.
-.TH "MEMCACHED_MGET_BY_KEY" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_MGET_BY_KEY" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_mget_by_key \- Retrieving data from the server
.
-.TH "MEMCACHED_MGET_EXECUTE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_MGET_EXECUTE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_mget_execute \- Retrieving data from the server
.
-.TH "MEMCACHED_MGET_EXECUTE_BY_KEY" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_MGET_EXECUTE_BY_KEY" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_mget_execute_by_key \- Retrieving data from the server
.
-.TH "MEMCACHED_POOL" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_POOL" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_pool \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_BEHAVIOR_GET" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_POOL_BEHAVIOR_GET" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_pool_behavior_get \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_BEHAVIOR_SET" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_POOL_BEHAVIOR_SET" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_pool_behavior_set \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_CREATE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_POOL_CREATE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_pool_create \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_DESTROY" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_POOL_DESTROY" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_pool_destroy \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_FETCH" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_POOL_FETCH" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_pool_fetch \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_POP" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_POOL_POP" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_pool_pop \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_PUSH" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_POOL_PUSH" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_pool_push \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_RELEASE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_POOL_RELEASE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_pool_release \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_ST" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_POOL_ST" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_pool_st \- libmemcached Documentation
.
-.TH "MEMCACHED_PREPEND" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_PREPEND" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_prepend \- Appending to or Prepending to data on the server
.
-.TH "MEMCACHED_PREPEND_BY_KEY" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_PREPEND_BY_KEY" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_prepend_by_key \- Appending to or Prepending to data on the server
.
-.TH "MEMCACHED_QUIT" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_QUIT" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_quit \- libmemcached Documentation
.
-.TH "MEMCACHED_REPLACE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_REPLACE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_replace \- Storing and Replacing Data
.
-.TH "MEMCACHED_REPLACE_BY_KEY" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_REPLACE_BY_KEY" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_replace_by_key \- Storing and Replacing Data
.
-.TH "MEMCACHED_RESULT_CAS" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_RESULT_CAS" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_result_cas \- Working with result sets
.
-.TH "MEMCACHED_RESULT_CREATE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_RESULT_CREATE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_result_create \- Working with result sets
.
-.TH "MEMCACHED_RESULT_FLAGS" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_RESULT_FLAGS" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_result_flags \- Working with result sets
.
-.TH "MEMCACHED_RESULT_FREE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_RESULT_FREE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_result_free \- Working with result sets
.
-.TH "MEMCACHED_RESULT_KEY_LENGTH" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_RESULT_KEY_LENGTH" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_result_key_length \- Working with result sets
.
-.TH "MEMCACHED_RESULT_KEY_VALUE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_RESULT_KEY_VALUE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_result_key_value \- Working with result sets
.
-.TH "MEMCACHED_RESULT_LENGTH" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_RESULT_LENGTH" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_result_length \- Working with result sets
.
-.TH "MEMCACHED_RESULT_ST" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_RESULT_ST" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_result_st \- Working with result sets
.
-.TH "MEMCACHED_RESULT_VALUE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_RESULT_VALUE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_result_value \- Working with result sets
.
-.TH "MEMCACHED_RETURN_T" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_RETURN_T" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_return_t \- Return type values
.
-.TH "MEMCACHED_SASL" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SASL" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_sasl \- libmemcached Documentation
.
-.TH "MEMCACHED_SASL_SET_AUTH_DATA" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SASL_SET_AUTH_DATA" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_sasl_set_auth_data \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_ADD" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SERVER_ADD" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_server_add \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_ADD_UNIX_SOCKET" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SERVER_ADD_UNIX_SOCKET" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_server_add_unix_socket \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_COUNT" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SERVER_COUNT" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_server_count \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_CURSOR" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SERVER_CURSOR" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_server_cursor \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_LIST" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SERVER_LIST" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_server_list \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_LIST_APPEND" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SERVER_LIST_APPEND" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_server_list_append \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_LIST_COUNT" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SERVER_LIST_COUNT" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_server_list_count \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_LIST_FREE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SERVER_LIST_FREE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_server_list_free \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_PUSH" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SERVER_PUSH" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_server_push \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_ST" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SERVER_ST" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_server_st \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVERS" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SERVERS" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_servers \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVERS_PARSE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SERVERS_PARSE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_servers_parse \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVERS_RESET" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SERVERS_RESET" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_servers_reset \- libmemcached Documentation
.
-.TH "MEMCACHED_SET" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SET" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_set \- Storing and Replacing Data
.
-.TH "MEMCACHED_SET_BY_KEY" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SET_BY_KEY" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_set_by_key \- Storing and Replacing Data
.
-.TH "MEMCACHED_SET_MEMORY_ALLOCATORS" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SET_MEMORY_ALLOCATORS" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_set_memory_allocators \- libmemcached Documentation
.
-.TH "MEMCACHED_SET_MEMORY_ALLOCATORS_CONTEXT" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SET_MEMORY_ALLOCATORS_CONTEXT" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_set_memory_allocators_context \- libmemcached Documentation
.
-.TH "MEMCACHED_SET_SASL_CALLBACKS" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SET_SASL_CALLBACKS" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_set_sasl_callbacks \- libmemcached Documentation
.
-.TH "MEMCACHED_SET_USER_DATA" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_SET_USER_DATA" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_set_user_data \- libmemcached Documentation
.
-.TH "MEMCACHED_STAT" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_STAT" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_stat \- libmemcached Documentation
.
-.TH "MEMCACHED_STAT_EXECUTE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_STAT_EXECUTE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_stat_execute \- libmemcached Documentation
.
-.TH "MEMCACHED_STAT_GET_KEYS" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_STAT_GET_KEYS" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_stat_get_keys \- libmemcached Documentation
.
-.TH "MEMCACHED_STAT_GET_VALUE" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_STAT_GET_VALUE" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_stat_get_value \- libmemcached Documentation
.
-.TH "MEMCACHED_STAT_SERVERNAME" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_STAT_SERVERNAME" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_stat_servername \- libmemcached Documentation
.
-.TH "MEMCACHED_STATS" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_STATS" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_stats \- libmemcached Documentation
.
-.TH "MEMCACHED_STRERROR" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_STRERROR" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_strerror \- libmemcached Documentation
.
-.TH "MEMCACHED_TOUCH" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_TOUCH" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_touch \- libmemcached Documentation
.
-.TH "MEMCACHED_TOUCH_BY_KEY" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_TOUCH_BY_KEY" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_touch_by_key \- libmemcached Documentation
.
-.TH "MEMCACHED_USER_DATA" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_USER_DATA" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_user_data \- libmemcached Documentation
.
-.TH "MEMCACHED_VERBOSITY" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_VERBOSITY" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_verbosity \- libmemcached Documentation
.
-.TH "MEMCACHED_VERSION" "3" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCACHED_VERSION" "3" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcached_version \- libmemcached Documentation
.
-.TH "MEMCAPABLE" "1" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCAPABLE" "1" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcapable \- libmemcached Documentation
.
-.TH "MEMCAT" "1" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCAT" "1" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcat \- libmemcached Documentation
.
-.TH "MEMCP" "1" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMCP" "1" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memcp \- libmemcached Documentation
.
-.TH "MEMDUMP" "1" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMDUMP" "1" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memdump \- libmemcached Documentation
.
-.TH "MEMERROR" "1" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMERROR" "1" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memerror \- libmemcached Documentation
.
-.TH "MEMFLUSH" "1" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMFLUSH" "1" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memflush \- libmemcached Documentation
.
-.TH "MEMRM" "1" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMRM" "1" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memrm \- libmemcached Documentation
.
-.TH "MEMSLAP" "1" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMSLAP" "1" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memslap \- libmemcached Documentation
.
-.TH "MEMSTAT" "1" "March 23, 2012" "1.0.5" "libmemcached"
+.TH "MEMSTAT" "1" "April 02, 2012" "1.0.5" "libmemcached"
.SH NAME
memstat \- libmemcached Documentation
.
struct {
uint32_t read;
uint32_t write;
+ uint32_t timeouts;
} io_wait_count;
uint8_t major_version; // Default definition of UINT8_MAX means that it has not been set.
uint8_t micro_version; // ditto
}
case 0:
{
+ server->io_wait_count.timeouts++;
return memcached_set_error(*server, MEMCACHED_TIMEOUT, MEMCACHED_AT);
}
}
else
{
- return memcached_set_error(*instance, vdo_rc, MEMCACHED_AT);
+ return vdo_rc;
}
}
else
{
// IO error of some sort must have occurred
- return memcached_set_error(*instance, response_rc, MEMCACHED_AT);
+ return response_rc;
}
}
}
{
error= (*cb.callback[x])(ptr->root, &root->result, cb.context);
if (error != MEMCACHED_SUCCESS)
+ {
break;
+ }
}
/* @todo what should I do with the error message??? */
static memcached_return_t io_wait(memcached_server_write_instance_st ptr,
const memc_read_or_write read_or_write)
{
- struct pollfd fds;
- fds.fd= ptr->fd;
- fds.events= POLLIN;
-
- if (read_or_write == MEM_WRITE) /* write */
- {
- fds.events= POLLOUT;
- WATCHPOINT_SET(ptr->io_wait_count.write++);
- }
- else
- {
- WATCHPOINT_SET(ptr->io_wait_count.read++);
- }
-
/*
** We are going to block on write, but at least on Solaris we might block
** on write if we haven't read anything from our input buffer..
}
}
+ struct pollfd fds;
+ memset(&fds, 0, sizeof(pollfd));
+ fds.fd= ptr->fd;
+ fds.events= POLLIN;
+
+ if (read_or_write == MEM_WRITE) /* write */
+ {
+ fds.events= POLLOUT;
+ ptr->io_wait_count.write++;
+ }
+ else
+ {
+ ptr->io_wait_count.read++;
+ }
+
if (ptr->root->poll_timeout == 0) // Mimic 0 causes timeout behavior (not all platforms do this)
{
return memcached_set_error(*ptr, MEMCACHED_TIMEOUT, MEMCACHED_AT);
size_t loop_max= 5;
while (--loop_max) // While loop is for ERESTART or EINTR
{
+ int active_fd= poll(&fds, 1, ptr->root->poll_timeout);
+ assert_msg(active_fd <= 1 , "poll() returned an unexpected value");
- int error= poll(&fds, 1, ptr->root->poll_timeout);
- switch (error)
+ if (active_fd == 1)
{
- case 1: // Success!
- WATCHPOINT_IF_LABELED_NUMBER(read_or_write && loop_max < 4, "read() times we had to loop, decremented down from 5", loop_max);
- WATCHPOINT_IF_LABELED_NUMBER(!read_or_write && loop_max < 4, "write() times we had to loop, decremented down from 5", loop_max);
-
return MEMCACHED_SUCCESS;
-
- case 0: // Timeout occured, we let the while() loop do its thing.
+ }
+ else if (active_fd == 0)
+ {
+ ptr->io_wait_count.timeouts++;
return memcached_set_error(*ptr, MEMCACHED_TIMEOUT, MEMCACHED_AT);
-
- default:
- WATCHPOINT_ERRNO(get_socket_errno());
+ }
+ else // -1
+ {
switch (get_socket_errno())
{
#ifdef TARGET_OS_LINUX
return memcached_set_error(*ptr, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT, memcached_literal_param("RLIMIT_NOFILE exceeded, or if OSX the timeout value was invalid"));
default:
+ int local_errno= get_socket_errno(); // We cache in case memcached_quit_server() modifies errno
if (fds.revents & POLLERR)
{
int err;
socklen_t len= sizeof (err);
if (getsockopt(ptr->fd, SOL_SOCKET, SO_ERROR, &err, &len) == 0)
{
- if (err == 0)
+ if (err == 0) // treat this as EINTR
{
continue;
}
- errno= err;
+ local_errno= err;
}
}
- else
- {
- memcached_set_errno(*ptr, get_socket_errno(), MEMCACHED_AT);
- }
- int local_errno= get_socket_errno(); // We cache in case memcached_quit_server() modifies errno
memcached_quit_server(ptr, true);
return memcached_set_errno(*ptr, local_errno, MEMCACHED_AT);
}
else if (rc == MEMCACHED_TIMEOUT)
{
+ ptr->io_wait_count.timeouts++;
error= memcached_set_error(*ptr, MEMCACHED_TIMEOUT, MEMCACHED_AT);
return false;
}
while (length)
{
- if (not ptr->read_buffer_length)
+ if (ptr->read_buffer_length == 0)
{
ssize_t data_read;
do
#ifdef TARGET_OS_LINUX
case ERESTART:
#endif
- if (memcached_success(io_wait(ptr, MEM_READ)))
{
- continue;
+ memcached_return_t io_wait_ret;
+ if (memcached_success(io_wait_ret= io_wait(ptr, MEM_READ)))
+ {
+ continue;
+ }
+
+ return io_wait_ret;
}
- return MEMCACHED_IN_PROGRESS;
/* fall through */
}
}
- return (ssize_t) original_length;
+ return ssize_t(original_length);
}
bool memcached_io_write(memcached_server_write_instance_st ptr)
rc= memcached_vdo(ptr, vector, 1, true);
}
- WATCHPOINT_ASSERT(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_FETCH_NOTFINISHED);
-
/* read until socket is closed, or there is an error
* closing the socket before all data is read
* results in server throwing away all data which is
* In .40 we began to only do this if we had been doing buffered
* requests of had replication enabled.
*/
- if (ptr->root->flags.buffer_requests or ptr->root->number_of_replicas)
+ if (memcached_success(rc) and (ptr->root->flags.buffer_requests or ptr->root->number_of_replicas))
{
- memcached_return_t rc_slurp;
- while (memcached_continue(rc_slurp= memcached_io_slurp(ptr))) {} ;
- WATCHPOINT_ASSERT(rc_slurp == MEMCACHED_CONNECTION_FAILURE);
+ if (0)
+ {
+ memcached_return_t rc_slurp;
+ while (memcached_continue(rc_slurp= memcached_io_slurp(ptr))) {} ;
+ WATCHPOINT_ASSERT(rc_slurp == MEMCACHED_CONNECTION_FAILURE);
+ }
+ else
+ {
+ memcached_io_slurp(ptr);
+ }
}
/*
self->server_failure_counter= 0;
self->server_failure_counter_query_id= 0;
self->weight= weight ? weight : 1; // 1 is the default weight value
- WATCHPOINT_SET(self->io_wait_count.read= 0);
- WATCHPOINT_SET(self->io_wait_count.write= 0);
+ self->io_wait_count.read= 0;
+ self->io_wait_count.write= 0;
+ self->io_wait_count.timeouts= 0;
self->major_version= UINT8_MAX;
self->micro_version= UINT8_MAX;
self->minor_version= UINT8_MAX;
memcached_server_instance_st memcached_server_get_last_disconnect(const memcached_st *self)
{
WATCHPOINT_ASSERT(self);
- if (not self)
+ if (self == NULL)
+ {
return 0;
+ }
return self->last_disconnected_server;
}
uint32_t memcached_servers_set_count(memcached_server_st *servers, uint32_t count)
{
WATCHPOINT_ASSERT(servers);
- if (not servers)
+ if (servers == NULL)
+ {
return 0;
+ }
return servers->number_of_hosts= count;
}
uint32_t memcached_server_count(const memcached_st *self)
{
WATCHPOINT_ASSERT(self);
- if (not self)
+ if (self == NULL)
return 0;
return self->number_of_hosts;
const char *memcached_server_name(const memcached_server_instance_st self)
{
WATCHPOINT_ASSERT(self);
- if (not self)
+ if (self == NULL)
return NULL;
return self->hostname;
in_port_t memcached_server_port(const memcached_server_instance_st self)
{
WATCHPOINT_ASSERT(self);
- if (not self)
+ if (self == NULL)
return 0;
return self->port;
uint32_t memcached_server_response_count(const memcached_server_instance_st self)
{
WATCHPOINT_ASSERT(self);
- if (not self)
+ if (self == NULL)
return 0;
return self->cursor_active;
{
memcached_io_reset(server);
+#if 0
if (memcached_has_error(ptr))
{
memcached_set_error(*server, rc, MEMCACHED_AT);
}
+#endif
return MEMCACHED_WRITE_FAILURE;
}
}
assert(memcached_failed(rc));
+#if 0
if (memcached_has_error(ptr) == false)
{
return memcached_set_error(*ptr, rc, MEMCACHED_AT);
}
+#endif
return rc;
}
key, key_length, value, value_length,
expiration, flags, 0, ADD_OP);
- if (rc == MEMCACHED_NOTSTORED or rc == MEMCACHED_DATA_EXISTS)
- {
- memcached_set_error(*ptr, rc, MEMCACHED_AT);
- }
LIBMEMCACHED_MEMCACHED_ADD_END();
return rc;
}
private:
public:
BlobslapWorker(in_port_t port_arg) :
- Server("localhost", port_arg)
+ Server("localhost", port_arg, "benchmark/blobslap_worker", true)
{
set_pid_file();
}
return "blobslap_worker";
};
- const char *executable()
- {
- return "benchmark/blobslap_worker";
- }
-
- const char *daemon_file_option()
- {
- return "--daemon";
- }
-
bool has_port_option() const
{
return true;
#include <fcntl.h>
#include <fstream>
#include <memory>
+#include <poll.h>
#include <spawn.h>
#include <sstream>
#include <string>
_use_gdb(false),
_argc(0),
_exectuble(arg),
+ stdin_fd(STDIN_FILENO),
+ stdout_fd(STDOUT_FILENO),
+ stderr_fd(STDERR_FILENO),
built_argv(NULL),
_pid(-1)
{
{
if (libtool() == NULL)
{
- throw "libtool requested, but know libtool was found";
+ fatal_message("libtool requested, but know libtool was found");
}
}
Application::~Application()
{
+ murder();
delete_argv();
}
posix_spawn_file_actions_t file_actions;
posix_spawn_file_actions_init(&file_actions);
- stdin_fd.dup_for_spawn(Application::Pipe::READ, file_actions, STDIN_FILENO);
- stdout_fd.dup_for_spawn(Application::Pipe::WRITE, file_actions, STDOUT_FILENO);
- stderr_fd.dup_for_spawn(Application::Pipe::WRITE, file_actions, STDERR_FILENO);
+ stdin_fd.dup_for_spawn(Application::Pipe::READ, file_actions);
+ stdout_fd.dup_for_spawn(Application::Pipe::WRITE, file_actions);
+ stderr_fd.dup_for_spawn(Application::Pipe::WRITE, file_actions);
+
+ posix_spawnattr_t spawnattr;
+ posix_spawnattr_init(&spawnattr);
+
+ sigset_t set;
+ sigemptyset(&set);
+ fatal_assert(posix_spawnattr_setsigmask(&spawnattr, &set) == 0);
create_argv(args);
const_cast<char *>(_exectuble_with_path.c_str()),
0};
- spawn_ret= posix_spawnp(&_pid, libtool(), &file_actions, NULL, argv, NULL);
+ spawn_ret= posix_spawnp(&_pid, libtool(), &file_actions, &spawnattr, argv, NULL);
}
else
{
const_cast<char *>(gdb_run_file.c_str()),
const_cast<char *>(_exectuble_with_path.c_str()),
0};
- spawn_ret= posix_spawnp(&_pid, "gdb", &file_actions, NULL, argv, NULL);
+ spawn_ret= posix_spawnp(&_pid, "gdb", &file_actions, &spawnattr, argv, NULL);
}
}
else
{
if (_use_libtool)
{
- spawn_ret= posix_spawn(&_pid, built_argv[0], &file_actions, NULL, built_argv, NULL);
+ spawn_ret= posix_spawn(&_pid, built_argv[0], &file_actions, &spawnattr, built_argv, NULL);
}
else
{
- spawn_ret= posix_spawnp(&_pid, built_argv[0], &file_actions, NULL, built_argv, NULL);
+ spawn_ret= posix_spawnp(&_pid, built_argv[0], &file_actions, &spawnattr, built_argv, NULL);
}
}
posix_spawn_file_actions_destroy(&file_actions);
+ posix_spawnattr_destroy(&spawnattr);
stdin_fd.close(Application::Pipe::READ);
stdout_fd.close(Application::Pipe::WRITE);
if (spawn_ret)
{
+ _pid= -1;
return Application::INVALID;
}
return Application::SUCCESS;
}
-Application::error_t Application::wait()
+bool Application::check() const
{
- if (_pid == -1)
+ if (_pid > 1 and kill(_pid, 0) == 0)
{
- Error << "wait() got an invalid pid_t";
- return Application::INVALID;
+ return true;
}
+ return false;
+}
+
+void Application::murder()
+{
+ if (check())
{
- ssize_t read_length;
- char buffer[1024]= { 0 };
- bool bail= false;
- while (((read_length= ::read(stdout_fd.fd()[0], buffer, sizeof(buffer))) != 0) or bail)
+ int count= 5;
+ while ((count--) > 0 and check())
{
- if (read_length == -1)
+ int kill_ret= kill(_pid, SIGTERM);
+ if (kill_ret == 0)
{
- switch(errno)
+ int status= 0;
+ pid_t waitpid_ret;
+ if ((waitpid_ret= waitpid(_pid, &status, WNOHANG)) == -1)
{
- case EAGAIN:
- continue;
+ switch (errno)
+ {
+ case ECHILD:
+ case EINTR:
+ break;
+
+ default:
+ Error << "waitpid() failed after kill with error of " << strerror(errno);
+ break;
+ }
+ }
- default:
- Error << strerror(errno);
- bail= true;
+ if (waitpid_ret == 0)
+ {
+ libtest::dream(1, 0);
}
}
- _stdout_buffer.reserve(read_length +1);
- for (size_t x= 0; x < read_length; x++)
+ else
{
- _stdout_buffer.push_back(buffer[x]);
+ Error << "kill(pid, SIGTERM) failed after kill with error of " << strerror(errno);
+ continue;
}
- // @todo Suck up all output code here
+
+ break;
+ }
+
+ // If for whatever reason it lives, kill it hard
+ if (check())
+ {
+ (void)kill(_pid, SIGKILL);
}
}
+ slurp();
+}
+// false means that no data was returned
+bool Application::slurp()
+{
+ struct pollfd fds[2];
+ fds[0].fd= stdout_fd.fd();
+ fds[0].events= POLLRDNORM;
+ fds[0].revents= 0;
+ fds[1].fd= stderr_fd.fd();
+ fds[1].events= POLLRDNORM;
+ fds[1].revents= 0;
+
+ int active_fd;
+ if ((active_fd= poll(fds, 2, 0)) == -1)
{
- ssize_t read_length;
- char buffer[1024]= { 0 };
- bool bail= false;
- while (((read_length= ::read(stderr_fd.fd()[0], buffer, sizeof(buffer))) != 0) or bail)
+ int error;
+ switch ((error= errno))
{
- if (read_length == -1)
- {
- switch(errno)
- {
- case EAGAIN:
- continue;
+#ifdef TARGET_OS_LINUX
+ case ERESTART:
+#endif
+ case EINTR:
+ break;
- default:
- Error << strerror(errno);
- bail= true;
- }
- }
- _stderr_buffer.reserve(read_length +1);
- for (size_t x= 0; x < read_length; x++)
- {
- _stderr_buffer.push_back(buffer[x]);
- }
- // @todo Suck up all errput code here
+ case EFAULT:
+ case ENOMEM:
+ fatal_message(strerror(error));
+ break;
+
+ case EINVAL:
+ fatal_message("RLIMIT_NOFILE exceeded, or if OSX the timeout value was invalid");
+ break;
+
+ default:
+ fatal_message(strerror(error));
+ break;
}
+
+ return false;
+ }
+
+ if (active_fd == 0)
+ {
+ return false;
}
+ bool data_was_read= false;
+ if (fds[0].revents & POLLRDNORM)
+ {
+ if (stdout_fd.read(_stdout_buffer) == true)
+ {
+ data_was_read= true;
+ }
+ }
+
+ if (fds[1].revents & POLLRDNORM)
+ {
+ if (stderr_fd.read(_stderr_buffer) == true)
+ {
+ data_was_read= true;
+ }
+ }
+
+ return data_was_read;
+}
+
+Application::error_t Application::wait(bool nohang)
+{
+ if (_pid == -1)
+ {
+ return Application::INVALID;
+ }
+
+ slurp();
+
error_t exit_code= FAILURE;
{
int status= 0;
pid_t waited_pid;
- if ((waited_pid= waitpid(_pid, &status, 0)) == -1)
+ if ((waited_pid= waitpid(_pid, &status, nohang ? WNOHANG : 0)) == -1)
+ {
+ switch (errno)
+ {
+ case ECHILD:
+ exit_code= Application::SUCCESS;
+ break;
+
+ case EINTR:
+ break;
+
+ default:
+ Error << "Error occured while waitpid(" << strerror(errno) << ") on pid " << int(_pid);
+ break;
+ }
+ }
+ else if (waited_pid == 0)
{
- Error << "Error occured while waitpid(" << strerror(errno) << ") on pid " << int(_pid);
+ exit_code= Application::SUCCESS;
}
else
{
}
}
+ slurp();
+
#if 0
if (exit_code == Application::INVALID)
{
return exit_code;
}
+void Application::add_long_option(const std::string& name, const std::string& option_value)
+{
+ std::string arg(name);
+ arg+= option_value;
+ _options.push_back(std::make_pair(arg, std::string()));
+}
+
void Application::add_option(const std::string& arg)
{
_options.push_back(std::make_pair(arg, std::string()));
_options.push_back(std::make_pair(name, value));
}
-Application::Pipe::Pipe()
+Application::Pipe::Pipe(int arg) :
+ _std_fd(arg)
+{
+ _pipe_fd[READ]= -1;
+ _pipe_fd[WRITE]= -1;
+ _open[READ]= false;
+ _open[WRITE]= false;
+}
+
+int Application::Pipe::Pipe::fd()
{
- _fd[0]= -1;
- _fd[1]= -1;
- _open[0]= false;
- _open[1]= false;
+ if (_std_fd == STDOUT_FILENO)
+ {
+ return _pipe_fd[READ];
+ }
+ else if (_std_fd == STDERR_FILENO)
+ {
+ return _pipe_fd[READ];
+ }
+
+ return _pipe_fd[WRITE]; // STDIN_FILENO
+}
+
+
+bool Application::Pipe::read(libtest::vchar_t& arg)
+{
+ fatal_assert(_std_fd == STDOUT_FILENO or _std_fd == STDERR_FILENO);
+
+ bool data_was_read= false;
+
+ ssize_t read_length;
+ char buffer[1024]= { 0 };
+ while ((read_length= ::read(_pipe_fd[READ], buffer, sizeof(buffer))))
+ {
+ if (read_length == -1)
+ {
+ switch(errno)
+ {
+ case EAGAIN:
+ break;
+
+ default:
+ Error << strerror(errno);
+ break;
+ }
+
+ break;
+ }
+
+ data_was_read= true;
+ arg.reserve(read_length +1);
+ for (size_t x= 0; x < read_length; x++)
+ {
+ arg.push_back(buffer[x]);
+ }
+ // @todo Suck up all errput code here
+ }
+
+ return data_was_read;
+}
+
+void Application::Pipe::nonblock()
+{
+ int ret;
+ if ((ret= fcntl(_pipe_fd[READ], F_GETFL, 0)) == -1)
+ {
+ Error << "fcntl(F_GETFL) " << strerror(errno);
+ throw strerror(errno);
+ }
+
+ if ((ret= fcntl(_pipe_fd[READ], F_SETFL, ret | O_NONBLOCK)) == -1)
+ {
+ Error << "fcntl(F_SETFL) " << strerror(errno);
+ throw strerror(errno);
+ }
}
void Application::Pipe::reset()
close(READ);
close(WRITE);
- int ret;
- if (pipe(_fd) == -1)
+#if _GNU_SOURCE
+ if (pipe2(_pipe_fd, O_NONBLOCK) == -1)
+#else
+ if (pipe(_pipe_fd) == -1)
+#endif
{
- throw strerror(errno);
+ fatal_message(strerror(errno));
}
_open[0]= true;
_open[1]= true;
+ if (true)
{
- if ((ret= fcntl(_fd[0], F_GETFL, 0)) == -1)
- {
- Error << "fcntl(F_GETFL) " << strerror(errno);
- throw strerror(errno);
- }
+ nonblock();
+ cloexec();
+ }
+}
- if ((ret= fcntl(_fd[0], F_SETFL, ret | O_NONBLOCK)) == -1)
- {
- Error << "fcntl(F_SETFL) " << strerror(errno);
- throw strerror(errno);
- }
+void Application::Pipe::cloexec()
+{
+ int ret;
+ if ((ret= fcntl(_pipe_fd[WRITE], F_GETFD, 0)) == -1)
+ {
+ Error << "fcntl(F_GETFD) " << strerror(errno);
+ throw strerror(errno);
+ }
+
+ if ((ret= fcntl(_pipe_fd[WRITE], F_SETFD, ret | FD_CLOEXEC)) == -1)
+ {
+ Error << "fcntl(F_SETFD) " << strerror(errno);
+ throw strerror(errno);
}
}
close(WRITE);
}
-void Application::Pipe::dup_for_spawn(const close_t& arg, posix_spawn_file_actions_t& file_actions, const int newfildes)
+void Application::Pipe::dup_for_spawn(const close_t& arg, posix_spawn_file_actions_t& file_actions)
{
int type= int(arg);
int ret;
- if ((ret= posix_spawn_file_actions_adddup2(&file_actions, _fd[type], newfildes )) < 0)
+ if ((ret= posix_spawn_file_actions_adddup2(&file_actions, _pipe_fd[type], _std_fd )) < 0)
{
Error << "posix_spawn_file_actions_adddup2(" << strerror(ret) << ")";
- throw strerror(ret);
+ fatal_message(strerror(ret));
}
- if ((ret= posix_spawn_file_actions_addclose(&file_actions, _fd[type])) < 0)
+ if ((ret= posix_spawn_file_actions_addclose(&file_actions, _pipe_fd[type])) < 0)
{
Error << "posix_spawn_file_actions_adddup2(" << strerror(ret) << ")";
- throw strerror(ret);
+ fatal_message(strerror(ret));
}
}
if (_open[type])
{
int ret;
- if (::close(_fd[type]) == -1)
+ if (::close(_pipe_fd[type]) == -1)
{
Error << "close(" << strerror(errno) << ")";
}
_open[type]= false;
- _fd[type]= -1;
+ _pipe_fd[type]= -1;
}
}
void Application::create_argv(const char *args[])
{
- _argc= 2 +_use_libtool ? 2 : 0; // +1 for the command, +2 for libtool/mode=execute, +1 for the NULL
+ delete_argv();
+ fatal_assert(_argc == 0);
if (_use_libtool)
{
_argc+= 2; // +2 for libtool --mode=execute
}
+ _argc+= 1; // For the command
+
/*
valgrind --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
*/
}
}
- delete_argv();
+ _argc+= 1; // for the NULL
+
built_argv= new char * [_argc];
size_t x= 0;
built_argv[x++]= strdup(*ptr);
}
}
- built_argv[_argc -1]= NULL;
+ built_argv[x++]= NULL;
+ fatal_assert(x == _argc);
}
std::string Application::print()
return int(ret);
}
- return int(app.wait());
+ return int(app.wait(false));
}
const char *gearmand_binary()
class Pipe {
public:
- Pipe();
+ Pipe(int);
~Pipe();
- int* fd()
- {
- return _fd;
- }
+ int fd();
enum close_t {
- READ,
- WRITE
+ READ= 0,
+ WRITE= 1
};
void reset();
void close(const close_t& arg);
void dup_for_spawn(const close_t& arg,
- posix_spawn_file_actions_t& file_actions,
- const int newfildes);
+ posix_spawn_file_actions_t& file_actions);
+
+ void nonblock();
+ void cloexec();
+ bool read(libtest::vchar_t&);
private:
- int _fd[2];
+ const int _std_fd;
+ int _pipe_fd[2];
bool _open[2];
};
void add_option(const std::string&);
void add_option(const std::string&, const std::string&);
+ void add_long_option(const std::string& option_name, const std::string& option_value);
error_t run(const char *args[]= NULL);
- error_t wait();
+ error_t wait(bool nohang= true);
libtest::vchar_t stdout_result() const
{
_use_valgrind= arg;
}
+ bool check() const;
+
+ bool slurp();
+ void murder();
+
void use_gdb(bool arg= true)
{
_use_gdb= arg;
return _gdb_filename;
}
+ pid_t pid() const
+ {
+ return _pid;
+ }
+
private:
void create_argv(const char *args[]);
void delete_argv();
namespace libtest {
-bool _in_valgrind(const char*, int, const char*)
+bool valgrind_is_caller(void)
{
if (bool(getenv("TESTS_ENVIRONMENT")) and strstr(getenv("TESTS_ENVIRONMENT"), "valgrind"))
{
return true;
}
- return TEST_SUCCESS;
+ return false;
+}
+
+bool gdb_is_caller(void)
+{
+ if (bool(getenv("TESTS_ENVIRONMENT")) and strstr(getenv("TESTS_ENVIRONMENT"), "gdb"))
+ {
+ return true;
+ }
+
+ return false;
+}
+
+bool helgrind_is_caller(void)
+{
+ if (bool(getenv("TESTS_ENVIRONMENT")) and strstr(getenv("TESTS_ENVIRONMENT"), "helgrind"))
+ {
+ return true;
+ }
+
+ return false;
+}
+
+bool _in_valgrind(const char*, int, const char*)
+{
+ if (valgrind_is_caller())
+ {
+ return true;
+ }
+
+ return false;
}
} // namespace libtest
namespace libtest {
+LIBTEST_API
+bool gdb_is_caller(void);
+
+LIBTEST_API
+bool valgrind_is_caller(void);
+
+LIBTEST_API
bool _in_valgrind(const char *file, int line, const char *func);
template <class T_comparable, class T_hint>
void create_core(void)
{
+#ifdef TARGET_OS_OSX
+ return;
+#endif
if (getenv("LIBMEMCACHED_NO_COREDUMP") == NULL)
{
pid_t pid= fork();
} // namespace libtest
-#define fatal_message(__mesg) libtest::fatal(LIBYATL_DEFAULT_PARAM, __mesg)
-#define fatal_assert(__assert) if((__assert)) {} else { libtest::fatal(LIBYATL_DEFAULT_PARAM, #__assert); }
+#define fatal_message(__mesg) throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "%s", __mesg)
+#define fatal_assert(__assert) if((__assert)) {} else { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "%s", #__assert); }
libtest::Runner *Framework::runner()
{
- return _runner ? _runner : &defualt_runners;
+ if (_runner == NULL)
+ {
+ _runner= &defualt_runners;
+ }
+ _runner->set_servers(_servers);
+
+ return _runner;
}
void* Framework::create(test_return_t& arg)
libtest::server_startup_st _servers;
bool _socket;
void *_creators_ptr;
+ unsigned long int _servers_to_run;
};
private:
public:
Gearmand(const std::string& host_arg, in_port_t port_arg) :
- libtest::Server(host_arg, port_arg)
+ libtest::Server(host_arg, port_arg, GEARMAND_BINARY, true)
{
set_pid_file();
}
- pid_t get_pid(bool error_is_ok)
- {
- if (pid_file().empty() == false)
- {
- Wait wait(pid_file(), 0);
-
- if (error_is_ok and not wait.successful())
- {
- Error << "Pidfile was not found:" << pid_file();
- return -1;
- }
- }
-
- GetPid *get_instance_pid;
- util::Instance instance(hostname(), port());
- instance.set_finish(get_instance_pid= new GetPid);
-
- instance.push(new util::Operation(test_literal_param("getpid\r\n"), true));
-
- if (error_is_ok and instance.run() == false)
- {
- Error << "Failed to obtain pid of server";
- }
-
- return get_instance_pid->pid();
- }
-
bool ping()
{
gearman_client_st *client= gearman_client_create(NULL);
return "gearmand";
};
- const char *executable()
- {
- return GEARMAND_BINARY;
- }
-
- const char *daemon_file_option()
- {
- return "--daemon";
- }
-
void log_file_option(Application& app, const std::string& arg)
{
if (arg.empty() == false)
using namespace libtest;
+namespace {
+ bool is_memcached_libtool()
+ {
+ if (MEMCACHED_BINARY and strcmp(MEMCACHED_BINARY, "memcached/memcached") == 0)
+ {
+ return true;
+ }
+
+ return false;
+ }
+}
+
class Memcached : public libtest::Server
{
std::string _username;
const bool is_socket_arg,
const std::string& username_arg,
const std::string& password_arg) :
- libtest::Server(host_arg, port_arg, is_socket_arg),
+ libtest::Server(host_arg, port_arg,
+ MEMCACHED_BINARY, is_memcached_libtool(), is_socket_arg),
_username(username_arg),
_password(password_arg)
{ }
Memcached(const std::string& host_arg, const in_port_t port_arg, const bool is_socket_arg) :
- libtest::Server(host_arg, port_arg, is_socket_arg)
+ libtest::Server(host_arg, port_arg,
+ MEMCACHED_BINARY, is_memcached_libtool(), is_socket_arg)
{
set_pid_file();
}
return _username;
}
- pid_t get_pid(bool error_is_ok)
+ bool wait_for_pidfile() const
{
- // Memcached is slow to start, so we need to do this
- if (pid_file().empty() == false)
- {
- if (error_is_ok and
- wait_for_pidfile() == false)
- {
- Error << "Pidfile was not found:" << pid_file();
- return -1;
- }
- }
-
- pid_t local_pid;
- memcached_return_t rc= MEMCACHED_SUCCESS;
- if (has_socket())
- {
- if (socket().empty())
- {
- return -1;
- }
+ Wait wait(pid(), 4);
- local_pid= libmemcached_util_getpid(socket().c_str(), port(), &rc);
- }
- else
- {
- local_pid= libmemcached_util_getpid(hostname().c_str(), port(), &rc);
- }
-
- if (error_is_ok and ((memcached_failed(rc) or not is_pid_valid(local_pid))))
- {
- Error << "libmemcached_util_getpid(" << memcached_strerror(NULL, rc) << ") pid: " << local_pid << " for:" << *this;
- }
-
- return local_pid;
+ return wait.successful();
}
bool ping()
{
+#if 0
// Memcached is slow to start, so we need to do this
if (pid_file().empty() == false)
{
if (wait_for_pidfile() == false)
{
- Error << "Pidfile was not found:" << pid_file();
+ Error << "Pidfile was not found:" << pid_file() << " :" << running();
return -1;
}
}
+#endif
memcached_return_t rc;
bool ret;
bool is_libtool()
{
- if (MEMCACHED_BINARY and strcmp(MEMCACHED_BINARY, "memcached/memcached") == 0)
- {
- return true;
- }
-
- return false;
+ return is_memcached_libtool();
}
virtual void pid_file_option(Application& app, const std::string& arg)
return "-s ";
}
- const char *daemon_file_option()
- {
- return "-d";
- }
-
virtual void port_option(Application& app, in_port_t arg)
{
char buffer[30];
{
public:
- MemcachedLight(const std::string& host_arg, const in_port_t port_arg):
- libtest::Server(host_arg, port_arg)
+ MemcachedLight(const std::string& host_arg, const in_port_t port_arg) :
+ libtest::Server(host_arg, port_arg, MEMCACHED_LIGHT_BINARY, true)
{
set_pid_file();
}
- pid_t get_pid(bool error_is_ok)
- {
- // Memcached is slow to start, so we need to do this
- if (pid_file().empty() == false)
- {
- if (error_is_ok and wait_for_pidfile() == false)
- {
- Error << "Pidfile was not found:" << pid_file();
- return -1;
- }
- }
-
- bool success= false;
- std::stringstream error_message;
- pid_t local_pid= get_pid_from_file(pid_file(), error_message);
- if (local_pid > 0)
- {
- if (::kill(local_pid, 0) > 0)
- {
- success= true;
- }
- }
-
- if (error_is_ok and ((success or not is_pid_valid(local_pid))))
- {
- Error << "kill(" << " pid: " << local_pid << " errno:" << strerror(errno) << " for:" << *this;
- }
-
- return local_pid;
- }
-
bool ping()
{
// Memcached is slow to start, so we need to do this
return MEMCACHED_LIGHT_BINARY;
}
- const char *daemon_file_option()
- {
- return "--daemon";
- }
-
virtual void port_option(Application& app, in_port_t arg)
{
char buffer[1024];
return MEMCACHED_SASL_BINARY;
}
- pid_t get_pid(bool error_is_ok)
- {
- // Memcached is slow to start, so we need to do this
- if (pid_file().empty() == false)
- {
- if (error_is_ok and
- wait_for_pidfile() == false)
- {
- Error << "Pidfile was not found:" << pid_file();
- return -1;
- }
- }
-
- pid_t local_pid;
- memcached_return_t rc;
- if (has_socket())
- {
- local_pid= libmemcached_util_getpid2(socket().c_str(), 0, username().c_str(), password().c_str(), &rc);
- }
- else
- {
- local_pid= libmemcached_util_getpid2(hostname().c_str(), port(), username().c_str(), password().c_str(), &rc);
- }
-
- if (error_is_ok and ((memcached_failed(rc) or not is_pid_valid(local_pid))))
- {
- Error << "libmemcached_util_getpid2(" << memcached_strerror(NULL, rc) << ") username: " << username() << " password: " << password() << " pid: " << local_pid << " for:" << *this;
- }
-
- return local_pid;
- }
-
bool ping()
{
// Memcached is slow to start, so we need to do this
- if (not pid_file().empty())
+ if (pid_file().empty() == false)
{
- if (not wait_for_pidfile())
+ if (wait_for_pidfile() == false)
{
Error << "Pidfile was not found:" << pid_file();
return -1;
ret= libmemcached_util_ping2(hostname().c_str(), port(), username().c_str(), password().c_str(), &rc);
}
- if (memcached_failed(rc) or not ret)
+ if (memcached_failed(rc) or ret == false)
{
Error << "libmemcached_util_ping2(" << hostname() << ", " << port() << ", " << username() << ", " << password() << ") error: " << memcached_strerror(NULL, rc);
}
// We handle the case where if we max out retries, we still abort.
if (ret_port <= 1024)
{
- throw fatal_message("No port could be found");
+ fatal_message("No port could be found");
}
return ret_port;
set environment LIBTEST_IN_GDB=1
run
thread apply all bt
-quit
Runner();
+ void set_servers(libtest::server_startup_st& arg)
+ {
+ _servers= &arg;
+ }
+
+ bool check()
+ {
+ return _servers ? _servers->check() : true;
+ }
+
virtual ~Runner() { }
+
+private:
+ libtest::server_startup_st* _servers;
};
} // namespace Runner
#define MAGIC_MEMORY 123570
-Server::Server(const std::string& host_arg, const in_port_t port_arg, bool is_socket_arg) :
+Server::Server(const std::string& host_arg, const in_port_t port_arg,
+ const std::string& executable, const bool _is_libtool,
+ bool is_socket_arg) :
_magic(MAGIC_MEMORY),
_is_socket(is_socket_arg),
- _pid(-1),
_port(port_arg),
- _hostname(host_arg)
+ _hostname(host_arg),
+ _app(executable, _is_libtool)
{
}
Server::~Server()
{
- if (has_pid() and not kill(_pid))
- {
- Error << "Unable to kill:" << *this;
- }
+}
+
+bool Server::check()
+{
+ _app.slurp();
+ _app.check();
+ return true;
}
bool Server::validate()
uint32_t limit= 3;
// Try to ping, and kill the server #limit number of times
- pid_t current_pid;
while (--limit and
- is_pid_valid(current_pid= get_pid()))
+ is_pid_valid(_app.pid()))
{
- if (kill(current_pid))
+ if (kill())
{
- Log << "Killed existing server," << *this << " with pid:" << current_pid;
+ Log << "Killed existing server," << *this;
dream(0, 50000);
continue;
}
// For whatever reason we could not kill it, and we reached limit
if (limit == 0)
{
- Error << "Reached limit, could not kill server pid:" << current_pid;
+ Error << "Reached limit, could not kill server";
return false;
}
return wait.successful();
}
+bool Server::has_pid() const
+{
+ return (_app.pid() > 1);
+}
+
+
bool Server::start()
{
// If we find that we already have a pid then kill it.
- if (has_pid() and kill(_pid) == false)
- {
- Error << "Could not kill() existing server during start() pid:" << _pid;
- return false;
- }
-
- if (has_pid() == false)
+ if (has_pid() == true)
{
fatal_message("has_pid() failed, programer error");
}
- Application app(executable(), is_libtool());
-
- if (is_debug())
+ // This needs more work.
+#if 0
+ if (gdb_is_caller())
{
- app.use_gdb();
+ _app.use_gdb();
}
- else if (getenv("TESTS_ENVIRONMENT"))
+#endif
+
+ if (getenv("YATL_VALGRIND_SERVER"))
{
- if (strstr(getenv("TESTS_ENVIRONMENT"), "gdb"))
- {
- app.use_gdb();
- }
+ _app.use_valgrind();
}
-
- if (args(app) == false)
+ else if (args(_app) == false)
{
Error << "Could not build command()";
return false;
}
Application::error_t ret;
- if (Application::SUCCESS != (ret= app.run()))
+ if (Application::SUCCESS != (ret= _app.run()))
{
Error << "Application::run() " << ret;
return false;
}
- _running= app.print();
-
- if (Application::SUCCESS != (ret= app.wait()))
- {
- Error << "Application::wait() " << _running << " " << ret;
- return false;
- }
+ _running= _app.print();
- if (is_valgrind())
+ if (valgrind_is_caller())
{
dream(5, 50000);
}
if (wait.successful() == false)
{
- libtest::fatal(LIBYATL_DEFAULT_PARAM,
- "Unable to open pidfile for: %s",
- _running.c_str());
+ throw libtest::fatal(LIBYATL_DEFAULT_PARAM,
+ "Unable to open pidfile for: %s",
+ _running.c_str());
}
}
+ uint32_t this_wait;
bool pinged= false;
{
uint32_t timeout= 20; // This number should be high enough for valgrind startup (which is slow)
uint32_t waited;
- uint32_t this_wait;
uint32_t retry;
for (waited= 0, retry= 1; ; retry++, waited+= this_wait)
{
if (kill_file(pid_file()) == false)
{
- fatal_message("Failed to kill off server after startup occurred, when pinging failed");
+ throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "Failed to kill off server after startup occurred, when pinging failed: %s", pid_file().c_str());
}
- Error << "Failed to ping() server started, having pid_file. exec:" << _running;
+ Error << "Failed to ping(), waited:" << this_wait
+ << " server started, having pid_file. exec:" << _running
+ << " error:" << _app.stderr_result();
}
else
{
return false;
}
- // A failing get_pid() at this point is considered an error
- _pid= get_pid(true);
-
return has_pid();
}
{
_running.clear();
_pid_file.clear();
- _pid= -1;
}
-pid_t Server::pid()
+pid_t Server::pid() const
{
- return _pid;
+ return _app.pid();
}
void Server::add_option(const std::string& arg)
int fd;
if ((fd= mkstemp(file_buffer)) == -1)
{
- libtest::fatal(LIBYATL_DEFAULT_PARAM, "mkstemp() failed on %s with %s", file_buffer, strerror(errno));
+ throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "mkstemp() failed on %s with %s", file_buffer, strerror(errno));
}
close(fd);
{
// Set a log file if it was requested (and we can)
- if (has_log_file_option())
+ if (false and has_log_file_option())
{
set_log_file();
log_file_option(app, _log_file);
pid_file_option(app, pid_file());
}
- assert(daemon_file_option());
- if (daemon_file_option() and not is_valgrind() and not is_helgrind())
- {
- app.add_option(daemon_file_option());
- }
-
if (has_socket_file_option())
{
if (set_socket_file() == false)
return true;
}
-bool Server::is_debug() const
-{
- return bool(getenv("LIBTEST_MANUAL_GDB"));
-}
-
-bool Server::is_valgrind() const
-{
- return bool(getenv("LIBTEST_MANUAL_VALGRIND"));
-}
-
-bool Server::is_helgrind() const
-{
- return bool(getenv("LIBTEST_MANUAL_HELGRIND"));
-}
-
-bool Server::kill(pid_t pid_arg)
+bool Server::kill()
{
- if (check_pid(pid_arg) and kill_pid(pid_arg)) // If we kill it, reset
+ if (check_pid(_app.pid())) // If we kill it, reset
{
+ _app.murder();
if (broken_pid_file() and pid_file().empty() == false)
{
unlink(pid_file().c_str());
std::string _log_file;
std::string _base_command; // executable command which include libtool, valgrind, gdb, etc
std::string _running; // Current string being used for system()
- pid_t _pid;
protected:
in_port_t _port;
std::string _extra_args;
public:
- Server(const std::string& hostname, const in_port_t port_arg, const bool is_socket_arg= false);
+ Server(const std::string& hostname, const in_port_t port_arg,
+ const std::string& executable, const bool _is_libtool,
+ const bool is_socket_arg= false);
virtual ~Server();
virtual const char *name()= 0;
- virtual const char *executable()= 0;
- virtual const char *daemon_file_option()= 0;
virtual bool is_libtool()= 0;
virtual bool has_socket_file_option() const
virtual bool ping()= 0;
- virtual pid_t get_pid(bool error_is_ok= false)= 0;
-
virtual bool build(size_t argc, const char *argv[])= 0;
void add_option(const std::string&);
// Reset a server if another process has killed the server
void reset()
{
- _pid= -1;
_pid_file.clear();
_log_file.clear();
}
bool args(Application&);
- pid_t pid();
+ pid_t pid() const;
- pid_t pid() const
- {
- return _pid;
- }
+ bool has_pid() const;
- bool has_pid() const
- {
- return (_pid > 1);
- }
-
- bool wait_for_pidfile() const;
+ virtual bool wait_for_pidfile() const;
bool check_pid(pid_t pid_arg) const
{
return _running;
}
+ bool check();
+
std::string log_and_pid();
- bool kill(pid_t pid_arg);
+ bool kill();
bool start();
bool command(libtest::Application& app);
protected:
bool set_pid_file();
Options _options;
+ Application _app;
private:
bool is_helgrind() const;
{
Server* tmp= servers[number_of_host];
- if (tmp and tmp->has_pid() and not tmp->kill(tmp->pid()))
+ if (tmp and tmp->has_pid() and tmp->kill() == false)
{ }
else
{
servers.clear();
}
-void server_startup_st::shutdown()
+bool server_startup_st::check() const
{
+ bool success= true;
+ for (std::vector<Server *>::const_iterator iter= servers.begin(); iter != servers.end(); iter++)
+ {
+ if ((*iter)->check() == false)
+ {
+ success= false;
+ }
+ }
+
+ return success;
+}
+
+bool server_startup_st::shutdown()
+{
+ bool success= true;
for (std::vector<Server *>::iterator iter= servers.begin(); iter != servers.end(); iter++)
{
- if ((*iter)->has_pid() and not (*iter)->kill((*iter)->pid()))
+ if ((*iter)->has_pid() and (*iter)->kill() == false)
{
Error << "Unable to kill:" << *(*iter);
+ success= false;
}
}
+
+ return success;
}
void server_startup_st::restart()
_magic(MAGIC_MEMORY),
_socket(false),
_sasl(false),
- _count(5),
- udp(0)
+ _count(0),
+ udp(0),
+ _servers_to_run(5)
{ }
server_startup_st::~server_startup_st()
return _magic == MAGIC_MEMORY;
}
-
-bool server_startup_st::is_debug() const
+bool server_startup(server_startup_st& construct, const std::string& server_type, in_port_t try_port, int argc, const char *argv[], const bool opt_startup_message)
{
- return bool(getenv("LIBTEST_MANUAL_GDB"));
-}
-
-bool server_startup_st::is_valgrind() const
-{
- return bool(getenv("LIBTEST_MANUAL_VALGRIND"));
-}
-
-bool server_startup_st::is_helgrind() const
-{
- return bool(getenv("LIBTEST_MANUAL_HELGRIND"));
-}
-
-
-bool server_startup(server_startup_st& construct, const std::string& server_type, in_port_t try_port, int argc, const char *argv[])
-{
- Outn();
if (try_port <= 0)
{
- libtest::fatal(LIBYATL_DEFAULT_PARAM, "was passed the invalid port number %d", int(try_port));
+ throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "was passed the invalid port number %d", int(try_port));
}
libtest::Server *server= NULL;
server->build(argc, argv);
- if (construct.is_debug())
+ if (gdb_is_caller() and false)
{
Out << "Pausing for startup, hit return when ready.";
std::string gdb_command= server->base_command();
}
else
{
- Out << "STARTING SERVER(pid:" << server->pid() << "): " << server->running();
+ if (opt_startup_message)
+ {
+ Outn();
+ Out << "STARTING SERVER(pid:" << server->pid() << "): " << server->running();
+ Outn();
+ }
}
construct.push_server(server);
- Outn();
-
return true;
}
server->build(argc, argv);
- if (is_debug())
+ if (gdb_is_caller() and false)
{
Out << "Pausing for startup, hit return when ready.";
std::string gdb_command= server->base_command();
#endif
getchar();
}
- else if (not server->start())
+ else if (server->start() == false)
{
Error << "Failed to start " << *server;
delete server;
uint32_t count() const
{
- return _count;
- }
-
- void set_count(uint32_t arg)
- {
- _count= arg;
+ return servers.size();
}
void restart();
return _username;
}
-
- bool is_debug() const;
- bool is_helgrind() const;
- bool is_valgrind() const;
-
bool socket()
{
return _socket;
void shutdown_and_remove();
- void shutdown();
+ bool shutdown();
bool shutdown(uint32_t number_of_host);
+ bool check() const;
+
void push_server(Server *);
Server *pop_server();
+
+ unsigned long int servers_to_run() const
+ {
+ return _servers_to_run;
+ }
+
+ void set_servers_to_run(unsigned long int arg)
+ {
+ _servers_to_run= arg;
+ }
+
+private:
+ unsigned long int _servers_to_run;
};
-bool server_startup(server_startup_st&, const std::string&, in_port_t try_port, int argc, const char *argv[]);
+bool server_startup(server_startup_st&, const std::string&, in_port_t try_port, int argc, const char *argv[], const bool opt_startup_message= true);
} // namespace libtest
void SignalThread::test()
{
assert(magic_memory == MAGIC_MEMORY);
- if (not getenv("LIBTEST_IN_GDB"))
+ if (bool(getenv("LIBTEST_IN_GDB")) == false)
{
assert(sigismember(&set, SIGABRT));
assert(sigismember(&set, SIGQUIT));
SignalThread::~SignalThread()
{
- if (not is_shutdown())
+ if (is_shutdown() == false)
{
set_shutdown(SHUTDOWN_GRACEFUL);
}
}
break;
+ case 0:
+ Error << "Inside of gdb";
+ break;
+
default:
Error << "Signal handling thread got unexpected signal " << strsignal(sig);
break;
{
pthread_mutex_init(&shutdown_mutex, NULL);
sigemptyset(&set);
- if (not getenv("LIBTEST_IN_GDB"))
+ if (bool(getenv("LIBTEST_IN_GDB")) == false)
{
sigaddset(&set, SIGABRT);
sigaddset(&set, SIGQUIT);
return "skipped";
}
- throw fatal_message("No port could be found");
+ fatal_message("No port could be found");
}
} // namespace libtest
int main(int argc, char *argv[])
{
- bool opt_repeat= false;
+ bool opt_massive= false;
+ unsigned long int opt_repeat= 1; // Run all tests once
+ bool opt_quiet= false;
std::string collection_to_run;
// Options parsing
enum long_option_t {
OPT_LIBYATL_VERSION,
OPT_LIBYATL_MATCH_COLLECTION,
+ OPT_LIBYATL_MASSIVE,
+ OPT_LIBYATL_QUIET,
OPT_LIBYATL_REPEAT
};
static struct option long_options[]=
{
- {"repeat", no_argument, NULL, OPT_LIBYATL_REPEAT},
- {"collection", required_argument, NULL, OPT_LIBYATL_MATCH_COLLECTION},
- {0, 0, 0, 0}
+ { "version", no_argument, NULL, OPT_LIBYATL_VERSION },
+ { "quiet", no_argument, NULL, OPT_LIBYATL_QUIET },
+ { "repeat", no_argument, NULL, OPT_LIBYATL_REPEAT },
+ { "collection", required_argument, NULL, OPT_LIBYATL_MATCH_COLLECTION },
+ { "massive", no_argument, NULL, OPT_LIBYATL_MASSIVE },
+ { 0, 0, 0, 0 }
};
int option_index= 0;
case OPT_LIBYATL_VERSION:
break;
+ case OPT_LIBYATL_QUIET:
+ opt_quiet= true;
+ break;
+
case OPT_LIBYATL_REPEAT:
- opt_repeat= true;
+ opt_repeat= strtoul(optarg, (char **) NULL, 10);
break;
case OPT_LIBYATL_MATCH_COLLECTION:
collection_to_run= optarg;
break;
+ case OPT_LIBYATL_MASSIVE:
+ opt_massive= true;
+ break;
+
case '?':
/* getopt_long already printed an error message. */
Error << "unknown option to getopt_long()";
srandom((unsigned int)time(NULL));
- if (getenv("LIBTEST_QUIET") and strcmp(getenv("LIBTEST_QUIET"), "0") == 0)
+ if (bool(getenv("YATL_REPEAT")) and (strtoul(getenv("YATL_REPEAT"), (char **) NULL, 10) > 1))
{
- close(STDOUT_FILENO);
+ opt_repeat= strtoul(getenv("YATL_REPEAT"), (char **) NULL, 10);
+ }
+
+ if ((bool(getenv("YATL_QUIET")) and (strcmp(getenv("YATL_QUIET"), "0") == 0)) or opt_quiet)
+ {
+ opt_quiet= true;
}
else if (getenv("JENKINS_URL"))
+ {
+ if (bool(getenv("YATL_QUIET")) and (strcmp(getenv("YATL_QUIET"), "1") == 0))
+ { }
+ else
+ {
+ opt_quiet= true;
+ }
+ }
+
+ if (opt_quiet)
{
close(STDOUT_FILENO);
}
fatal_assert(sigignore(SIGPIPE) == 0);
libtest::SignalThread signal;
- if (not signal.setup())
+ if (signal.setup() == false)
{
Error << "Failed to setup signals";
return EXIT_FAILURE;
goto cleanup;
default:
- throw fatal_message("invalid return code");
+ fatal_message("invalid return code");
}
Out << "Collection: " << next->name;
}
}
+ catch (libtest::fatal &e)
+ {
+ Error << "Fatal exception was thrown: " << e.what();
+ return_code= TEST_FAILURE;
+ }
catch (std::exception &e)
{
Error << "Exception was thrown: " << e.what();
break;
default:
- throw fatal_message("invalid return code");
+ fatal_message("invalid return code");
}
if (test_failed(world.on_error(return_code, creators_ptr)))
stats_print(&stats);
Outn(); // Generate a blank to break up the messages if make check/test has been run
- } while (exit_code == EXIT_SUCCESS and opt_repeat);
+ } while (exit_code == EXIT_SUCCESS and --opt_repeat);
}
catch (libtest::fatal& e)
{
int fd;
if ((fd= mkstemp(file_buffer)) == -1)
{
- libtest::fatal(LIBYATL_DEFAULT_PARAM, "mkstemp() failed on %s with %s", file_buffer, strerror(errno));
+ throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "mkstemp() failed on %s with %s", file_buffer, strerror(errno));
}
close(fd);
unlink(file_buffer);
static test_return_t application_doesnotexist_BINARY(void *)
{
- test_skip_valgrind();
+ test_skip_valgrind();
Application true_app("doesnotexist");
const char *args[]= { "--fubar", 0 };
#if defined(TARGET_OS_OSX) && TARGET_OS_OSX
test_compare(Application::INVALID, true_app.run(args));
- test_compare(Application::FAILURE, true_app.wait());
#else
test_compare(Application::SUCCESS, true_app.run(args));
- test_compare(Application::INVALID, true_app.wait());
+ test_compare(Application::INVALID, true_app.wait(false));
#endif
test_compare(0, true_app.stdout_result().size());
test_compare(Application::SUCCESS, true_app.run(args));
test_compare(Application::SUCCESS, true_app.wait());
+ while (true_app.slurp() == false) {} ;
+
libtest::vchar_t response;
make_vector(response, test_literal_param("fubar\n"));
test_compare(response, true_app.stdout_result());
true_app.add_option("fubar");
test_compare(Application::SUCCESS, true_app.run());
- test_compare(Application::SUCCESS, true_app.wait());
+ test_compare(Application::SUCCESS, true_app.wait(false));
+
libtest::vchar_t response;
make_vector(response, test_literal_param("fubar\n"));
test_compare(response, true_app.stdout_result());
test_compare(Application::SUCCESS, abort_app.wait());
std::string gdb_filename= abort_app.gdb_filename();
+ test_skip(0, access(gdb_filename.c_str(), R_OK ));
const char *args[]= { "SIGABRT", gdb_filename.c_str(), 0 };
test_compare(EXIT_SUCCESS, exec_cmdline("grep", args));
static test_return_t create_tmpfile_TEST(void *)
{
std::string tmp= create_tmpfile(__func__);
+ test_compare(-1, access(tmp.c_str(), R_OK));
+ test_compare(-1, access(tmp.c_str(), F_OK));
Application touch_app("touch");
const char *args[]= { tmp.c_str(), 0 };
test_compare(Application::SUCCESS, touch_app.run(args));
- test_compare(Application::SUCCESS, touch_app.wait());
+ test_compare(Application::SUCCESS, touch_app.wait(false));
test_compare_hint(0, access(tmp.c_str(), R_OK), strerror(errno));
test_compare_hint(0, unlink(tmp.c_str()), strerror(errno));
static test_return_t fatal_message_TEST(void *)
{
test_compare(fatal_calls++, fatal::disabled_counter());
- throw fatal_message("Fatal test");
+ fatal_message("Fatal test");
return TEST_SUCCESS;
}
{"cmdline", 0, 0, cmdline_tests},
{"application", 0, 0, application_tests},
{"http", check_for_curl, 0, http_tests},
+ {"http", check_for_curl, 0, http_tests},
{"get_free_port()", 0, 0, get_free_port_TESTS },
{"fatal", disable_fatal_exception, enable_fatal_exception, fatal_message_TESTS },
{"number_of_cpus()", 0, 0, number_of_cpus_TESTS },
#include <unistd.h>
#include <string>
+#include <signal.h>
#include <libtest/dream.h>
}
}
+ Wait(const pid_t &_pid_arg, uint32_t timeout= 6) :
+ _successful(false)
+ {
+ uint32_t waited;
+ uint32_t this_wait;
+ uint32_t retry;
+
+ for (waited= 0, retry= 1; ; retry++, waited+= this_wait)
+ {
+ if (kill(_pid_arg, 0) == 0)
+ {
+ _successful= true;
+ break;
+ }
+ else if (waited >= timeout)
+ {
+ break;
+ }
+
+ this_wait= retry * retry / 3 + 1;
+ libtest::dream(this_wait, 0);
+ }
+ }
+
bool successful() const
{
return _successful;
;;
esac
- AM_CPPFLAGS="-g ${AM_CPPFLAGS}"
+ AM_CPPFLAGS="-ggdb ${AM_CPPFLAGS}"
DEBUG_CFLAGS="-O0"
DEBUG_CXXFLAGS="-O0"
stop_assoc_maintenance_thread();
/* remove the PID file if we're a daemon */
+#if 0
if (do_daemonize)
remove_pidfile(pid_file);
+#endif
/* Clean up strdup() call for bind() address */
if (settings.inter)
free(settings.inter);
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
- * Libmemcached library
+ * Cycle the Gearmand server
*
* Copyright (C) 2011 Data Differential, http://datadifferential.com/
*
#include <config.h>
#include <libtest/test.hpp>
+using namespace libtest;
#include <libmemcached/memcached.h>
-#include <libmemcached/is.h>
-#include <libmemcached/util.h>
-
-#include <iostream>
-
-#include <libtest/server.h>
+static test_return_t server_startup_single_TEST(void *obj)
+{
+ server_startup_st *servers= (server_startup_st*)obj;
+ test_compare(true, server_startup(*servers, "memcached", libtest::get_free_port(), 0, NULL, false));
+ test_compare(true, servers->shutdown());
-using namespace libtest;
-#ifndef __INTEL_COMPILER
-#pragma GCC diagnostic ignored "-Wstrict-aliasing"
-#endif
+ return TEST_SUCCESS;
+}
-static test_return_t alive(memcached_st *memc)
+static test_return_t server_startup_multiple_TEST(void *obj)
{
- test_true(memc);
- test_true(memcached_is_allocated(memc));
- for (uint32_t x= 0; x < memcached_server_count(memc); ++x)
+ server_startup_st *servers= (server_startup_st*)obj;
+ for (size_t x= 0; x < 10; x++)
{
- memcached_server_instance_st instance= memcached_server_instance_by_position(memc, x);
- test_true(instance);
-
- test_true(libmemcached_util_ping(memcached_server_name(instance),
- memcached_server_port(instance), NULL));
+ test_compare(true, server_startup(*servers, "memcached", libtest::get_free_port(), 0, NULL, false));
}
+ test_compare(true, servers->shutdown());
return TEST_SUCCESS;
}
-static test_return_t valid(memcached_st *memc)
+static test_return_t shutdown_and_remove_TEST(void *obj)
{
- test_true(memc);
- test_true(memcached_is_allocated(memc));
+ server_startup_st *servers= (server_startup_st*)obj;
+ servers->shutdown_and_remove();
- for (uint32_t x= 0; x < memcached_server_count(memc); ++x)
- {
- memcached_server_instance_st instance= memcached_server_instance_by_position(memc, x);
- test_true(instance);
+ return TEST_SUCCESS;
+}
- pid_t pid= libmemcached_util_getpid(memcached_server_name(instance),
- memcached_server_port(instance), NULL);
- test_true(pid != -1);
- }
+test_st server_startup_TESTS[] ={
+ {"server_startup(1)", false, (test_callback_fn*)server_startup_single_TEST },
+ {"server_startup(10)", false, (test_callback_fn*)server_startup_multiple_TEST },
+ {"shutdown_and_remove()", false, (test_callback_fn*)shutdown_and_remove_TEST },
+ {"server_startup(10)", false, (test_callback_fn*)server_startup_multiple_TEST },
+ {0, 0, 0}
+};
+
+#if 0
+static test_return_t collection_INIT(void *object)
+{
+ server_startup_st *servers= (server_startup_st*)object;
+ test_zero(servers->count());
+ test_compare(true, server_startup(*servers, "memcached", libtest::default_port(), 0, NULL));
return TEST_SUCCESS;
}
+#endif
-static test_return_t kill_test(memcached_st *)
+static test_return_t validate_sanity_INIT(void *object)
{
- static struct timespec global_sleep_value= { 2, 0 };
+ server_startup_st *servers= (server_startup_st*)object;
-#ifdef WIN32
- sleep(1);
-#else
- nanosleep(&global_sleep_value, NULL);
-#endif
+ test_zero(servers->count());
return TEST_SUCCESS;
}
-test_st ping_tests[] ={
- {"alive", true, (test_callback_fn*)alive },
- {0, 0, 0}
-};
-
-test_st getpid_tests[] ={
- {"valid", true, (test_callback_fn*)valid },
- {0, 0, 0}
-};
+static test_return_t collection_FINAL(void *object)
+{
+ server_startup_st *servers= (server_startup_st*)object;
+ servers->shutdown_and_remove();
-test_st kill_tests[] ={
- {"kill", true, (test_callback_fn*)kill_test },
- {0, 0, 0}
-};
+ return TEST_SUCCESS;
+}
collection_st collection[] ={
- {"libmemcached_util_ping()", 0, 0, ping_tests},
- {"libmemcached_util_getpid()", 0, 0, getpid_tests},
- {"kill", 0, 0, kill_tests},
+ {"server_startup()", validate_sanity_INIT, collection_FINAL, server_startup_TESTS },
{0, 0, 0, 0}
};
-
-#include "tests/libmemcached_world.h"
+static void *world_create(server_startup_st& servers, test_return_t& )
+{
+ return &servers;
+}
void get_world(Framework *world)
{
world->collections= collection;
-
- world->_create= (test_callback_create_fn*)world_create;
- world->_destroy= (test_callback_destroy_fn*)world_destroy;
-
- world->item.set_startup((test_callback_fn*)world_test_startup);
- world->item.set_pre((test_callback_fn*)world_pre_run);
- world->item.set_post((test_callback_fn*)world_post_run);
-
- world->set_on_error((test_callback_error_fn*)world_on_error);
-
- world->collection_startup= (test_callback_fn*)world_container_startup;
- world->collection_shutdown= (test_callback_fn*)world_container_shutdown;
-
- world->set_runner(&defualt_libmemcached_runner);
- world->set_socket();
+ world->_create= world_create;
}
static test_return_t shutdown_servers(memcached_st *memc)
{
+ test_skip_valgrind();
+
test_compare(memcached_server_count(memc), 1U);
// Disable a single server, just the first
static test_return_t add_shutdown_servers(memcached_st *memc)
{
+ test_skip_valgrind();
+
while (memcached_server_count(memc) < 2)
{
const char *argv[1]= { "add_shutdown_server" };
void get_world(Framework *world)
{
- world->servers().set_count(1);
+ world->servers().set_servers_to_run(1);
world->collections= collection;
pahole-mem: tests/testapp
@$(PAHOLE_COMMAND) tests/testapp
-gdb-mem: tests/var tests/libmemcached-1.0/testapp
+gdb-mem: tests/libmemcached-1.0/testapp
@$(DEBUG_COMMAND) tests/libmemcached-1.0/testapp
gdb-sasl: tests/sasl
{
if (getenv("LIBMEMCACHED_SERVER_NUMBER"))
{
- int set_count= atoi(getenv("LIBMEMCACHED_SERVER_NUMBER"));
- fatal_assert(set_count >= 0);
- world->servers().set_count(set_count);
+ unsigned long int set_count= strtoul(getenv("LIBMEMCACHED_SERVER_NUMBER"), (char **) NULL, 10);
+ fatal_assert(set_count >= 1);
+ world->servers().set_servers_to_run(set_count);
}
else
{
- world->servers().set_count(8);
+ world->servers().set_servers_to_run(8);
}
world->collections= collection;
test_literal_param("foo"),
test_literal_param("when we sanitize"),
time_t(0), (uint32_t)0);
- test_true_got(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED, memcached_strerror(NULL, rc));
+ test_true_got(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED, memcached_last_error_message(memc));
return TEST_SUCCESS;
}
iter != keys.end();
iter++)
{
- test_compare(MEMCACHED_SUCCESS,
- memcached_set(memc,
- (*iter), 36,
- NULL, 0,
- time_t(0), uint32_t(0)));
+ test_compare_hint(MEMCACHED_SUCCESS,
+ memcached_set(memc,
+ (*iter), 36,
+ NULL, 0,
+ time_t(0), uint32_t(0)),
+ memcached_last_error_message(memc));
}
for (ptrdiff_t loop= 0; loop < 20; loop++)
{
result_count++;
}
- test_compare(keys.size(), result_count);
+ test_true(keys.size() >= result_count);
}
else
{
test_return_t replace_test(memcached_st *memc)
{
- test_compare(return_value_based_on_buffering(memc),
- memcached_set(memc,
- test_literal_param(__func__),
- test_literal_param("when we sanitize"),
- time_t(0), uint32_t(0)));
+ test_compare_hint(return_value_based_on_buffering(memc),
+ memcached_set(memc,
+ test_literal_param(__func__),
+ test_literal_param("when we sanitize"),
+ time_t(0), uint32_t(0)),
+ memcached_last_error_message(memc));
- test_compare(MEMCACHED_SUCCESS,
- memcached_replace(memc,
- test_literal_param(__func__),
- test_literal_param("first we insert some data"),
- time_t(0), uint32_t(0)));
+ test_compare_hint(MEMCACHED_SUCCESS,
+ memcached_replace(memc,
+ test_literal_param(__func__),
+ test_literal_param("first we insert some data"),
+ time_t(0), uint32_t(0)),
+ memcached_last_error_message(memc));
return TEST_SUCCESS;
}
test_return_t delete_test(memcached_st *memc)
{
- test_compare(return_value_based_on_buffering(memc),
- memcached_set(memc,
- test_literal_param(__func__),
- test_literal_param("when we sanitize"),
- time_t(0), uint32_t(0)));
+ test_compare_hint(return_value_based_on_buffering(memc),
+ memcached_set(memc,
+ test_literal_param(__func__),
+ test_literal_param("when we sanitize"),
+ time_t(0), uint32_t(0)),
+ memcached_last_error_message(memc));
test_compare_hint(return_value_based_on_buffering(memc),
memcached_delete(memc,
{
for (uint32_t x= 0; x < 10; x++)
{
- test_compare(return_value_based_on_buffering(memc),
- memcached_set(memc,
- test_literal_param("foo"),
- test_literal_param("train in the brain"),
- time_t(0), uint32_t(0)));
+ test_compare_hint(return_value_based_on_buffering(memc),
+ memcached_set(memc,
+ test_literal_param("foo"),
+ test_literal_param("train in the brain"),
+ time_t(0), uint32_t(0)),
+ memcached_last_error_message(memc));
}
return TEST_SUCCESS;
{
const char *value= "sanford and sun";
- test_compare(return_value_based_on_buffering(memc),
- memcached_set(memc,
- test_literal_param(__func__),
- value, strlen(value),
- (time_t)10, (uint32_t)3));
+ test_compare_hint(return_value_based_on_buffering(memc),
+ memcached_set(memc,
+ test_literal_param(__func__),
+ value, strlen(value),
+ (time_t)10, (uint32_t)3),
+ memcached_last_error_message(memc));
memcached_quit(memc);
- test_compare(return_value_based_on_buffering(memc),
- memcached_set(memc,
- test_literal_param(__func__),
- value, strlen(value),
- (time_t)50, (uint32_t)9));
+ test_compare_hint(return_value_based_on_buffering(memc),
+ memcached_set(memc,
+ test_literal_param(__func__),
+ value, strlen(value),
+ (time_t)50, (uint32_t)9),
+ memcached_last_error_message(memc));
return TEST_SUCCESS;
}
blob, sizeof(blob),
0, 0);
test_true_got(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED,
- memcached_strerror(NULL, rc));
+ memcached_last_error_message(memc));
test_compare(query_id +1, memcached_query_id(memc));
}
uint32_t flags;
char* value=memcached_get(memc, key, strlen(key),
&length, &flags, &ret);
- test_true_got(ret == MEMCACHED_SUCCESS && value != NULL, memcached_strerror(NULL, ret));
+ // For the moment we will just go to the next key
+ if (MEMCACHED_TIMEOUT == ret)
+ {
+ continue;
+ }
+ test_true_hint(ret == MEMCACHED_SUCCESS and value != NULL, memcached_last_error_message(memc));
switch (count)
{
case 0: /* FALLTHROUGH */
0, 0));
test_true_got(kill(pid, SIGHUP) == 0, strerror(errno));
- test_compare(MEMCACHED_SUCCESS,
+ test_compare(MEMCACHED_CONNECTION_FAILURE,
memcached_set(memc,
test_literal_param(__func__), // Keys
test_literal_param(__func__), // Values
return NULL;
}
- for (uint32_t x= 0; x < servers.count(); x++)
+ for (uint32_t x= 0; x < servers.servers_to_run(); x++)
{
in_port_t port= libtest::get_free_port();
typedef test_return_t (*libmemcached_test_callback_fn)(memcached_st *);
-static test_return_t _runner_default(libmemcached_test_callback_fn func, libmemcached_test_container_st *container)
-{
- if (func)
+class LibmemcachedRunner : public libtest::Runner {
+public:
+ test_return_t run(test_callback_fn* func, void *object)
{
- test_true(container);
- test_true(container->memc);
- test_return_t ret;
- try {
- ret= func(container->memc);
- }
- catch (std::exception& e)
- {
- libtest::Error << e.what();
- return TEST_FAILURE;
- }
-
- return ret;
+ return _runner_default(libmemcached_test_callback_fn(func), (libmemcached_test_container_st*)object);
}
- return TEST_SUCCESS;
-}
-
-static test_return_t _pre_runner_default(libmemcached_test_callback_fn func, libmemcached_test_container_st *container)
-{
- if (func)
+ test_return_t pre(test_callback_fn* func, void *object)
{
- return func(container->parent);
+ return _pre_runner_default(libmemcached_test_callback_fn(func), (libmemcached_test_container_st*)object);
}
- return TEST_SUCCESS;
-}
-
-static test_return_t _post_runner_default(libmemcached_test_callback_fn func, libmemcached_test_container_st *container)
-{
- if (func)
+ test_return_t post(test_callback_fn* func, void *object)
{
- return func(container->parent);
+ return _post_runner_default(libmemcached_test_callback_fn(func), (libmemcached_test_container_st*)object);
}
- return TEST_SUCCESS;
-}
-
-class LibmemcachedRunner : public libtest::Runner {
-public:
- test_return_t run(test_callback_fn* func, void *object)
+private:
+ test_return_t _runner_default(libmemcached_test_callback_fn func, libmemcached_test_container_st *container)
{
- return _runner_default(libmemcached_test_callback_fn(func), (libmemcached_test_container_st*)object);
+ test_compare(true, check());
+
+ if (func)
+ {
+ test_true(container);
+ test_true(container->memc);
+ test_return_t ret;
+ try {
+ ret= func(container->memc);
+ }
+ catch (std::exception& e)
+ {
+ libtest::Error << e.what();
+ return TEST_FAILURE;
+ }
+
+ return ret;
+ }
+
+ return TEST_SUCCESS;
}
- test_return_t pre(test_callback_fn* func, void *object)
+ test_return_t _pre_runner_default(libmemcached_test_callback_fn func, libmemcached_test_container_st *container)
{
- return _pre_runner_default(libmemcached_test_callback_fn(func), (libmemcached_test_container_st*)object);
+ if (func)
+ {
+ return func(container->parent);
+ }
+
+ return TEST_SUCCESS;
}
- test_return_t post(test_callback_fn* func, void *object)
+ test_return_t _post_runner_default(libmemcached_test_callback_fn func, libmemcached_test_container_st *container)
{
- return _post_runner_default(libmemcached_test_callback_fn(func), (libmemcached_test_container_st*)object);
+ if (func)
+ {
+ return func(container->parent);
+ }
+
+ return TEST_SUCCESS;
}
};
return NULL;
}
- for (uint32_t x= 0; x < servers.count(); x++)
+ for (uint32_t x= 0; x < servers.servers_to_run(); x++)
{
const char *argv[1]= { "memcached" };
- if (not servers.start_socket_server("memcached", libtest::get_free_port(), 1, argv))
+ if (servers.start_socket_server("memcached", libtest::get_free_port(), 1, argv) == false)
{
fatal_message("Could not launch memcached");
}