memcached/.gitignore
memcached/memcached
memcached/memcached.spec
+tests/parser
+1.0.8
+* Added support for setting options via ENV variable LIBMEMCACHED
+
1.0.7 Sat Apr 28 00:48:29 PDT 2012
* Add API call for exist calls.
* Update all license files to be BSD.
SYNOPSIS
--------
-#include <libmemcached/memcached.h>
+#include <libmemcached-1.0/memcached.h>
+
+.. envvar:: LIBMEMCACHED
.. c:function:: memcached_st *memcached(const char *string, size_t string_length)
-.TH "HASHKIT_CLONE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_CLONE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_clone \- libhashkit Documentation
.
-.TH "HASHKIT_CRC32" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_CRC32" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_crc32 \- libhashkit Documentation
.
-.TH "HASHKIT_CREATE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_CREATE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_create \- libhashkit Documentation
.
-.TH "HASHKIT_FNV1_32" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_FNV1_32" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_fnv1_32 \- libhashkit Documentation
.
-.TH "HASHKIT_FNV1_64" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_FNV1_64" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_fnv1_64 \- libhashkit Documentation
.
-.TH "HASHKIT_FNV1A_32" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_FNV1A_32" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_fnv1a_32 \- libhashkit Documentation
.
-.TH "HASHKIT_FNV1A_64" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_FNV1A_64" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_fnv1a_64 \- libhashkit Documentation
.
-.TH "HASHKIT_FREE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_FREE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_free \- libhashkit Documentation
.
-.TH "HASHKIT_FUNCTIONS" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_FUNCTIONS" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_functions \- libhashkit Documentation
.
-.TH "HASHKIT_HSIEH" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_HSIEH" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_hsieh \- libhashkit Documentation
.
-.TH "HASHKIT_IS_ALLOCATED" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_IS_ALLOCATED" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_is_allocated \- libhashkit Documentation
.
-.TH "HASHKIT_JENKINS" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_JENKINS" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_jenkins \- libhashkit Documentation
.
-.TH "HASHKIT_MD5" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_MD5" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_md5 \- libhashkit Documentation
.
-.TH "HASHKIT_MURMUR" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_MURMUR" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_murmur \- libhashkit Documentation
.
-.TH "HASHKIT_VALUE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "HASHKIT_VALUE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
hashkit_value \- libhashkit Documentation
.
-.TH "LIBHASHKIT" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "LIBHASHKIT" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
libhashkit \- libhashkit Documentation
.
-.TH "LIBMEMCACHED" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "LIBMEMCACHED" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
libmemcached \- Introducing the C Client Library for memcached
.
-.TH "LIBMEMCACHED_CHECK_CONFIGURATION" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "LIBMEMCACHED_CHECK_CONFIGURATION" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
libmemcached_check_configuration \- libmemcached Documentation
.
.
.SH SYNOPSIS
.sp
-#include <libmemcached/memcached.h>
+#include <libmemcached\-1.0/memcached.h>
+.INDENT 0.0
+.TP
+.B LIBMEMCACHED
+.UNINDENT
.INDENT 0.0
.TP
.B memcached_st *memcached(const char\fI\ *string\fP, size_t\fI\ string_length\fP)
-.TH "LIBMEMCACHED_CONFIGURATION" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "LIBMEMCACHED_CONFIGURATION" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
libmemcached_configuration \- libmemcached Documentation
.
.
.SH SYNOPSIS
.sp
-#include <libmemcached/memcached.h>
+#include <libmemcached\-1.0/memcached.h>
+.INDENT 0.0
+.TP
+.B LIBMEMCACHED
+.UNINDENT
.INDENT 0.0
.TP
.B memcached_st *memcached(const char\fI\ *string\fP, size_t\fI\ string_length\fP)
-.TH "LIBMEMCACHED_EXAMPLES" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "LIBMEMCACHED_EXAMPLES" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
libmemcached_examples \- libmemcached Documentation
.
-.TH "LIBMEMCACHEDUTIL" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "LIBMEMCACHEDUTIL" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
libmemcachedutil \- libmemcached Documentation
.
-.TH "MEMASLAP" "1" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMASLAP" "1" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memaslap \- libmemcached Documentation
.
-.TH "MEMCACHED" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached \- libmemcached Documentation
.
.
.SH SYNOPSIS
.sp
-#include <libmemcached/memcached.h>
+#include <libmemcached\-1.0/memcached.h>
+.INDENT 0.0
+.TP
+.B LIBMEMCACHED
+.UNINDENT
.INDENT 0.0
.TP
.B memcached_st *memcached(const char\fI\ *string\fP, size_t\fI\ string_length\fP)
-.TH "MEMCACHED_ADD" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_ADD" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_add \- Storing and Replacing Data
.
-.TH "MEMCACHED_ADD_BY_KEY" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_ADD_BY_KEY" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_add_by_key \- Storing and Replacing Data
.
-.TH "MEMCACHED_ANALYZE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_ANALYZE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_analyze \- libmemcached Documentation
.
-.TH "MEMCACHED_APPEND" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_APPEND" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_append \- Appending to or Prepending to data on the server
.
-.TH "MEMCACHED_APPEND_BY_KEY" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_APPEND_BY_KEY" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_append_by_key \- Appending to or Prepending to data on the server
.
-.TH "MEMCACHED_AUTO" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_AUTO" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_auto \- Incrementing and Decrementing Values
.
-.TH "MEMCACHED_BEHAVIOR" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_BEHAVIOR" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_behavior \- libmemcached Documentation
.
-.TH "MEMCACHED_BEHAVIOR_GET" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_BEHAVIOR_GET" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_behavior_get \- libmemcached Documentation
.
-.TH "MEMCACHED_BEHAVIOR_SET" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_BEHAVIOR_SET" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_behavior_set \- libmemcached Documentation
.
-.TH "MEMCACHED_CALLBACK" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_CALLBACK" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_callback \- libmemcached Documentation
.
-.TH "MEMCACHED_CALLBACK_GET" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_CALLBACK_GET" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_callback_get \- libmemcached Documentation
.
-.TH "MEMCACHED_CALLBACK_SET" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_CALLBACK_SET" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_callback_set \- libmemcached Documentation
.
-.TH "MEMCACHED_CAS" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_CAS" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_cas \- Working with data on the server in an atomic fashion
.
-.TH "MEMCACHED_CAS_BY_KEY" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_CAS_BY_KEY" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_cas_by_key \- Storing and Replacing Data
.
-.TH "MEMCACHED_CLONE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_CLONE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_clone \- libmemcached Documentation
.
a NULL. If a NULL passed in then a structure is allocated for you.
.sp
Please note, when you write new application use
-\fBmemcached()\fP over
-\fI\%memcached_create()\fP.
+\fBmemcached()\fP over \fI\%memcached_create()\fP.
.sp
\fI\%memcached_clone()\fP is similar to \fI\%memcached_create()\fP but
it copies the defaults and list of servers from the source
-.TH "MEMCACHED_CREATE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_CREATE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_create \- libmemcached Documentation
.
a NULL. If a NULL passed in then a structure is allocated for you.
.sp
Please note, when you write new application use
-\fBmemcached()\fP over
-\fI\%memcached_create()\fP.
+\fBmemcached()\fP over \fI\%memcached_create()\fP.
.sp
\fI\%memcached_clone()\fP is similar to \fI\%memcached_create()\fP but
it copies the defaults and list of servers from the source
-.TH "MEMCACHED_DECREMENT" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_DECREMENT" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_decrement \- Incrementing and Decrementing Values
.
-.TH "MEMCACHED_DECREMENT_WITH_INITIAL" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_DECREMENT_WITH_INITIAL" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_decrement_with_initial \- Incrementing and Decrementing Values
.
-.TH "MEMCACHED_DELETE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_DELETE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_delete \- libmemcached Documentation
.
-.TH "MEMCACHED_DELETE_BY_KEY" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_DELETE_BY_KEY" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_delete_by_key \- libmemcached Documentation
.
-.TH "MEMCACHED_DESTROY_SASL_AUTH_DATA" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_DESTROY_SASL_AUTH_DATA" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_destroy_sasl_auth_data \- libmemcached Documentation
.
-.TH "MEMCACHED_DUMP" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_DUMP" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_dump \- libmemcached Documentation
.
-.TH "MEMCACHED_EXIST" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_EXIST" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_exist \- libmemcached Documentation
.
-.TH "MEMCACHED_EXIST_BY_KEY" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_EXIST_BY_KEY" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_exist_by_key \- libmemcached Documentation
.
-.TH "MEMCACHED_FETCH" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_FETCH" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_fetch \- Retrieving data from the server
.
-.TH "MEMCACHED_FETCH_EXECUTE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_FETCH_EXECUTE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_fetch_execute \- Retrieving data from the server
.
-.TH "MEMCACHED_FETCH_RESULT" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_FETCH_RESULT" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_fetch_result \- Retrieving data from the server
.
-.TH "MEMCACHED_FLUSH" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_FLUSH" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_flush \- libmemcached Documentation
.
-.TH "MEMCACHED_FLUSH_BUFFERS" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_FLUSH_BUFFERS" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_flush_buffers \- libmemcached Documentation
.
-.TH "MEMCACHED_FREE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_FREE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_free \- libmemcached Documentation
.
a NULL. If a NULL passed in then a structure is allocated for you.
.sp
Please note, when you write new application use
-\fBmemcached()\fP over
-\fI\%memcached_create()\fP.
+\fBmemcached()\fP over \fI\%memcached_create()\fP.
.sp
\fI\%memcached_clone()\fP is similar to \fI\%memcached_create()\fP but
it copies the defaults and list of servers from the source
-.TH "MEMCACHED_GENERATE_HASH" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_GENERATE_HASH" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_generate_hash \- Generating hash values directly
.
-.TH "MEMCACHED_GENERATE_HASH_VALUE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_GENERATE_HASH_VALUE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_generate_hash_value \- Generating hash values directly
.
-.TH "MEMCACHED_GET" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_GET" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_get \- Retrieving data from the server
.
-.TH "MEMCACHED_GET_BY_KEY" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_GET_BY_KEY" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_get_by_key \- Retrieving data from the server
.
-.TH "MEMCACHED_GET_MEMORY_ALLOCATORS" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_GET_MEMORY_ALLOCATORS" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_get_memory_allocators \- libmemcached Documentation
.
-.TH "MEMCACHED_GET_SASL_CALLBACKS" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_GET_SASL_CALLBACKS" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_get_sasl_callbacks \- libmemcached Documentation
.
-.TH "MEMCACHED_GET_USER_DATA" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_GET_USER_DATA" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_get_user_data \- libmemcached Documentation
.
-.TH "MEMCACHED_INCREMENT" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_INCREMENT" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_increment \- Incrementing and Decrementing Values
.
-.TH "MEMCACHED_INCREMENT_WITH_INITIAL" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_INCREMENT_WITH_INITIAL" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_increment_with_initial \- Incrementing and Decrementing Values
.
-.TH "MEMCACHED_LAST_ERROR_MESSAGE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_LAST_ERROR_MESSAGE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_last_error_message \- libmemcached Documentation
.
-.TH "MEMCACHED_LIB_VERSION" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_LIB_VERSION" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_lib_version \- libmemcached Documentation
.
-.TH "MEMCACHED_MEMORY_ALLOCATORS" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_MEMORY_ALLOCATORS" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_memory_allocators \- libmemcached Documentation
.
-.TH "MEMCACHED_MGET" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_MGET" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_mget \- Retrieving data from the server
.
-.TH "MEMCACHED_MGET_BY_KEY" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_MGET_BY_KEY" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_mget_by_key \- Retrieving data from the server
.
-.TH "MEMCACHED_MGET_EXECUTE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_MGET_EXECUTE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_mget_execute \- Retrieving data from the server
.
-.TH "MEMCACHED_MGET_EXECUTE_BY_KEY" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_MGET_EXECUTE_BY_KEY" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_mget_execute_by_key \- Retrieving data from the server
.
-.TH "MEMCACHED_POOL" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_POOL" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_pool \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_BEHAVIOR_GET" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_POOL_BEHAVIOR_GET" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_pool_behavior_get \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_BEHAVIOR_SET" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_POOL_BEHAVIOR_SET" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_pool_behavior_set \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_CREATE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_POOL_CREATE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_pool_create \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_DESTROY" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_POOL_DESTROY" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_pool_destroy \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_FETCH" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_POOL_FETCH" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_pool_fetch \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_POP" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_POOL_POP" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_pool_pop \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_PUSH" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_POOL_PUSH" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_pool_push \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_RELEASE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_POOL_RELEASE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_pool_release \- libmemcached Documentation
.
-.TH "MEMCACHED_POOL_ST" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_POOL_ST" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_pool_st \- libmemcached Documentation
.
-.TH "MEMCACHED_PREPEND" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_PREPEND" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_prepend \- Appending to or Prepending to data on the server
.
-.TH "MEMCACHED_PREPEND_BY_KEY" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_PREPEND_BY_KEY" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_prepend_by_key \- Appending to or Prepending to data on the server
.
-.TH "MEMCACHED_QUIT" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_QUIT" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_quit \- libmemcached Documentation
.
-.TH "MEMCACHED_REPLACE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_REPLACE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_replace \- Storing and Replacing Data
.
-.TH "MEMCACHED_REPLACE_BY_KEY" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_REPLACE_BY_KEY" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_replace_by_key \- Storing and Replacing Data
.
-.TH "MEMCACHED_RESULT_CAS" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_RESULT_CAS" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_result_cas \- Working with result sets
.
-.TH "MEMCACHED_RESULT_CREATE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_RESULT_CREATE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_result_create \- Working with result sets
.
-.TH "MEMCACHED_RESULT_FLAGS" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_RESULT_FLAGS" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_result_flags \- Working with result sets
.
-.TH "MEMCACHED_RESULT_FREE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_RESULT_FREE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_result_free \- Working with result sets
.
-.TH "MEMCACHED_RESULT_KEY_LENGTH" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_RESULT_KEY_LENGTH" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_result_key_length \- Working with result sets
.
-.TH "MEMCACHED_RESULT_KEY_VALUE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_RESULT_KEY_VALUE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_result_key_value \- Working with result sets
.
-.TH "MEMCACHED_RESULT_LENGTH" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_RESULT_LENGTH" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_result_length \- Working with result sets
.
-.TH "MEMCACHED_RESULT_ST" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_RESULT_ST" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_result_st \- Working with result sets
.
-.TH "MEMCACHED_RESULT_VALUE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_RESULT_VALUE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_result_value \- Working with result sets
.
-.TH "MEMCACHED_RETURN_T" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_RETURN_T" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_return_t \- Return type values
.
-.TH "MEMCACHED_SASL" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SASL" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_sasl \- libmemcached Documentation
.
-.TH "MEMCACHED_SASL_SET_AUTH_DATA" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SASL_SET_AUTH_DATA" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_sasl_set_auth_data \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_ADD" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SERVER_ADD" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_server_add \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_ADD_UNIX_SOCKET" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SERVER_ADD_UNIX_SOCKET" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_server_add_unix_socket \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_COUNT" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SERVER_COUNT" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_server_count \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_CURSOR" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SERVER_CURSOR" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_server_cursor \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_LIST" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SERVER_LIST" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_server_list \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_LIST_APPEND" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SERVER_LIST_APPEND" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_server_list_append \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_LIST_COUNT" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SERVER_LIST_COUNT" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_server_list_count \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_LIST_FREE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SERVER_LIST_FREE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_server_list_free \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_PUSH" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SERVER_PUSH" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_server_push \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVER_ST" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SERVER_ST" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_server_st \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVERS" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SERVERS" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_servers \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVERS_PARSE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SERVERS_PARSE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_servers_parse \- libmemcached Documentation
.
-.TH "MEMCACHED_SERVERS_RESET" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SERVERS_RESET" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_servers_reset \- libmemcached Documentation
.
a NULL. If a NULL passed in then a structure is allocated for you.
.sp
Please note, when you write new application use
-\fBmemcached()\fP over
-\fI\%memcached_create()\fP.
+\fBmemcached()\fP over \fI\%memcached_create()\fP.
.sp
\fI\%memcached_clone()\fP is similar to \fI\%memcached_create()\fP but
it copies the defaults and list of servers from the source
-.TH "MEMCACHED_SET" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SET" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_set \- Storing and Replacing Data
.
-.TH "MEMCACHED_SET_BY_KEY" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SET_BY_KEY" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_set_by_key \- Storing and Replacing Data
.
-.TH "MEMCACHED_SET_MEMORY_ALLOCATORS" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SET_MEMORY_ALLOCATORS" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_set_memory_allocators \- libmemcached Documentation
.
-.TH "MEMCACHED_SET_MEMORY_ALLOCATORS_CONTEXT" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SET_MEMORY_ALLOCATORS_CONTEXT" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_set_memory_allocators_context \- libmemcached Documentation
.
-.TH "MEMCACHED_SET_SASL_CALLBACKS" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SET_SASL_CALLBACKS" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_set_sasl_callbacks \- libmemcached Documentation
.
-.TH "MEMCACHED_SET_USER_DATA" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_SET_USER_DATA" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_set_user_data \- libmemcached Documentation
.
-.TH "MEMCACHED_STAT" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_STAT" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_stat \- libmemcached Documentation
.
-.TH "MEMCACHED_STAT_EXECUTE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_STAT_EXECUTE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_stat_execute \- libmemcached Documentation
.
-.TH "MEMCACHED_STAT_GET_KEYS" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_STAT_GET_KEYS" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_stat_get_keys \- libmemcached Documentation
.
-.TH "MEMCACHED_STAT_GET_VALUE" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_STAT_GET_VALUE" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_stat_get_value \- libmemcached Documentation
.
-.TH "MEMCACHED_STAT_SERVERNAME" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_STAT_SERVERNAME" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_stat_servername \- libmemcached Documentation
.
-.TH "MEMCACHED_STATS" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_STATS" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_stats \- libmemcached Documentation
.
-.TH "MEMCACHED_STRERROR" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_STRERROR" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_strerror \- libmemcached Documentation
.
-.TH "MEMCACHED_TOUCH" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_TOUCH" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_touch \- libmemcached Documentation
.
-.TH "MEMCACHED_TOUCH_BY_KEY" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_TOUCH_BY_KEY" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_touch_by_key \- libmemcached Documentation
.
-.TH "MEMCACHED_USER_DATA" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_USER_DATA" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_user_data \- libmemcached Documentation
.
-.TH "MEMCACHED_VERBOSITY" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_VERBOSITY" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_verbosity \- libmemcached Documentation
.
-.TH "MEMCACHED_VERSION" "3" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCACHED_VERSION" "3" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcached_version \- libmemcached Documentation
.
-.TH "MEMCAPABLE" "1" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCAPABLE" "1" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcapable \- libmemcached Documentation
.
-.TH "MEMCAT" "1" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCAT" "1" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcat \- libmemcached Documentation
.
-.TH "MEMCP" "1" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMCP" "1" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memcp \- libmemcached Documentation
.
-.TH "MEMDUMP" "1" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMDUMP" "1" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memdump \- libmemcached Documentation
.
-.TH "MEMERROR" "1" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMERROR" "1" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memerror \- libmemcached Documentation
.
-.TH "MEMFLUSH" "1" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMFLUSH" "1" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memflush \- libmemcached Documentation
.
-.TH "MEMRM" "1" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMRM" "1" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memrm \- libmemcached Documentation
.
-.TH "MEMSLAP" "1" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMSLAP" "1" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memslap \- libmemcached Documentation
.
-.TH "MEMSTAT" "1" "April 28, 2012" "1.0.7" "libmemcached"
+.TH "MEMSTAT" "1" "May 03, 2012" "1.0.7" "libmemcached"
.SH NAME
memstat \- libmemcached Documentation
.
a NULL. If a NULL passed in then a structure is allocated for you.
Please note, when you write new application use
-:c:func:`memcached` over
-:c:func:`memcached_create`.
+:c:func:`memcached` over :c:func:`memcached_create`.
:c:func:`memcached_clone` is similar to :c:func:`memcached_create` but
it copies the defaults and list of servers from the source
#pragma once
-#include <inttypes.h>
+/* This seems to be required for older compilers @note http://stackoverflow.com/questions/8132399/how-to-printf-uint64-t */
+#define __STDC_FORMAT_MACROS
#ifdef __cplusplus
-#include <cstddef>
-#include <cstdlib>
+# include <tr1/cinttypes>
+# include <cstddef>
+# include <cstdlib>
#else
-#include <stddef.h>
-#include <stdlib.h>
+# include <inttypes.h>
+# include <stddef.h>
+# include <stdlib.h>
+# include <stdbool.h>
#endif
#include <sys/types.h>
-
-#if !defined(__cplusplus)
-# include <stdbool.h>
-#endif
-
#include <libmemcached-1.0/visibility.h>
#include <libmemcached-1.0/configure.h>
#include <libmemcached-1.0/platform.h>
memcached_st *memcached(const char *string, size_t length)
{
- memcached_st *self= memcached_create(NULL);
- if (self == NULL)
+ if (length == 0 and string)
+ {
+ return NULL;
+ }
+
+ if (length and string == NULL)
{
return NULL;
}
if (length == 0)
{
- return self;
+ if (bool(getenv("LIBMEMCACHED")))
+ {
+ string= getenv("LIBMEMCACHED");
+ length= string ? strlen(string) : 0;
+ }
+ }
+
+ memcached_st *memc= memcached_create(NULL);
+ if (memc == NULL)
+ {
+ return NULL;
+ }
+
+ if (length == 0 or string == NULL)
+ {
+ return memc;
}
- memcached_return_t rc= memcached_parse_configuration(self, string, length);
- if (memcached_success(rc) and memcached_parse_filename(self))
+ memcached_return_t rc= memcached_parse_configuration(memc, string, length);
+ if (memcached_success(rc) and memcached_parse_filename(memc))
{
- rc= memcached_parse_configure_file(*self, memcached_parse_filename(self), memcached_parse_filename_length(self));
+ rc= memcached_parse_configure_file(*memc, memcached_parse_filename(memc), memcached_parse_filename_length(memc));
}
if (memcached_failed(rc))
{
- memcached_free(self);
+ memcached_free(memc);
return NULL;
}
- return self;
+ return memc;
}
memcached_return_t memcached_reset(memcached_st *ptr)
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Data Differential YATL (i.e. libtest) library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <config.h>
+
+#include <libtest/common.h>
+
+static test_return_t runner_code(Framework* frame,
+ test_st* run,
+ libtest::Timer& _timer)
+{ // Runner Code
+
+ assert(frame->runner());
+ assert(run->test_fn);
+
+ test_return_t return_code;
+ try
+ {
+ _timer.reset();
+ return_code= frame->runner()->run(run->test_fn, frame->creators_ptr());
+ }
+ // Special case where check for the testing of the exception
+ // system.
+ catch (libtest::fatal &e)
+ {
+ if (libtest::fatal::is_disabled())
+ {
+ libtest::fatal::increment_disabled_counter();
+ return_code= TEST_SUCCESS;
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ _timer.sample();
+
+ return return_code;
+}
+
+namespace libtest {
+
+Collection::Collection(Framework* frame_arg,
+ collection_st* arg) :
+ _name(arg->name),
+ _pre(arg->pre),
+ _post(arg->post),
+ _tests(arg->tests),
+ _frame(frame_arg),
+ _success(0),
+ _skipped(0),
+ _failed(0),
+ _total(0)
+{
+ fatal_assert(arg);
+}
+
+test_return_t Collection::exec()
+{
+ Out << "Collection: " << _name;
+
+ if (test_success(_frame->runner()->pre(_pre, _frame->creators_ptr())))
+ {
+ for (test_st *run= _tests; run->name; run++)
+ {
+ long int load_time= 0;
+
+ if (_frame->match(run->name))
+ {
+ continue;
+ }
+ _total++;
+
+ test_return_t return_code;
+ try
+ {
+ if (run->requires_flush)
+ {
+ if (test_failed(_frame->runner()->flush(_frame->creators_ptr())))
+ {
+ Error << "frame->runner()->flush(creators_ptr)";
+ _skipped++;
+ continue;
+ }
+ }
+
+ return_code= runner_code(_frame, run, _timer);
+ }
+ catch (libtest::fatal &e)
+ {
+ Error << "Fatal exception was thrown: " << e.what();
+ return_code= TEST_FAILURE;
+ _failed++;
+ throw;
+ }
+
+ switch (return_code)
+ {
+ case TEST_SUCCESS:
+ Out << "\tTesting "
+ << run->name
+ << "\t\t\t\t\t"
+ << _timer
+ << " [ " << test_strerror(return_code) << " ]";
+ _success++;
+ break;
+
+ case TEST_FAILURE:
+ _failed++;
+ Out << "\tTesting " << run->name << "\t\t\t\t\t" << "[ " << test_strerror(return_code) << " ]";
+ break;
+
+ case TEST_SKIPPED:
+ _skipped++;
+ Out << "\tTesting " << run->name << "\t\t\t\t\t" << "[ " << test_strerror(return_code) << " ]";
+ break;
+
+ default:
+ fatal_message("invalid return code");
+ }
+#if 0
+ @TODO add code here to allow for a collection to define a method to reset to allow tests to continue.
+#endif
+ }
+
+ (void) _frame->runner()->post(_post, _frame->creators_ptr());
+ }
+
+ if (_failed == 0 and _skipped == 0 and _success)
+ {
+ return TEST_SUCCESS;
+ }
+
+ if (_failed)
+ {
+ return TEST_FAILURE;
+ }
+
+ fatal_assert(_skipped or _success == 0);
+
+ return TEST_SKIPPED;
+}
+
+} // namespace libtest
+
#pragma once
+#include <libtest/timer.hpp>
+
+class Framework;
+
/**
A structure which describes a collection of test cases.
*/
struct test_st *tests;
};
+namespace libtest {
+
+class Collection {
+public:
+ Collection(Framework*, collection_st*);
+
+ test_return_t exec();
+
+ const char* name()
+ {
+ return _name;
+ }
+
+ uint32_t success()
+ {
+ return _success;
+ }
+
+ uint32_t skipped()
+ {
+ return _skipped;
+ }
+
+ uint32_t failed()
+ {
+ return _failed;
+ }
+
+ uint32_t total()
+ {
+ return _total;
+ }
+
+private:
+ const char *_name;
+ test_callback_fn *_pre;
+ test_callback_fn *_post;
+ struct test_st *_tests;
+ Framework* _frame;
+ uint32_t _success;
+ uint32_t _skipped;
+ uint32_t _failed;
+ uint32_t _total;
+ libtest::Timer _timer;
+};
+} // namespace libtest
#include <libtest/libtool.hpp>
#include <libtest/killpid.h>
-#include <libtest/stats.h>
#include <libtest/signal.h>
#ifdef TARGET_OS_OSX
return;
#endif
- if (getenv("LIBMEMCACHED_NO_COREDUMP") == NULL)
+ if (getenv("YATL_COREDUMP"))
{
pid_t pid= fork();
namespace libtest {
-fatal::fatal(const char *file, int line, const char *func, const char *format, ...) :
- std::runtime_error(func)
+fatal::fatal(const char *file_arg, int line_arg, const char *func_arg, const char *format, ...) :
+ std::runtime_error(func_arg),
+ _file(file_arg),
+ _line(line_arg),
+ _func(func_arg)
{
va_list args;
va_start(args, format);
char last_error[BUFSIZ];
- (void)vsnprintf(last_error, sizeof(last_error), format, args);
+ int last_error_length= vsnprintf(last_error, sizeof(last_error), format, args);
va_end(args);
- snprintf(_error_message, sizeof(_error_message), "%s:%d FATAL:%s (%s)", file, int(line), last_error, func);
+ strncpy(_mesg, last_error, sizeof(_mesg));
+
+ snprintf(_error_message, sizeof(_error_message), "%s:%d FATAL:%s (%s)", _file, int(_line), last_error, _func);
}
static bool _disabled= false;
return _error_message;
}
+ const char* mesg() const throw()
+ {
+ return _error_message;
+ }
+
// The following are just for unittesting the exception class
static bool is_disabled();
static void disable();
static uint32_t disabled_counter();
static void increment_disabled_counter();
+ int line()
+ {
+ return _line;
+ }
+
+ const char* file()
+ {
+ return _file;
+ }
+
+ const char* func()
+ {
+ return _func;
+ }
+
private:
char _error_message[BUFSIZ];
+ char _mesg[BUFSIZ];
+ int _line;
+ const char* _file;
+ const char* _func;
};
class disconnected : std::runtime_error
*/
#include <config.h>
+
#include <libtest/common.h>
+#include <libtest/collection.h>
+#include <libtest/signal.h>
+
+#include <fnmatch.h>
#include <iostream>
using namespace libtest;
-Framework::Framework() :
+Framework::Framework(libtest::SignalThread& signal,
+ const std::string& only_run_arg,
+ const std::string& wildcard_arg) :
collections(NULL),
+ _total(0),
+ _success(0),
+ _skipped(0),
+ _failed(0),
_create(NULL),
_destroy(NULL),
_runner(NULL),
_socket(false),
- _creators_ptr(NULL)
+ _creators_ptr(NULL),
+ _signal(signal),
+ _only_run(only_run_arg),
+ _wildcard(wildcard_arg)
{
+ get_world(this);
+
+ for (collection_st *next= collections; next and next->name; next++)
+ {
+ _collection.push_back(new Collection(this, next));
+ }
}
Framework::~Framework()
_servers.shutdown();
delete _runner;
+
+ for (std::vector<Collection*>::iterator iter= _collection.begin();
+ iter != _collection.end();
+ iter++)
+ {
+ delete *iter;
+ }
+ _collection.clear();
+}
+
+bool Framework::match(const char* arg)
+{
+ if (_wildcard.empty() == false and fnmatch(_wildcard.c_str(), arg, 0))
+ {
+ return true;
+ }
+
+ return false;
+}
+
+void Framework::exec()
+{
+ for (std::vector<Collection*>::iterator iter= _collection.begin();
+ iter != _collection.end() and (_signal.is_shutdown() == false);
+ iter++)
+ {
+ if (_only_run.empty() == false and
+ fnmatch(_only_run.c_str(), (*iter)->name(), 0))
+ {
+ continue;
+ }
+
+ _total++;
+
+ try {
+ switch ((*iter)->exec())
+ {
+ case TEST_FAILURE:
+ _failed++;
+ break;
+
+ case TEST_SKIPPED:
+ _skipped++;
+ break;
+
+ // exec() can return SUCCESS, but that doesn't mean that some tests did
+ // not fail or get skipped.
+ case TEST_SUCCESS:
+ _success++;
+ break;
+ }
+ }
+ catch (libtest::fatal& e)
+ {
+ stream::cerr(e.file(), e.line(), e.func()) << e.mesg();
+ }
+ catch (libtest::disconnected& e)
+ {
+ Error << "Unhandled disconnection occurred:" << e.what();
+ throw;
+ }
+
+ Outn();
+ }
+}
+
+uint32_t Framework::sum_total()
+{
+ uint32_t count= 0;
+ for (std::vector<Collection*>::iterator iter= _collection.begin();
+ iter != _collection.end();
+ iter++)
+ {
+ count+= (*iter)->total();
+ }
+
+ return count;
+}
+
+uint32_t Framework::sum_success()
+{
+ uint32_t count= 0;
+ for (std::vector<Collection*>::iterator iter= _collection.begin();
+ iter != _collection.end();
+ iter++)
+ {
+ count+= (*iter)->success();
+ }
+
+ return count;
+}
+
+uint32_t Framework::sum_skipped()
+{
+ uint32_t count= 0;
+ for (std::vector<Collection*>::iterator iter= _collection.begin();
+ iter != _collection.end();
+ iter++)
+ {
+ count+= (*iter)->skipped();
+ }
+
+ return count;
+}
+
+uint32_t Framework::sum_failed()
+{
+ uint32_t count= 0;
+ for (std::vector<Collection*>::iterator iter= _collection.begin();
+ iter != _collection.end();
+ iter++)
+ {
+ count+= (*iter)->failed();
+ }
+
+ return count;
}
libtest::Runner *Framework::runner()
return _runner;
}
-void* Framework::create(test_return_t& arg)
+test_return_t Framework::create()
{
- arg= TEST_SUCCESS;
+ test_return_t rc= TEST_SUCCESS;
if (_create)
{
- return _creators_ptr= _create(_servers, arg);
+ _creators_ptr= _create(_servers, rc);
}
- return NULL;
+ return rc;
}
#pragma once
+#include <libtest/signal.h>
+
/**
Framework is the structure which is passed to the test implementation to be filled.
This must be implemented in order for the test framework to load the tests. We call
get_world() in order to fill this structure.
*/
+#include <vector>
+
class Framework {
public:
collection_st *collections;
test_callback_destroy_fn *_destroy;
public:
- void* create(test_return_t& arg);
+ test_return_t create();
/**
If an error occurs during the test, this is called.
libtest::Runner *runner();
+ void exec();
- Framework();
+ libtest::Collection& collection();
+
+ Framework(libtest::SignalThread&, const std::string&);
virtual ~Framework();
- Framework(const Framework&);
+ Framework(libtest::SignalThread&,
+ const std::string&,
+ const std::string&);
+
+ bool match(const char* arg);
+
+ void *creators_ptr()
+ {
+ return _creators_ptr;
+ }
+
+ libtest::SignalThread& signal()
+ {
+ return _signal;
+ }
+
+ uint32_t sum_total();
+ uint32_t sum_success();
+ uint32_t sum_skipped();
+ uint32_t sum_failed();
+
+ size_t size()
+ {
+ return _collection.size();
+ }
+
+ uint32_t total() const
+ {
+ return _total;
+ }
+
+ uint32_t success() const
+ {
+ return _success;
+ }
+
+ uint32_t skipped() const
+ {
+ return _skipped;
+ }
+
+ uint32_t failed() const
+ {
+ return _failed;
+ }
private:
Framework& operator=(const Framework&);
+
+ uint32_t _total;
+ uint32_t _success;
+ uint32_t _skipped;
+ uint32_t _failed;
+
libtest::server_startup_st _servers;
bool _socket;
void *_creators_ptr;
unsigned long int _servers_to_run;
+ std::vector<libtest::Collection*> _collection;
+ libtest::SignalThread& _signal;
+ std::string _only_run;
+ std::string _wildcard;
};
distclean-libtest-check:
-rm -rf tmp_chroot
+noinst_HEADERS+= libtest/timer.hpp
noinst_HEADERS+= \
libtest/binaries.h \
libtest/cpu.hpp \
libtest/server_container.h \
libtest/signal.h \
libtest/socket.hpp \
- libtest/stats.h \
libtest/stream.h \
libtest/strerror.h \
libtest/string.hpp \
libtest_libtest_la_SOURCES+= libtest/binaries.cc
libtest_libtest_la_SOURCES+= libtest/cmdline.cc
libtest_libtest_la_SOURCES+= libtest/comparison.cc
+libtest_libtest_la_SOURCES+= libtest/collection.cc
libtest_libtest_la_SOURCES+= libtest/core.cc
libtest_libtest_la_SOURCES+= libtest/cpu.cc
libtest_libtest_la_SOURCES+= libtest/dream.cc
libtest_libtest_la_SOURCES+= libtest/server_container.cc
libtest_libtest_la_SOURCES+= libtest/signal.cc
libtest_libtest_la_SOURCES+= libtest/socket.cc
+libtest_libtest_la_SOURCES+= libtest/stream.cc
libtest_libtest_la_SOURCES+= libtest/strerror.cc
+libtest_libtest_la_SOURCES+= libtest/timer.cc
libtest_libtest_la_SOURCES+= libtest/tmpfile.cc
libtest_libtest_la_SOURCES+= libtest/vchar.cc
using namespace libtest;
-static void stats_print(Stats *stats)
+static void stats_print(Framework *frame)
{
- if (stats->collection_failed == 0 and stats->collection_success == 0)
+ if (frame->failed() == 0 and frame->success() == 0)
{
return;
}
- Out << "\tTotal Collections\t\t\t\t" << stats->collection_total;
- Out << "\tFailed Collections\t\t\t\t" << stats->collection_failed;
- Out << "\tSkipped Collections\t\t\t\t" << stats->collection_skipped;
- Out << "\tSucceeded Collections\t\t\t\t" << stats->collection_success;
Outn();
- Out << "Total\t\t\t\t" << stats->total;
- Out << "\tFailed\t\t\t" << stats->failed;
- Out << "\tSkipped\t\t\t" << stats->skipped;
- Out << "\tSucceeded\t\t" << stats->success;
-}
-
-static long int timedif(struct timeval a, struct timeval b)
-{
- long us, s;
-
- us = (long)(a.tv_usec - b.tv_usec);
- us /= 1000;
- s = (long)(a.tv_sec - b.tv_sec);
- s *= 1000;
- return s + us;
-}
-
-static test_return_t runner_code(Framework* frame,
- test_st* run,
- void* creators_ptr,
- long int& load_time)
-{ // Runner Code
-
- struct timeval start_time, end_time;
-
- gettimeofday(&start_time, NULL);
- assert(frame->runner());
- assert(run->test_fn);
-
- test_return_t return_code;
- try
- {
- return_code= frame->runner()->run(run->test_fn, creators_ptr);
- }
- // Special case where check for the testing of the exception
- // system.
- catch (libtest::fatal &e)
- {
- if (fatal::is_disabled())
- {
- fatal::increment_disabled_counter();
- return_code= TEST_SUCCESS;
- }
- else
- {
- throw;
- }
- }
-
- gettimeofday(&end_time, NULL);
- load_time= timedif(end_time, start_time);
-
- return return_code;
+ Out << "Collections\t\t\t\t\t" << frame->total();
+ Out << "\tFailed\t\t\t\t\t" << frame->failed();
+ Out << "\tSkipped\t\t\t\t\t" << frame->skipped();
+ Out << "\tSucceeded\t\t\t\t" << frame->success();
+ Outn();
+ Out << "Tests\t\t\t\t\t" << frame->sum_total();
+ Out << "\tFailed\t\t\t\t" << frame->sum_failed();
+ Out << "\tSkipped\t\t\t\t" << frame->sum_skipped();
+ Out << "\tSucceeded\t\t\t" << frame->sum_success();
}
#include <getopt.h>
unsigned long int opt_repeat= 1; // Run all tests once
bool opt_quiet= false;
std::string collection_to_run;
+ std::string wildcard;
// Options parsing
{
OPT_LIBYATL_MATCH_COLLECTION,
OPT_LIBYATL_MASSIVE,
OPT_LIBYATL_QUIET,
+ OPT_LIBYATL_MATCH_WILDCARD,
OPT_LIBYATL_REPEAT
};
{ "quiet", no_argument, NULL, OPT_LIBYATL_QUIET },
{ "repeat", no_argument, NULL, OPT_LIBYATL_REPEAT },
{ "collection", required_argument, NULL, OPT_LIBYATL_MATCH_COLLECTION },
+ { "wildcard", required_argument, NULL, OPT_LIBYATL_MATCH_WILDCARD },
{ "massive", no_argument, NULL, OPT_LIBYATL_MASSIVE },
{ 0, 0, 0, 0 }
};
collection_to_run= optarg;
break;
+ case OPT_LIBYATL_MATCH_WILDCARD:
+ wildcard= optarg;
+ break;
+
case OPT_LIBYATL_MASSIVE:
opt_massive= true;
break;
return EXIT_FAILURE;
}
+ if (getenv("YATL_COLLECTION_TO_RUN"))
+ {
+ if (strlen(getenv("YATL_COLLECTION_TO_RUN")))
+ {
+ collection_to_run= getenv("YATL_COLLECTION_TO_RUN");
+ }
+ }
+
+ if (collection_to_run.compare("none") == 0)
+ {
+ return EXIT_SUCCESS;
+ }
+
+ if (collection_to_run.empty() == false)
+ {
+ Out << "Only testing " << collection_to_run;
+ }
+
int exit_code;
try
do
{
exit_code= EXIT_SUCCESS;
- std::auto_ptr<Framework> frame(new Framework);
-
fatal_assert(sigignore(SIGPIPE) == 0);
libtest::SignalThread signal;
return EXIT_FAILURE;
}
- Stats stats;
-
- get_world(frame.get());
-
- test_return_t error;
- void *creators_ptr= frame->create(error);
-
- switch (error)
- {
- case TEST_SUCCESS:
- break;
-
- case TEST_SKIPPED:
- Out << "SKIP " << argv[0];
- return EXIT_SUCCESS;
-
- case TEST_FAILURE:
- return EXIT_FAILURE;
- }
-
- if (getenv("YATL_COLLECTION_TO_RUN"))
- {
- if (strlen(getenv("YATL_COLLECTION_TO_RUN")))
- {
- collection_to_run= getenv("YATL_COLLECTION_TO_RUN");
- }
- }
-
- if (collection_to_run.compare("none") == 0)
- {
- return EXIT_SUCCESS;
- }
-
- if (collection_to_run.empty() == false)
- {
- Out << "Only testing " << collection_to_run;
- }
-
- char *wildcard= NULL;
- if (argc == 3)
- {
- wildcard= argv[2];
- }
+ std::auto_ptr<Framework> frame(new Framework(signal, collection_to_run, wildcard));
- for (collection_st *next= frame->collections; next and next->name and (not signal.is_shutdown()); next++)
+ // Run create(), bail on error.
{
- if (collection_to_run.empty() == false and fnmatch(collection_to_run.c_str(), next->name, 0))
- {
- continue;
- }
-
- stats.collection_total++;
-
- bool failed= false;
- bool skipped= false;
- test_return_t collection_rc;
- if (test_success(collection_rc= frame->runner()->pre(next->pre, creators_ptr)))
- {
- Out << "Collection: " << next->name;
-
- for (test_st *run= next->tests; run->name; run++)
- {
- long int load_time= 0;
-
- if (wildcard && fnmatch(wildcard, run->name, 0))
- {
- continue;
- }
-
- test_return_t return_code;
- try
- {
- if (run->requires_flush)
- {
- if (test_failed(frame->runner()->flush(creators_ptr)))
- {
- Error << "frame->runner()->flush(creators_ptr)";
- continue;
- }
- }
-
- return_code= runner_code(frame.get(), run, creators_ptr, load_time);
-
- if (return_code == TEST_SKIPPED)
- { }
- else if (return_code == TEST_FAILURE)
- {
-#if 0
- Error << " frame->runner()->run(failure)";
- signal.set_shutdown(SHUTDOWN_GRACEFUL);
-#endif
- }
-
- }
- catch (libtest::fatal &e)
- {
- Error << "Fatal exception was thrown: " << e.what();
- return_code= TEST_FAILURE;
- throw;
- }
- catch (std::exception &e)
- {
- Error << "Exception was thrown: " << e.what();
- return_code= TEST_FAILURE;
- throw;
- }
- catch (...)
- {
- Error << "Unknown exception occurred";
- return_code= TEST_FAILURE;
- throw;
- }
-
- stats.total++;
-
- switch (return_code)
- {
- case TEST_SUCCESS:
- Out << "\tTesting " << run->name << "\t\t\t\t\t" << load_time / 1000 << "." << load_time % 1000 << "[ " << test_strerror(return_code) << " ]";
- stats.success++;
- break;
-
- case TEST_FAILURE:
- stats.failed++;
- failed= true;
- Out << "\tTesting " << run->name << "\t\t\t\t\t" << "[ " << test_strerror(return_code) << " ]";
- break;
-
- case TEST_SKIPPED:
- stats.skipped++;
- skipped= true;
- Out << "\tTesting " << run->name << "\t\t\t\t\t" << "[ " << test_strerror(return_code) << " ]";
- break;
-
- default:
- fatal_message("invalid return code");
- }
-#if 0
- @TODO add code here to allow for a collection to define a method to reset to allow tests to continue.
-#endif
- }
-
- (void) frame->runner()->post(next->post, creators_ptr);
- }
- else if (collection_rc == TEST_FAILURE)
- {
- Out << next->name << " [ failed ]";
- failed= true;
-#if 0
- signal.set_shutdown(SHUTDOWN_GRACEFUL);
-#endif
- }
- else if (collection_rc == TEST_SKIPPED)
+ switch (frame->create())
{
- Out << next->name << " [ skipping ]";
- skipped= true;
- }
-
- if (failed == false and skipped == false)
- {
- stats.collection_success++;
- }
+ case TEST_SUCCESS:
+ break;
- if (failed)
- {
- stats.collection_failed++;
- }
+ case TEST_SKIPPED:
+ Out << "SKIP " << argv[0];
+ return EXIT_SUCCESS;
- if (skipped)
- {
- stats.collection_skipped++;
+ case TEST_FAILURE:
+ return EXIT_FAILURE;
}
-
- Outn();
}
+ frame->exec();
+
if (signal.is_shutdown() == false)
{
signal.set_shutdown(SHUTDOWN_GRACEFUL);
Out << "Tests were aborted.";
exit_code= EXIT_FAILURE;
}
- else if (stats.collection_failed)
+ else if (frame->failed())
{
Out << "Some test failed.";
exit_code= EXIT_FAILURE;
}
- else if (stats.collection_skipped and stats.collection_failed and stats.collection_success)
+ else if (frame->skipped() and frame->failed() and frame->success())
{
Out << "Some tests were skipped.";
}
- else if (stats.collection_success and (stats.collection_failed == 0))
+ else if (frame->success() and (frame->failed() == 0))
{
Out << "All tests completed successfully.";
}
- stats_print(&stats);
+ stats_print(frame.get());
Outn(); // Generate a blank to break up the messages if make check/test has been run
} while (exit_code == EXIT_SUCCESS and --opt_repeat);
catch (libtest::fatal& e)
{
std::cerr << e.what() << std::endl;
+ exit_code= EXIT_FAILURE;
}
catch (libtest::disconnected& e)
{
std::cerr << "Unhandled disconnection occurred:" << e.what() << std::endl;
+ exit_code= EXIT_FAILURE;
}
catch (std::exception& e)
{
std::cerr << e.what() << std::endl;
+ exit_code= EXIT_FAILURE;
}
catch (...)
{
std::cerr << "Unknown exception halted execution." << std::endl;
+ exit_code= EXIT_FAILURE;
}
return exit_code;
#include <signal.h>
-#include <libtest/stats.h>
#include <libtest/signal.h>
#ifndef __INTEL_COMPILER
// If we find that we already have a pid then kill it.
if (has_pid() == true)
{
+#if 0
fatal_message("has_pid() failed, programer error");
+#endif
}
// This needs more work.
if (kill_file(pid_file()) == false)
{
throw libtest::fatal(LIBYATL_DEFAULT_PARAM,
- "Failed to kill off server, waited: %u after startup occurred, when pinging failed: %s stderr:%s",
+ "Failed to kill off server, waited: %u after startup occurred, when pinging failed: %.*s stderr:%.*s",
this_wait,
- pid_file().c_str(),
- _app.stderr_c_str());
+ int(_running.size()), _running.c_str(),
+ int(_app.stderr_result_length()), _app.stderr_c_str());
}
throw libtest::fatal(LIBYATL_DEFAULT_PARAM,
- "Failed native ping(), pid: %d is alive: %s waited: %u server started, having pid_file. exec: %s stderr:%s",
+ "Failed native ping(), pid: %d is alive: %s waited: %u server started, having pid_file. exec: %.*s stderr:%.*s",
int(_app.pid()),
_app.check() ? "true" : "false",
- this_wait, _running.c_str(),
- _app.stderr_c_str());
+ this_wait,
+ int(_running.size()), _running.c_str(),
+ int(_app.stderr_result_length()), _app.stderr_c_str());
}
else
{
throw libtest::fatal(LIBYATL_DEFAULT_PARAM,
- "Failed native ping(), pid: %d is alive: %s waited: %u server started. exec: %s stderr:%s",
+ "Failed native ping(), pid: %d is alive: %s waited: %u server started. exec: %.*s stderr:%.*s",
int(_app.pid()),
_app.check() ? "true" : "false",
this_wait,
- _running.c_str(),
- _app.stderr_c_str());
+ int(_running.size()), _running.c_str(),
+ int(_app.stderr_result_length()), _app.stderr_c_str());
}
_running.clear();
return false;
return tmp;
}
-bool server_startup_st::shutdown(uint32_t number_of_host)
+// host_to_shutdown => host number to shutdown in array
+bool server_startup_st::shutdown(uint32_t host_to_shutdown)
{
- if (servers.size() > number_of_host)
+ if (servers.size() > host_to_shutdown)
{
- Server* tmp= servers[number_of_host];
+ Server* tmp= servers[host_to_shutdown];
- if (tmp and tmp->has_pid() and tmp->kill() == false)
+ if (tmp and tmp->kill() == false)
{ }
else
{
return false;
}
-void server_startup_st::shutdown_and_remove()
+void server_startup_st::clear()
{
for (std::vector<Server *>::iterator iter= servers.begin(); iter != servers.end(); iter++)
{
server_startup_st::~server_startup_st()
{
- shutdown_and_remove();
+ clear();
}
bool server_startup_st::validate()
}
- void shutdown_and_remove();
+ // Just remove everything after shutdown
+ void clear();
+
bool shutdown();
bool shutdown(uint32_t number_of_host);
+++ /dev/null
-/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Data Differential YATL (i.e. libtest) library
- *
- * Copyright (C) 2012 Data Differential, http://datadifferential.com/
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *
- * * The names of its contributors may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#pragma once
-
-struct Stats {
- int32_t collection_success;
- int32_t collection_skipped;
- int32_t collection_failed;
- int32_t collection_total;
-
- uint32_t success;
- uint32_t skipped;
- uint32_t failed;
- uint32_t total;
-
- Stats() :
- collection_success(0),
- collection_skipped(0),
- collection_failed(0),
- collection_total(0),
- success(0),
- skipped(0),
- failed(0),
- total(0)
- { }
-};
-
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Data Differential YATL (i.e. libtest) library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <config.h>
+#include <libtest/stream.h>
+
+namespace libtest {
+namespace stream {
+
+namespace detail {
+
+} // namespace detail
+
+make_cerr::make_cerr(const char* filename, int line_number, const char* func) :
+ log(std::cerr, filename, line_number, func)
+{ }
+
+cerr::cerr(const char* filename, int line_number, const char* func) :
+ log(std::cout, filename, line_number, func)
+ { }
+
+clog::clog(const char* filename, int line_number, const char* func) :
+ log(std::clog, filename, line_number, func)
+ { }
+
+cout::cout(const char* filename, int line_number, const char* func) :
+ log(std::cout, filename, line_number, func)
+ { }
+
+} // namespace stream
+} // namespace libtest
namespace detail {
template<class Ch, class Tr, class A>
- class cerr {
+ class channel {
private:
public:
typedef std::basic_ostringstream<Ch, Tr, A> stream_buffer;
public:
- void operator()(const stream_buffer &s)
+ void operator()(const stream_buffer& s, std::ostream& _out,
+ const char* filename, int line_number, const char* func)
{
- std::cerr << s.str() << std::endl;
- }
- };
-
-template<class Ch, class Tr, class A>
- class make_cerr {
- private:
-
- public:
- typedef std::basic_ostringstream<Ch, Tr, A> stream_buffer;
-
- public:
- void operator()(const stream_buffer &s)
- {
- std::cerr << std::endl << s.str() << std::endl;
- }
- };
-
-template<class Ch, class Tr, class A>
- class cout {
- private:
-
- public:
- typedef std::basic_ostringstream<Ch, Tr, A> stream_buffer;
-
- public:
- void operator()(const stream_buffer &s)
- {
- std::cout << s.str() << std::endl;
+ if (filename)
+ {
+ _out
+ << filename
+ << ":"
+ << line_number
+ << ": in "
+ << func << "() "
+ << s.str()
+ << std::endl;
+ }
+ else
+ {
+ _out
+ << s.str()
+ << std::endl;
+ }
}
};
template<class Ch, class Tr, class A>
- class clog {
+ class channelln {
private:
public:
typedef std::basic_ostringstream<Ch, Tr, A> stream_buffer;
public:
- void operator()(const stream_buffer &s)
+ void operator()(const stream_buffer& s, std::ostream& _out,
+ const char* filename, int line_number, const char* func)
{
- std::cerr<< s.str() << std::endl;
+ if (filename)
+ {
+ _out
+ << std::endl
+ << filename
+ << ":"
+ << line_number
+ << ": in "
+ << func << "() "
+ << s.str()
+ << std::endl;
+ }
+ else
+ {
+ _out
+ << std::endl
+ << s.str()
+ << std::endl;
+ }
}
};
class log {
private:
typedef OutputPolicy<Ch, Tr, A> output_policy;
+
+ private:
+ std::ostream& _out;
const char *_filename;
int _line_number;
const char *_func;
public:
- log() :
- _filename(NULL),
- _line_number(0)
+ log(std::ostream& out_arg, const char* filename, int line_number, const char* func) :
+ _out(out_arg),
+ _filename(filename),
+ _line_number(line_number),
+ _func(func)
{ }
- void set_filename(const char *filename, int line_number, const char *func)
- {
- _filename= filename;
- _line_number= line_number;
- _func= func;
- }
-
~log()
{
- output_policy()(arg);
+ output_policy()(arg, _out, _filename, _line_number, _func);
}
public:
template<class T>
log &operator<<(const T &x)
{
- if (_filename)
- {
- arg << _filename << ":" << _line_number << ": in " << _func << "() ";
- _filename= NULL;
- }
arg << x;
return *this;
}
private:
typename output_policy::stream_buffer arg;
};
-}
+} // namespace detail
-class make_cerr : public detail::log<detail::make_cerr> {
+class make_cerr : public detail::log<detail::channelln> {
public:
- make_cerr(const char *filename, int line_number, const char *func)
- {
- set_filename(filename, line_number, func);
- }
+ make_cerr(const char* filename, int line_number, const char* func);
};
-class cerr : public detail::log<detail::cerr> {
+class cerr : public detail::log<detail::channel> {
public:
- cerr(const char *filename, int line_number, const char *func)
- {
- set_filename(filename, line_number, func);
- }
+ cerr(const char* filename, int line_number, const char* func);
};
-class clog : public detail::log<detail::clog> {
+class clog : public detail::log<detail::channel> {
public:
- clog(const char *, int, const char*)
- { }
+ clog(const char* filename, int line_number, const char* func);
};
-class cout : public detail::log<detail::cout> {
+class cout : public detail::log<detail::channel> {
public:
- cout(const char *, int, const char *)
- { }
+ cout(const char* filename, int line_number, const char* func);
};
#include <libtest/has.hpp>
#include <libtest/error.h>
#include <libtest/strerror.h>
+#include <libtest/timer.hpp>
#include <libtest/stream.h>
#include <libtest/comparison.hpp>
#include <libtest/server.h>
#include <libtest/port.h>
#include <libtest/is_local.hpp>
#include <libtest/socket.hpp>
-#include <libtest/stats.h>
#include <libtest/collection.h>
#include <libtest/framework.h>
#include <libtest/get.h>
-#include <libtest/stream.h>
#include <libtest/cmdline.h>
#include <libtest/string.hpp>
#include <libtest/binaries.h>
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Data Differential YATL (i.e. libtest) library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <config.h>
+#include <libtest/timer.hpp>
+#include <ctime>
+
+namespace libtest {
+
+std::ostream& operator<<(std::ostream& output, const libtest::Timer& arg)
+{
+ struct timespec temp;
+ arg.difference(temp);
+
+ output << temp.tv_sec;
+ output << ":";
+ output << temp.tv_nsec;
+
+ return output;
+}
+
+} // namespace libtest
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Data Differential YATL (i.e. libtest) library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#pragma once
+
+#include <ctime>
+#include <ostream>
+
+#ifdef __MACH__
+# include <mach/clock.h>
+# include <mach/mach.h>
+#else
+# include <sys/time.h>
+#endif
+
+
+namespace libtest {
+
+class Timer {
+public:
+
+ Timer()
+ {
+ _begin.tv_sec= 0;
+ _begin.tv_nsec= 0;
+ _end.tv_sec= 0;
+ _end.tv_nsec= 0;
+ }
+
+ void reset()
+ {
+ _end.tv_sec= 0;
+ _end.tv_nsec= 0;
+ _time(_begin);
+ }
+
+ void sample()
+ {
+ _time(_end);
+ }
+
+ void difference(struct timespec& arg) const
+ {
+ if ((_end.tv_nsec -_begin.tv_nsec) < 0)
+ {
+ arg.tv_sec= _end.tv_sec -_begin.tv_sec-1;
+ arg.tv_nsec= 1000000000 +_end.tv_nsec -_begin.tv_nsec;
+
+ }
+ else
+ {
+ arg.tv_sec= _end.tv_sec -_begin.tv_sec;
+ arg.tv_nsec= _end.tv_nsec -_begin.tv_nsec;
+ }
+ }
+
+private:
+ void _time(struct timespec& ts)
+ {
+#ifdef __MACH__ // OSX lacks clock_gettime()
+ clock_serv_t _clock_serv;
+ mach_timespec_t _mach_timespec;
+ host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &_clock_serv);
+ clock_get_time(_clock_serv, &_mach_timespec);
+ mach_port_deallocate(mach_task_self(), _clock_serv);
+ ts.tv_sec= _mach_timespec.tv_sec;
+ ts.tv_nsec= _mach_timespec.tv_nsec;
+#else
+ clock_gettime(CLOCK_REALTIME, &ts);
+#endif
+ }
+
+private:
+ struct timespec _begin;
+ struct timespec _end;
+};
+
+std::ostream& operator<<(std::ostream& output, const libtest::Timer& arg);
+
+} // namespace libtest
AH_BOTTOM([
+#define __STDC_FORMAT_MACROS
+
#if defined(__cplusplus)
-#include CSTDINT_H
-#include CINTTYPES_H
+# include CINTTYPES_H
#else
-#include <stdint.h>
-#include <inttypes.h>
+# include <inttypes.h>
#endif
#if !defined(HAVE_ULONG) && !defined(__USE_MISC)
AM_CONDITIONAL(HAVE_SPHINX,[test "x${SPHINXBUILD}" != "x:"])
AM_CONDITIONAL(HAVE_RECENT_SPHINX,[test "x${ac_cv_recent_sphinx}" = "xyes"])
- AS_IF([test "x${gl_LIBOBJS}" != "x"],[
- AS_IF([test "$GCC" = "yes"],[
- AM_CPPFLAGS="-isystem \${top_srcdir}/gnulib -isystem \${top_builddir}/gnulib ${AM_CPPFLAGS}"
- ],[
- AM_CPPFLAGS="-I\${top_srcdir}/gnulib -I\${top_builddir}/gnulib ${AM_CPPFLAGS}"
- ])
- ])
m4_if(m4_substr(m4_esyscmd(test -d src && echo 0),0,1),0,[
AM_CPPFLAGS="-I\$(top_srcdir)/src -I\$(top_builddir)/src ${AM_CPPFLAGS}"
],[
static test_return_t shutdown_and_remove_TEST(void *obj)
{
server_startup_st *servers= (server_startup_st*)obj;
- servers->shutdown_and_remove();
+ servers->clear();
return TEST_SUCCESS;
}
static test_return_t collection_FINAL(void *object)
{
server_startup_st *servers= (server_startup_st*)object;
- servers->shutdown_and_remove();
+ servers->clear();
return TEST_SUCCESS;
}
memcached_return_t ret;
do {
- sleep(3);
+ libtest::dream(3, 0);
ret= memcached_set(memc, test_literal_param("foo"), NULL, 0, time_t(0), uint32_t(0));
} while (ret == MEMCACHED_SERVER_TEMPORARILY_DISABLED);
test_compare(MEMCACHED_SERVER_TEMPORARILY_DISABLED, ret);
do {
- sleep(3);
+ libtest::dream(3, 0);
ret= memcached_set(memc, test_literal_param("foo"), NULL, 0, time_t(0), uint32_t(0));
} while (ret == MEMCACHED_SERVER_TEMPORARILY_DISABLED or ret == MEMCACHED_SUCCESS);
{ 0, 0, 0, 0 }
};
-#include "libmemcached_world.h"
+#include "tests/libmemcached_world.h"
void get_world(Framework *world)
{
include tests/libmemcached-1.0/include.am
+include tests/parser.am
+
tests_failure_SOURCES=
tests_failure_SOURCES+= tests/failure.cc
tests_failure_SOURCES+= clients/execute.cc
check_PROGRAMS+= tests/failure
noinst_PROGRAMS+= tests/failure
-tests_testhashkit_SOURCES = tests/hashkit_functions.cc
-tests_testhashkit_DEPENDENCIES = libtest/libtest.la libhashkit/libhashkit.la $(TESTS_LDADDS)
-tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES)
+test-failure: tests/failure
+ @tests/failure
+
+gdb-failure: tests/failure
+ @$(DEBUG_COMMAND) tests/failure
+
+
+tests_testhashkit_SOURCES= tests/hashkit_functions.cc
+tests_testhashkit_DEPENDENCIES= libtest/libtest.la libhashkit/libhashkit.la $(TESTS_LDADDS)
+tests_testhashkit_LDADD= $(tests_testhashkit_DEPENDENCIES)
check_PROGRAMS+= tests/testhashkit
noinst_PROGRAMS+= tests/testhashkit
+test-hash: tests/testhashkit
+ @tests/testhashkit
+
+
tests_hash_plus_SOURCES= tests/hash_plus.cc
tests_hash_plus_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
tests_hash_plus_DEPENDENCIES= $(tests_testhashkit_DEPENDENCIES)
test-plus: tests/testplus
@tests/testplus
-test-hash: tests/testhashkit
- @tests/testhashkit
-
test-hashplus: tests/hash_plus
@tests/hash_plus
gdb-cycle: tests/cycle
@$(DEBUG_COMMAND) tests/cycle
-gdb-failure: tests/failure
- @$(DEBUG_COMMAND) tests/failure
-
valgrind-cycle: tests/cycle
$(VALGRIND_COMMAND) tests/cycle
#include "tests/exist.h"
#include "tests/ketama.h"
#include "tests/namespace.h"
-#include "tests/parser.h"
#include "tests/libmemcached-1.0/dump.h"
#include "tests/libmemcached-1.0/generate.h"
#include "tests/libmemcached-1.0/haldenbrand.h"
+#include "tests/libmemcached-1.0/parser.h"
#include "tests/libmemcached-1.0/stat.h"
#include "tests/touch.h"
#include "tests/callbacks.h"
#include "tests/exist.h"
#include "tests/ketama.h"
#include "tests/namespace.h"
-#include "tests/parser.h"
+#include "tests/libmemcached-1.0/parser.h"
#include "tests/libmemcached-1.0/dump.h"
#include "tests/libmemcached-1.0/generate.h"
#include "tests/libmemcached-1.0/haldenbrand.h"
noinst_HEADERS+= tests/libmemcached-1.0/all_tests.h
noinst_HEADERS+= tests/libmemcached-1.0/callback_counter.h
noinst_HEADERS+= tests/libmemcached-1.0/dump.h
+noinst_HEADERS+= tests/libmemcached-1.0/encoding_key.h
noinst_HEADERS+= tests/libmemcached-1.0/fetch_all_results.h
noinst_HEADERS+= tests/libmemcached-1.0/generate.h
-noinst_HEADERS+= tests/libmemcached-1.0/encoding_key.h
noinst_HEADERS+= tests/libmemcached-1.0/haldenbrand.h
noinst_HEADERS+= tests/libmemcached-1.0/mem_functions.h
noinst_HEADERS+= tests/libmemcached-1.0/memcached_get.h
+noinst_HEADERS+= tests/libmemcached-1.0/parser.h
noinst_HEADERS+= tests/libmemcached-1.0/setup_and_teardowns.h
noinst_HEADERS+= tests/libmemcached-1.0/stat.h
noinst_HEADERS+= tests/namespace.h
-noinst_HEADERS+= tests/parser.h
noinst_HEADERS+= tests/pool.h
noinst_HEADERS+= tests/print.h
noinst_HEADERS+= tests/replication.h
#include <libmemcached/memcached.h>
#include <libmemcached/util.h>
-#include <tests/parser.h>
+#include <tests/libmemcached-1.0/parser.h>
#include <tests/print.h>
enum scanner_type_t
return MEMCACHED_SUCCESS;
}
-
test_return_t test_hostname_port_weight(memcached_st *)
{
const char *server_string= "--server=localhost:8888/?2 --server=localhost:8889/?3 --server=localhost:8890/?4 --server=localhost:8891/?5 --server=localhost:8892/?3";
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Libmemcached
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+test_return_t memcached_NULL_string_TEST(memcached_st*);
+test_return_t memcached_zero_string_length_TEST(memcached_st*);
+
+LIBTEST_LOCAL
+test_return_t server_test(memcached_st *memc);
+
+LIBTEST_LOCAL
+test_return_t servers_bad_test(memcached_st *memc);
+
+LIBTEST_LOCAL
+test_return_t behavior_parser_test(memcached_st*);
+
+LIBTEST_LOCAL
+test_return_t parser_number_options_test(memcached_st*);
+
+LIBTEST_LOCAL
+test_return_t parser_distribution_test(memcached_st*);
+
+LIBTEST_LOCAL
+test_return_t parser_hash_test(memcached_st*);
+
+LIBTEST_LOCAL
+test_return_t parser_boolean_options_test(memcached_st*);
+
+LIBTEST_LOCAL
+test_return_t parser_key_prefix_test(memcached_st*);
+
+LIBTEST_LOCAL
+ test_return_t libmemcached_check_configuration_test(memcached_st*);
+
+LIBTEST_LOCAL
+ test_return_t memcached_create_with_options_test(memcached_st*);
+
+LIBTEST_LOCAL
+ test_return_t memcached_create_with_options_with_filename(memcached_st*);
+
+LIBTEST_LOCAL
+ test_return_t libmemcached_check_configuration_with_filename_test(memcached_st*);
+
+LIBTEST_LOCAL
+ test_return_t random_statement_build_test(memcached_st*);
+
+LIBTEST_LOCAL
+test_return_t test_include_keyword(memcached_st*);
+
+LIBTEST_LOCAL
+test_return_t test_end_keyword(memcached_st*);
+
+LIBTEST_LOCAL
+test_return_t test_reset_keyword(memcached_st*);
+
+LIBTEST_LOCAL
+test_return_t test_error_keyword(memcached_st*);
+
+LIBTEST_LOCAL
+test_return_t server_with_weight_test(memcached_st *);
+
+LIBTEST_LOCAL
+test_return_t test_hostname_port_weight(memcached_st *);
+
+LIBTEST_LOCAL
+test_return_t regression_bug_71231153_connect(memcached_st *);
+
+LIBTEST_LOCAL
+test_return_t regression_bug_71231153_poll(memcached_st *);
+
+LIBTEST_LOCAL
+test_return_t test_parse_socket(memcached_st *);
+
+LIBTEST_LOCAL
+test_return_t test_namespace_keyword(memcached_st*);
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null
+# vim:ft=automake
+# Copyright (C) 2012 Data Differential
+# All rights reserved.
+#
+# Use and distribution licensed under the BSD license. See
+# the COPYING file in the parent directory for full text.
+#
+# included from Top Level Makefile.am
+# All paths should be given relative to the root
+
+noinst_HEADERS+= tests/libmemcached-1.0/parser.h
+
+tests_parser_SOURCES=
+tests_parser_CXXFLAGS=
+tests_parser_DEPENDENCIES=
+tests_parser_LDADD=
+
+tests_parser_SOURCES+= tests/parser.cc
+
+tests_parser_CXXFLAGS+= $(AM_CXXFLAGS) $(NO_EFF_CXX)
+tests_parser_DEPENDENCIES+= $(TESTS_LDADDS)
+tests_parser_LDADD+= $(tests_parser_DEPENDENCIES)
+check_PROGRAMS+= tests/parser
+noinst_PROGRAMS+= tests/parser
+
+test-parser: tests/parser
+ @tests/parser
+
+valgrind-parser: tests/parser
+ $(VALGRIND_COMMAND) tests/parser
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Libmemcached library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <config.h>
+
+/*
+ C++ interface test
+*/
+#include <libmemcached-1.0/memcached.hpp>
+#include <libtest/test.hpp>
+
+using namespace libtest;
+
+static test_return_t memcached_NULL_string_TEST(void*)
+{
+ test_null(memcached(NULL, 75));
+ return TEST_SUCCESS;
+}
+
+static test_return_t memcached_zero_string_length_TEST(void*)
+{
+ test_null(memcached("value", 0));
+ return TEST_SUCCESS;
+}
+
+static test_return_t putenv_localhost_quoted_TEST(void*)
+{
+ char set_env[1024];
+
+ snprintf(set_env, sizeof(set_env), "LIBMEMCACHED=\"--server=localhost\"");
+ test_zero(putenv(set_env));
+ test_null(memcached(NULL, 0));
+
+ return TEST_SUCCESS;
+}
+
+static test_return_t putenv_NULL_TEST(void*)
+{
+ char set_env[1024];
+
+ snprintf(set_env, sizeof(set_env), "LIBMEMCACHED");
+ test_zero(putenv(set_env));
+ memcached_st *memc= memcached(NULL, 0);
+ test_true(memc);
+
+ memcached_free(memc);
+
+ return TEST_SUCCESS;
+}
+
+static test_return_t putenv_NULL_TEST2(void*)
+{
+ char set_env[1024];
+
+ snprintf(set_env, sizeof(set_env), "LIBMEMCACHED=");
+ test_zero(putenv(set_env));
+ memcached_st *memc= memcached(NULL, 0);
+ test_true(memc);
+
+ memcached_free(memc);
+
+ return TEST_SUCCESS;
+}
+
+static test_return_t putenv_localhost_TEST(void*)
+{
+ char set_env[1024];
+
+ snprintf(set_env, sizeof(set_env), "LIBMEMCACHED=--server=localhost");
+ test_zero(putenv(set_env));
+ memcached_st *memc= memcached(NULL, 0);
+ test_true(memc);
+
+ memcached_free(memc);
+
+ return TEST_SUCCESS;
+}
+
+test_st memcached_TESTS[] ={
+ {"memcached(NULL, 75)", false, (test_callback_fn*)memcached_NULL_string_TEST },
+ {"memcached(\"value\", 0)", false, (test_callback_fn*)memcached_zero_string_length_TEST },
+ {"putenv(LIBMEMCACHED=--server=localhost)", false, (test_callback_fn*)putenv_localhost_TEST },
+ {"putenv(LIBMEMCACHED)", false, (test_callback_fn*)putenv_NULL_TEST },
+ {"putenv(LIBMEMCACHED=)", false, (test_callback_fn*)putenv_NULL_TEST2 },
+ {"putenv(LIBMEMCACHED=--server=\"localhost\")", false, (test_callback_fn*)putenv_localhost_quoted_TEST },
+ {0, 0, 0}
+};
+
+collection_st collection[] ={
+ {"memcached()", 0, 0, memcached_TESTS},
+ {0, 0, 0, 0}
+};
+
+void get_world(Framework *world)
+{
+ world->collections= collection;
+}
+
+++ /dev/null
-/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Libmemcached
- *
- * Copyright (C) 2011 Data Differential, http://datadifferential.com/
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *
- * * The names of its contributors may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-LIBTEST_LOCAL
-test_return_t server_test(memcached_st *memc);
-
-LIBTEST_LOCAL
-test_return_t servers_bad_test(memcached_st *memc);
-
-LIBTEST_LOCAL
-test_return_t behavior_parser_test(memcached_st*);
-
-LIBTEST_LOCAL
-test_return_t parser_number_options_test(memcached_st*);
-
-LIBTEST_LOCAL
-test_return_t parser_distribution_test(memcached_st*);
-
-LIBTEST_LOCAL
-test_return_t parser_hash_test(memcached_st*);
-
-LIBTEST_LOCAL
-test_return_t parser_boolean_options_test(memcached_st*);
-
-LIBTEST_LOCAL
-test_return_t parser_key_prefix_test(memcached_st*);
-
-LIBTEST_LOCAL
- test_return_t libmemcached_check_configuration_test(memcached_st*);
-
-LIBTEST_LOCAL
- test_return_t memcached_create_with_options_test(memcached_st*);
-
-LIBTEST_LOCAL
- test_return_t memcached_create_with_options_with_filename(memcached_st*);
-
-LIBTEST_LOCAL
- test_return_t libmemcached_check_configuration_with_filename_test(memcached_st*);
-
-LIBTEST_LOCAL
- test_return_t random_statement_build_test(memcached_st*);
-
-LIBTEST_LOCAL
-test_return_t test_include_keyword(memcached_st*);
-
-LIBTEST_LOCAL
-test_return_t test_end_keyword(memcached_st*);
-
-LIBTEST_LOCAL
-test_return_t test_reset_keyword(memcached_st*);
-
-LIBTEST_LOCAL
-test_return_t test_error_keyword(memcached_st*);
-
-LIBTEST_LOCAL
-test_return_t server_with_weight_test(memcached_st *);
-
-LIBTEST_LOCAL
-test_return_t test_hostname_port_weight(memcached_st *);
-
-LIBTEST_LOCAL
-test_return_t regression_bug_71231153_connect(memcached_st *);
-
-LIBTEST_LOCAL
-test_return_t regression_bug_71231153_poll(memcached_st *);
-
-LIBTEST_LOCAL
-test_return_t test_parse_socket(memcached_st *);
-
-LIBTEST_LOCAL
-test_return_t test_namespace_keyword(memcached_st*);
-
-#ifdef __cplusplus
-}
-#endif
test_null(container->parent());
container->parent(memcached(container->construct.option_string().c_str(), container->construct.option_string().size()));
test_true(container->parent());
+#if 0
test_compare(MEMCACHED_SUCCESS, memcached_version(container->parent()));
+#endif
if (container->construct.sasl())
{