From 3ffc968aaf182bf1ff1e18157c7bde2bdb41668d Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Thu, 17 Dec 2020 17:38:28 +0100 Subject: [PATCH] semver: 1.0 -> 1 --- CMake/InstallPublicHeaders.cmake | 4 +- CMakeVersions.txt | 8 +- ChangeLog-1.1.md | 1 + contrib/bin/memaslap/ms_conn.h | 2 +- docs/source/libmemcached/versioning.rst | 12 +- example/interface_v0.cc | 2 +- example/interface_v1.cc | 2 +- example/memcached_light.cc | 2 +- include/CMakeLists.txt | 24 +- include/libhashkit-1.0 | 1 + .../CMakeLists.txt | 2 +- .../algorithm.h | 0 .../basic_string.h | 0 .../behavior.h | 0 .../configure.h.in | 0 .../{libhashkit-1.0 => libhashkit-1}/digest.h | 0 .../function.h | 0 .../{libhashkit-1.0 => libhashkit-1}/has.h | 0 .../hashkit.h | 22 +- .../hashkit.hpp | 2 +- .../str_algorithm.h | 0 .../strerror.h | 0 .../{libhashkit-1.0 => libhashkit-1}/string.h | 0 .../{libhashkit-1.0 => libhashkit-1}/types.h | 0 .../visibility.h | 0 include/libmemcached-1.0 | 1 + .../CMakeLists.txt | 2 +- .../alloc.h | 0 .../allocators.h | 0 .../analyze.h | 2 +- .../auto.h | 0 .../basic_string.h | 0 .../behavior.h | 0 .../callback.h | 0 .../callbacks.h | 0 .../configure.h.in | 0 .../defaults.h | 0 .../delete.h | 0 .../deprecated_types.h | 0 .../dump.h | 0 .../encoding_key.h | 0 .../error.h | 0 .../exception.hpp | 0 .../exist.h | 0 .../fetch.h | 0 .../flush.h | 0 .../flush_buffers.h | 0 .../get.h | 0 .../hash.h | 0 .../limits.h | 0 .../memcached.h | 126 +- .../memcached.hpp | 2 +- .../options.h | 0 .../parse.h | 0 .../platform.h | 2 +- .../quit.h | 0 .../result.h | 2 +- .../return.h | 0 .../sasl.h | 2 +- .../server.h | 2 +- .../server_list.h | 0 .../stats.h | 2 +- .../storage.h | 0 .../strerror.h | 0 .../struct/CMakeLists.txt | 2 +- .../struct/allocator.h | 0 .../struct/analysis.h | 0 .../struct/callback.h | 0 .../struct/memcached.h | 0 .../struct/result.h | 0 .../struct/sasl.h | 0 .../struct/server.h | 2 +- .../struct/stat.h | 0 .../struct/string.h | 0 .../touch.h | 0 .../triggers.h | 0 .../types.h | 0 .../types/CMakeLists.txt | 2 +- .../types/behavior.h | 0 .../types/callback.h | 0 .../types/connection.h | 0 .../types/hash.h | 0 .../types/return.h | 0 .../types/server_distribution.h | 0 .../verbosity.h | 0 .../version.h | 0 .../visibility.h | 0 include/libmemcachedprotocol-0.0 | 1 + .../CMakeLists.txt | 2 +- .../binary.h | 2 +- .../callback.h | 0 .../handler.h | 8 +- .../vbucket.h | 0 include/libmemcachedutil-1.0 | 1 + include/libmemcachedutil-1.0/util.h | 24 - .../CMakeLists.txt | 2 +- .../flush.h | 0 .../ostream.hpp | 0 .../pid.h | 0 .../ping.h | 0 .../pool.h | 2 +- include/libmemcachedutil-1/util.h | 24 + .../version.h | 0 src/bin/memcapable.cc | 4 +- src/bin/memparse.cc | 2 +- src/libhashkit/common.h | 2 +- src/libhashkit/hashkit.h | 2 +- src/libmemcached/common.h | 4 +- src/libmemcached/memcached.h | 2 +- src/libmemcached/memcached.hpp | 2 +- src/libmemcached/util.h | 2 +- src/libmemcachedprotocol/common.h | 2 +- src/libmemcachedutil/common.h | 2 +- src/p9y/gettimeofday.hpp | 2 +- src/p9y/poll.hpp | 2 +- src/p9y/socket.hpp | 2 +- src/win32/wrappers.h | 104 -- support/ax_libmemcached.m4 | 16 +- test/tests/hashkit/basic.cpp | 2 +- .../memcached/regression/lp_000-962-815.cpp | 2 +- test/tests/memcached/util_pool_thread.cpp | 2 +- tests/keys.hpp | 145 -- tests/libmemcached-1.0/CMakeLists.txt | 99 -- tests/libmemcached-1.0/all_tests.cc | 97 -- tests/libmemcached-1.0/all_tests_socket.cc | 80 -- tests/libmemcached-1.0/generate.cc | 396 ------ tests/libmemcached-1.0/mem_functions.cc | 1262 ----------------- tests/libmemcached-1.0/mem_functions.h | 190 --- .../memcached_fetch_execute.cc | 62 - .../memcached_fetch_execute.h | 39 - tests/libmemcached-1.0/memcached_get.cc | 219 --- tests/libmemcached-1.0/memcached_get.h | 44 - tests/libmemcached-1.0/plus.cpp | 342 ----- tests/libmemcached-1.0/setup_and_teardowns.cc | 288 ---- tests/libmemcached-1.0/setup_and_teardowns.h | 67 - tests/libmemcached-1.0/string.cc | 192 --- 136 files changed, 185 insertions(+), 3792 deletions(-) create mode 120000 include/libhashkit-1.0 rename include/{libhashkit-1.0 => libhashkit-1}/CMakeLists.txt (88%) rename include/{libhashkit-1.0 => libhashkit-1}/algorithm.h (100%) rename include/{libhashkit-1.0 => libhashkit-1}/basic_string.h (100%) rename include/{libhashkit-1.0 => libhashkit-1}/behavior.h (100%) rename include/{libhashkit-1.0 => libhashkit-1}/configure.h.in (100%) rename include/{libhashkit-1.0 => libhashkit-1}/digest.h (100%) rename include/{libhashkit-1.0 => libhashkit-1}/function.h (100%) rename include/{libhashkit-1.0 => libhashkit-1}/has.h (100%) rename include/{libhashkit-1.0 => libhashkit-1}/hashkit.h (83%) rename include/{libhashkit-1.0 => libhashkit-1}/hashkit.hpp (98%) rename include/{libhashkit-1.0 => libhashkit-1}/str_algorithm.h (100%) rename include/{libhashkit-1.0 => libhashkit-1}/strerror.h (100%) rename include/{libhashkit-1.0 => libhashkit-1}/string.h (100%) rename include/{libhashkit-1.0 => libhashkit-1}/types.h (100%) rename include/{libhashkit-1.0 => libhashkit-1}/visibility.h (100%) create mode 120000 include/libmemcached-1.0 rename include/{libmemcached-1.0 => libmemcached-1}/CMakeLists.txt (97%) rename include/{libmemcached-1.0 => libmemcached-1}/alloc.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/allocators.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/analyze.h (96%) rename include/{libmemcached-1.0 => libmemcached-1}/auto.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/basic_string.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/behavior.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/callback.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/callbacks.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/configure.h.in (100%) rename include/{libmemcached-1.0 => libmemcached-1}/defaults.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/delete.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/deprecated_types.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/dump.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/encoding_key.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/error.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/exception.hpp (100%) rename include/{libmemcached-1.0 => libmemcached-1}/exist.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/fetch.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/flush.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/flush_buffers.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/get.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/hash.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/limits.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/memcached.h (50%) rename include/{libmemcached-1.0 => libmemcached-1}/memcached.hpp (99%) rename include/{libmemcached-1.0 => libmemcached-1}/options.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/parse.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/platform.h (97%) rename include/{libmemcached-1.0 => libmemcached-1}/quit.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/result.h (98%) rename include/{libmemcached-1.0 => libmemcached-1}/return.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/sasl.h (97%) rename include/{libmemcached-1.0 => libmemcached-1}/server.h (98%) rename include/{libmemcached-1.0 => libmemcached-1}/server_list.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/stats.h (97%) rename include/{libmemcached-1.0 => libmemcached-1}/storage.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/strerror.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/struct/CMakeLists.txt (85%) rename include/{libmemcached-1.0 => libmemcached-1}/struct/allocator.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/struct/analysis.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/struct/callback.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/struct/memcached.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/struct/result.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/struct/sasl.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/struct/server.h (98%) rename include/{libmemcached-1.0 => libmemcached-1}/struct/stat.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/struct/string.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/touch.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/triggers.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/types.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/types/CMakeLists.txt (83%) rename include/{libmemcached-1.0 => libmemcached-1}/types/behavior.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/types/callback.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/types/connection.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/types/hash.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/types/return.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/types/server_distribution.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/verbosity.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/version.h (100%) rename include/{libmemcached-1.0 => libmemcached-1}/visibility.h (100%) create mode 120000 include/libmemcachedprotocol-0.0 rename include/{libmemcachedprotocol-0.0 => libmemcachedprotocol-0}/CMakeLists.txt (75%) rename include/{libmemcachedprotocol-0.0 => libmemcachedprotocol-0}/binary.h (99%) rename include/{libmemcachedprotocol-0.0 => libmemcachedprotocol-0}/callback.h (100%) rename include/{libmemcachedprotocol-0.0 => libmemcachedprotocol-0}/handler.h (97%) rename include/{libmemcachedprotocol-0.0 => libmemcachedprotocol-0}/vbucket.h (100%) create mode 120000 include/libmemcachedutil-1.0 delete mode 100644 include/libmemcachedutil-1.0/util.h rename include/{libmemcachedutil-1.0 => libmemcachedutil-1}/CMakeLists.txt (83%) rename include/{libmemcachedutil-1.0 => libmemcachedutil-1}/flush.h (100%) rename include/{libmemcachedutil-1.0 => libmemcachedutil-1}/ostream.hpp (100%) rename include/{libmemcachedutil-1.0 => libmemcachedutil-1}/pid.h (100%) rename include/{libmemcachedutil-1.0 => libmemcachedutil-1}/ping.h (100%) rename include/{libmemcachedutil-1.0 => libmemcachedutil-1}/pool.h (98%) create mode 100644 include/libmemcachedutil-1/util.h rename include/{libmemcachedutil-1.0 => libmemcachedutil-1}/version.h (100%) delete mode 100644 src/win32/wrappers.h delete mode 100644 tests/keys.hpp delete mode 100644 tests/libmemcached-1.0/CMakeLists.txt delete mode 100644 tests/libmemcached-1.0/all_tests.cc delete mode 100644 tests/libmemcached-1.0/all_tests_socket.cc delete mode 100644 tests/libmemcached-1.0/generate.cc delete mode 100644 tests/libmemcached-1.0/mem_functions.cc delete mode 100644 tests/libmemcached-1.0/mem_functions.h delete mode 100644 tests/libmemcached-1.0/memcached_fetch_execute.cc delete mode 100644 tests/libmemcached-1.0/memcached_fetch_execute.h delete mode 100644 tests/libmemcached-1.0/memcached_get.cc delete mode 100644 tests/libmemcached-1.0/memcached_get.h delete mode 100644 tests/libmemcached-1.0/plus.cpp delete mode 100644 tests/libmemcached-1.0/setup_and_teardowns.cc delete mode 100644 tests/libmemcached-1.0/setup_and_teardowns.h delete mode 100644 tests/libmemcached-1.0/string.cc diff --git a/CMake/InstallPublicHeaders.cmake b/CMake/InstallPublicHeaders.cmake index 05629d67..ae2fa711 100644 --- a/CMake/InstallPublicHeaders.cmake +++ b/CMake/InstallPublicHeaders.cmake @@ -23,8 +23,8 @@ function(install_public_headers DIRECTORY) string(TOUPPER ${LIBRARY} LIBRARY_UCASE) math(EXPR DASH "${DASH} + 1") string(SUBSTRING ${TOP} ${DASH} -1 VERSION) - if(NOT ${LIBRARY_UCASE}_VERSION_INC VERSION_EQUAL ${VERSION}) - message(SEND_ERROR "${LIBRARY} public include directory version ${VERSION} != " ${${LIBRARY_UCASE}_VERSION_INC}) + if(NOT ${LIBRARY_UCASE}_VERSION_MAJOR VERSION_EQUAL ${VERSION}) + message(SEND_ERROR "${LIBRARY} public include directory version ${VERSION} != " ${${LIBRARY_UCASE}_VERSION_MAJOR}) set(ENV{INVALID_CONFIGURATION} 1) endif() endif() diff --git a/CMakeVersions.txt b/CMakeVersions.txt index 8243ec38..dd2e7ed6 100644 --- a/CMakeVersions.txt +++ b/CMakeVersions.txt @@ -19,11 +19,10 @@ endfunction() # set(LIBMEMCACHED_VERSION_MAJOR 1) -set(LIBMEMCACHED_VERSION_MINOR 0) -set(LIBMEMCACHED_VERSION_PATCH 99) +set(LIBMEMCACHED_VERSION_MINOR 1) +set(LIBMEMCACHED_VERSION_PATCH 0) set(LIBMEMCACHED_VERSION ${LIBMEMCACHED_VERSION_MAJOR}.${LIBMEMCACHED_VERSION_MINOR}.${LIBMEMCACHED_VERSION_PATCH}) -set(LIBMEMCACHED_VERSION_INC ${LIBMEMCACHED_VERSION_MAJOR}.${LIBMEMCACHED_VERSION_MINOR}) to_hex(LIBMEMCACHED_VERSION_HEX ${LIBMEMCACHED_VERSION_MAJOR} ${LIBMEMCACHED_VERSION_MINOR} ${LIBMEMCACHED_VERSION_PATCH}) # libmemcached.so @@ -43,7 +42,6 @@ set(LIBMEMCACHEDUTIL_VERSION_MINOR 0) set(LIBMEMCACHEDUTIL_VERSION_PATCH 0) set(LIBMEMCACHEDUTIL_VERSION ${LIBMEMCACHEDUTIL_VERSION_MAJOR}.${LIBMEMCACHEDUTIL_VERSION_MINOR}.${LIBMEMCACHEDUTIL_VERSION_PATCH}) -set(LIBMEMCACHEDUTIL_VERSION_INC ${LIBMEMCACHEDUTIL_VERSION_MAJOR}.${LIBMEMCACHEDUTIL_VERSION_MINOR}) to_hex(LIBMEMCACHEDUTIL_VERSION_HEX ${LIBMEMCACHEDUTIL_VERSION_MAJOR} ${LIBMEMCACHEDUTIL_VERSION_MINOR} ${LIBMEMCACHEDUTIL_VERSION_PATCH}) # libmemcachedutil.so @@ -63,7 +61,6 @@ set(LIBMEMCACHEDPROTOCOL_VERSION_MINOR 0) set(LIBMEMCACHEDPROTOCOL_VERSION_PATCH 0) set(LIBMEMCACHEDPROTOCOL_VERSION ${LIBMEMCACHEDPROTOCOL_VERSION_MAJOR}.${LIBMEMCACHEDPROTOCOL_VERSION_MINOR}.${LIBMEMCACHEDPROTOCOL_VERSION_PATCH}) -set(LIBMEMCACHEDPROTOCOL_VERSION_INC ${LIBMEMCACHEDPROTOCOL_VERSION_MAJOR}.${LIBMEMCACHEDPROTOCOL_VERSION_MINOR}) to_hex(LIBMEMCACHEDPROTOCOL_VERSION_HEX ${LIBMEMCACHEDPROTOCOL_VERSION_MAJOR} ${LIBMEMCACHEDPROTOCOL_VERSION_MINOR} ${LIBMEMCACHEDPROTOCOL_VERSION_PATCH}) # libmemcachedprotocol.so @@ -83,7 +80,6 @@ set(LIBHASHKIT_VERSION_MINOR 0) set(LIBHASHKIT_VERSION_PATCH 0) set(LIBHASHKIT_VERSION ${LIBHASHKIT_VERSION_MAJOR}.${LIBHASHKIT_VERSION_MINOR}.${LIBHASHKIT_VERSION_PATCH}) -set(LIBHASHKIT_VERSION_INC ${LIBHASHKIT_VERSION_MAJOR}.${LIBHASHKIT_VERSION_MINOR}) to_hex(LIBHASHKIT_VERSION_HEX ${LIBHASHKIT_VERSION_MAJOR} ${LIBHASHKIT_VERSION_MINOR} ${LIBHASHKIT_VERSION_PATCH}) # libhashkit.so diff --git a/ChangeLog-1.1.md b/ChangeLog-1.1.md index 5aa10d3d..465a3443 100644 --- a/ChangeLog-1.1.md +++ b/ChangeLog-1.1.md @@ -12,6 +12,7 @@ was incremented due to the following changes: * Ported test suite to Catch2. * Build requires C++11 compiler support. * Tests require C++17 compiler support. +* Moved to the Semantic Versioning Specification: https://semver.org * Moved the project from launchpad to github: * Source: https://github.com/m6w6/libmemcached * Documentation: https://m6w6.github.io/libmemcached diff --git a/contrib/bin/memaslap/ms_conn.h b/contrib/bin/memaslap/ms_conn.h index 426eae82..e3c4f91e 100644 --- a/contrib/bin/memaslap/ms_conn.h +++ b/contrib/bin/memaslap/ms_conn.h @@ -22,7 +22,7 @@ #include #include "ms_task.h" -#include "libmemcachedprotocol-0.0/binary.h" +#include "libmemcachedprotocol-0/binary.h" #ifdef __cplusplus extern "C" { diff --git a/docs/source/libmemcached/versioning.rst b/docs/source/libmemcached/versioning.rst index c7e13270..161e2d8d 100644 --- a/docs/source/libmemcached/versioning.rst +++ b/docs/source/libmemcached/versioning.rst @@ -1,10 +1,12 @@ libmemcached Versioning ======================= -Libmemcached is laid out by interface version. The 1.0 version would be found -in: ``libmemcached-1.0/memcached.h`` +Libmemcached is laid out by interface version and strives to adhere to the +``Semantic Versioning Specification`` since version ``1.1``. -The historic ``libmemcached/memcached.h`` includes -``libmemcached-1.0/memcached.h``. For best practice you should include the -version of libmemcached that you used during development. +.. seealso:: + `https://semver.org/ `_ +The 1.x version would be found in: ``libmemcached-1/memcached.h``. The historic +``libmemcached/memcached.h`` includes ``libmemcached-1/memcached.h`` and on +previously supported platforms ``libmemcached-1.0`` points to ``libmemcached-1``. diff --git a/example/interface_v0.cc b/example/interface_v0.cc index cf600124..cf53dded 100644 --- a/example/interface_v0.cc +++ b/example/interface_v0.cc @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include "example/memcached_light.h" #include "example/storage.h" diff --git a/example/interface_v1.cc b/example/interface_v1.cc index c6f5bf19..e0a38355 100644 --- a/example/interface_v1.cc +++ b/example/interface_v1.cc @@ -20,7 +20,7 @@ #if HAVE_UNISTD_H # include #endif -#include +#include #include #include "example/memcached_light.h" #include "example/storage.h" diff --git a/example/memcached_light.cc b/example/memcached_light.cc index 714bb16f..c76a42c2 100644 --- a/example/memcached_light.cc +++ b/example/memcached_light.cc @@ -25,7 +25,7 @@ #include -#include +#include #include #include #include "example/storage.h" diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index bc3dadc5..3eccec1d 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,5 +1,21 @@ -add_subdirectory(libhashkit-1.0) -add_subdirectory(libmemcached-1.0) -add_subdirectory(libmemcachedutil-1.0) -add_subdirectory(libmemcachedprotocol-0.0) +add_subdirectory(libhashkit-1) +add_subdirectory(libmemcached-1) +add_subdirectory(libmemcachedutil-1) +add_subdirectory(libmemcachedprotocol-0) + +# v1.0 compatibility +if(NOT WIN32) + file(COPY libhashkit-1.0 DESTINATION .) + file(COPY libmemcached-1.0 DESTINATION .) + file(COPY libmemcachedutil-1.0 DESTINATION .) + file(COPY libmemcachedprotocol-0.0 DESTINATION .) + install(CODE " + file(INSTALL + ${CMAKE_CURRENT_BINARY_DIR}/libhashkit-1.0 + ${CMAKE_CURRENT_BINARY_DIR}/libmemcached-1.0 + ${CMAKE_CURRENT_BINARY_DIR}/libmemcachedutil-1.0 + ${CMAKE_CURRENT_BINARY_DIR}/libmemcachedprotocol-0.0 + DESTINATION \${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) + ") +endif() diff --git a/include/libhashkit-1.0 b/include/libhashkit-1.0 new file mode 120000 index 00000000..17f4a363 --- /dev/null +++ b/include/libhashkit-1.0 @@ -0,0 +1 @@ +libhashkit-1 \ No newline at end of file diff --git a/include/libhashkit-1.0/CMakeLists.txt b/include/libhashkit-1/CMakeLists.txt similarity index 88% rename from include/libhashkit-1.0/CMakeLists.txt rename to include/libhashkit-1/CMakeLists.txt index 24fefd57..aae1cd11 100644 --- a/include/libhashkit-1.0/CMakeLists.txt +++ b/include/libhashkit-1/CMakeLists.txt @@ -1,5 +1,5 @@ -install_public_headers(libhashkit-1.0 +install_public_headers(libhashkit-1 @configure.h algorithm.h basic_string.h diff --git a/include/libhashkit-1.0/algorithm.h b/include/libhashkit-1/algorithm.h similarity index 100% rename from include/libhashkit-1.0/algorithm.h rename to include/libhashkit-1/algorithm.h diff --git a/include/libhashkit-1.0/basic_string.h b/include/libhashkit-1/basic_string.h similarity index 100% rename from include/libhashkit-1.0/basic_string.h rename to include/libhashkit-1/basic_string.h diff --git a/include/libhashkit-1.0/behavior.h b/include/libhashkit-1/behavior.h similarity index 100% rename from include/libhashkit-1.0/behavior.h rename to include/libhashkit-1/behavior.h diff --git a/include/libhashkit-1.0/configure.h.in b/include/libhashkit-1/configure.h.in similarity index 100% rename from include/libhashkit-1.0/configure.h.in rename to include/libhashkit-1/configure.h.in diff --git a/include/libhashkit-1.0/digest.h b/include/libhashkit-1/digest.h similarity index 100% rename from include/libhashkit-1.0/digest.h rename to include/libhashkit-1/digest.h diff --git a/include/libhashkit-1.0/function.h b/include/libhashkit-1/function.h similarity index 100% rename from include/libhashkit-1.0/function.h rename to include/libhashkit-1/function.h diff --git a/include/libhashkit-1.0/has.h b/include/libhashkit-1/has.h similarity index 100% rename from include/libhashkit-1.0/has.h rename to include/libhashkit-1/has.h diff --git a/include/libhashkit-1.0/hashkit.h b/include/libhashkit-1/hashkit.h similarity index 83% rename from include/libhashkit-1.0/hashkit.h rename to include/libhashkit-1/hashkit.h index 9842f8eb..5e01939d 100644 --- a/include/libhashkit-1.0/hashkit.h +++ b/include/libhashkit-1/hashkit.h @@ -23,17 +23,17 @@ #endif #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include struct hashkit_st { struct hashkit_function_st { diff --git a/include/libhashkit-1.0/hashkit.hpp b/include/libhashkit-1/hashkit.hpp similarity index 98% rename from include/libhashkit-1.0/hashkit.hpp rename to include/libhashkit-1/hashkit.hpp index 1690f15b..c178ecc7 100644 --- a/include/libhashkit-1.0/hashkit.hpp +++ b/include/libhashkit-1/hashkit.hpp @@ -15,7 +15,7 @@ #pragma once -#include +#include #include class Hashkit { diff --git a/include/libhashkit-1.0/str_algorithm.h b/include/libhashkit-1/str_algorithm.h similarity index 100% rename from include/libhashkit-1.0/str_algorithm.h rename to include/libhashkit-1/str_algorithm.h diff --git a/include/libhashkit-1.0/strerror.h b/include/libhashkit-1/strerror.h similarity index 100% rename from include/libhashkit-1.0/strerror.h rename to include/libhashkit-1/strerror.h diff --git a/include/libhashkit-1.0/string.h b/include/libhashkit-1/string.h similarity index 100% rename from include/libhashkit-1.0/string.h rename to include/libhashkit-1/string.h diff --git a/include/libhashkit-1.0/types.h b/include/libhashkit-1/types.h similarity index 100% rename from include/libhashkit-1.0/types.h rename to include/libhashkit-1/types.h diff --git a/include/libhashkit-1.0/visibility.h b/include/libhashkit-1/visibility.h similarity index 100% rename from include/libhashkit-1.0/visibility.h rename to include/libhashkit-1/visibility.h diff --git a/include/libmemcached-1.0 b/include/libmemcached-1.0 new file mode 120000 index 00000000..ad6872d6 --- /dev/null +++ b/include/libmemcached-1.0 @@ -0,0 +1 @@ +libmemcached-1 \ No newline at end of file diff --git a/include/libmemcached-1.0/CMakeLists.txt b/include/libmemcached-1/CMakeLists.txt similarity index 97% rename from include/libmemcached-1.0/CMakeLists.txt rename to include/libmemcached-1/CMakeLists.txt index c9b4f7c1..4f19a88f 100644 --- a/include/libmemcached-1.0/CMakeLists.txt +++ b/include/libmemcached-1/CMakeLists.txt @@ -3,7 +3,7 @@ add_subdirectory(struct) add_subdirectory(types) install_public_headers( - libmemcached-1.0 + libmemcached-1 @configure.h alloc.h diff --git a/include/libmemcached-1.0/alloc.h b/include/libmemcached-1/alloc.h similarity index 100% rename from include/libmemcached-1.0/alloc.h rename to include/libmemcached-1/alloc.h diff --git a/include/libmemcached-1.0/allocators.h b/include/libmemcached-1/allocators.h similarity index 100% rename from include/libmemcached-1.0/allocators.h rename to include/libmemcached-1/allocators.h diff --git a/include/libmemcached-1.0/analyze.h b/include/libmemcached-1/analyze.h similarity index 96% rename from include/libmemcached-1.0/analyze.h rename to include/libmemcached-1/analyze.h index a5c9d45a..58009738 100644 --- a/include/libmemcached-1.0/analyze.h +++ b/include/libmemcached-1/analyze.h @@ -13,7 +13,7 @@ +--------------------------------------------------------------------+ */ -#include "libmemcached-1.0/struct/analysis.h" +#include "libmemcached-1/struct/analysis.h" #pragma once diff --git a/include/libmemcached-1.0/auto.h b/include/libmemcached-1/auto.h similarity index 100% rename from include/libmemcached-1.0/auto.h rename to include/libmemcached-1/auto.h diff --git a/include/libmemcached-1.0/basic_string.h b/include/libmemcached-1/basic_string.h similarity index 100% rename from include/libmemcached-1.0/basic_string.h rename to include/libmemcached-1/basic_string.h diff --git a/include/libmemcached-1.0/behavior.h b/include/libmemcached-1/behavior.h similarity index 100% rename from include/libmemcached-1.0/behavior.h rename to include/libmemcached-1/behavior.h diff --git a/include/libmemcached-1.0/callback.h b/include/libmemcached-1/callback.h similarity index 100% rename from include/libmemcached-1.0/callback.h rename to include/libmemcached-1/callback.h diff --git a/include/libmemcached-1.0/callbacks.h b/include/libmemcached-1/callbacks.h similarity index 100% rename from include/libmemcached-1.0/callbacks.h rename to include/libmemcached-1/callbacks.h diff --git a/include/libmemcached-1.0/configure.h.in b/include/libmemcached-1/configure.h.in similarity index 100% rename from include/libmemcached-1.0/configure.h.in rename to include/libmemcached-1/configure.h.in diff --git a/include/libmemcached-1.0/defaults.h b/include/libmemcached-1/defaults.h similarity index 100% rename from include/libmemcached-1.0/defaults.h rename to include/libmemcached-1/defaults.h diff --git a/include/libmemcached-1.0/delete.h b/include/libmemcached-1/delete.h similarity index 100% rename from include/libmemcached-1.0/delete.h rename to include/libmemcached-1/delete.h diff --git a/include/libmemcached-1.0/deprecated_types.h b/include/libmemcached-1/deprecated_types.h similarity index 100% rename from include/libmemcached-1.0/deprecated_types.h rename to include/libmemcached-1/deprecated_types.h diff --git a/include/libmemcached-1.0/dump.h b/include/libmemcached-1/dump.h similarity index 100% rename from include/libmemcached-1.0/dump.h rename to include/libmemcached-1/dump.h diff --git a/include/libmemcached-1.0/encoding_key.h b/include/libmemcached-1/encoding_key.h similarity index 100% rename from include/libmemcached-1.0/encoding_key.h rename to include/libmemcached-1/encoding_key.h diff --git a/include/libmemcached-1.0/error.h b/include/libmemcached-1/error.h similarity index 100% rename from include/libmemcached-1.0/error.h rename to include/libmemcached-1/error.h diff --git a/include/libmemcached-1.0/exception.hpp b/include/libmemcached-1/exception.hpp similarity index 100% rename from include/libmemcached-1.0/exception.hpp rename to include/libmemcached-1/exception.hpp diff --git a/include/libmemcached-1.0/exist.h b/include/libmemcached-1/exist.h similarity index 100% rename from include/libmemcached-1.0/exist.h rename to include/libmemcached-1/exist.h diff --git a/include/libmemcached-1.0/fetch.h b/include/libmemcached-1/fetch.h similarity index 100% rename from include/libmemcached-1.0/fetch.h rename to include/libmemcached-1/fetch.h diff --git a/include/libmemcached-1.0/flush.h b/include/libmemcached-1/flush.h similarity index 100% rename from include/libmemcached-1.0/flush.h rename to include/libmemcached-1/flush.h diff --git a/include/libmemcached-1.0/flush_buffers.h b/include/libmemcached-1/flush_buffers.h similarity index 100% rename from include/libmemcached-1.0/flush_buffers.h rename to include/libmemcached-1/flush_buffers.h diff --git a/include/libmemcached-1.0/get.h b/include/libmemcached-1/get.h similarity index 100% rename from include/libmemcached-1.0/get.h rename to include/libmemcached-1/get.h diff --git a/include/libmemcached-1.0/hash.h b/include/libmemcached-1/hash.h similarity index 100% rename from include/libmemcached-1.0/hash.h rename to include/libmemcached-1/hash.h diff --git a/include/libmemcached-1.0/limits.h b/include/libmemcached-1/limits.h similarity index 100% rename from include/libmemcached-1.0/limits.h rename to include/libmemcached-1/limits.h diff --git a/include/libmemcached-1.0/memcached.h b/include/libmemcached-1/memcached.h similarity index 50% rename from include/libmemcached-1.0/memcached.h rename to include/libmemcached-1/memcached.h index e3eac4e2..a1d0522f 100644 --- a/include/libmemcached-1.0/memcached.h +++ b/include/libmemcached-1/memcached.h @@ -15,71 +15,71 @@ #pragma once -#include "libmemcached-1.0/configure.h" -#include "libmemcached-1.0/visibility.h" -#include "libmemcached-1.0/platform.h" - -#include "libmemcached-1.0/limits.h" -#include "libmemcached-1.0/defaults.h" - -#include "libmemcached-1.0/types/behavior.h" -#include "libmemcached-1.0/types/callback.h" -#include "libmemcached-1.0/types/connection.h" -#include "libmemcached-1.0/types/hash.h" -#include "libmemcached-1.0/types/return.h" -#include "libmemcached-1.0/types/server_distribution.h" - -#include "libmemcached-1.0/return.h" - -#include "libmemcached-1.0/types.h" -#include "libmemcached-1.0/callbacks.h" -#include "libmemcached-1.0/alloc.h" -#include "libmemcached-1.0/triggers.h" - -#include "libhashkit-1.0/hashkit.h" - -#include "libmemcached-1.0/struct/callback.h" -#include "libmemcached-1.0/struct/string.h" -#include "libmemcached-1.0/struct/result.h" -#include "libmemcached-1.0/struct/allocator.h" -#include "libmemcached-1.0/struct/sasl.h" -#include "libmemcached-1.0/struct/memcached.h" -#include "libmemcached-1.0/struct/server.h" -#include "libmemcached-1.0/struct/stat.h" - -#include "libmemcached-1.0/basic_string.h" -#include "libmemcached-1.0/error.h" -#include "libmemcached-1.0/stats.h" +#include "libmemcached-1/configure.h" +#include "libmemcached-1/visibility.h" +#include "libmemcached-1/platform.h" + +#include "libmemcached-1/limits.h" +#include "libmemcached-1/defaults.h" + +#include "libmemcached-1/types/behavior.h" +#include "libmemcached-1/types/callback.h" +#include "libmemcached-1/types/connection.h" +#include "libmemcached-1/types/hash.h" +#include "libmemcached-1/types/return.h" +#include "libmemcached-1/types/server_distribution.h" + +#include "libmemcached-1/return.h" + +#include "libmemcached-1/types.h" +#include "libmemcached-1/callbacks.h" +#include "libmemcached-1/alloc.h" +#include "libmemcached-1/triggers.h" + +#include "libhashkit-1/hashkit.h" + +#include "libmemcached-1/struct/callback.h" +#include "libmemcached-1/struct/string.h" +#include "libmemcached-1/struct/result.h" +#include "libmemcached-1/struct/allocator.h" +#include "libmemcached-1/struct/sasl.h" +#include "libmemcached-1/struct/memcached.h" +#include "libmemcached-1/struct/server.h" +#include "libmemcached-1/struct/stat.h" + +#include "libmemcached-1/basic_string.h" +#include "libmemcached-1/error.h" +#include "libmemcached-1/stats.h" // Everything above this line must be in the order specified. -#include "libmemcached-1.0/allocators.h" -#include "libmemcached-1.0/analyze.h" -#include "libmemcached-1.0/auto.h" -#include "libmemcached-1.0/behavior.h" -#include "libmemcached-1.0/callback.h" -#include "libmemcached-1.0/delete.h" -#include "libmemcached-1.0/dump.h" -#include "libmemcached-1.0/encoding_key.h" -#include "libmemcached-1.0/exist.h" -#include "libmemcached-1.0/fetch.h" -#include "libmemcached-1.0/flush.h" -#include "libmemcached-1.0/flush_buffers.h" -#include "libmemcached-1.0/get.h" -#include "libmemcached-1.0/hash.h" -#include "libmemcached-1.0/options.h" -#include "libmemcached-1.0/parse.h" -#include "libmemcached-1.0/quit.h" -#include "libmemcached-1.0/result.h" -#include "libmemcached-1.0/server.h" -#include "libmemcached-1.0/server_list.h" -#include "libmemcached-1.0/storage.h" -#include "libmemcached-1.0/strerror.h" -#include "libmemcached-1.0/touch.h" -#include "libmemcached-1.0/verbosity.h" -#include "libmemcached-1.0/version.h" -#include "libmemcached-1.0/sasl.h" - -#include "libmemcached-1.0/deprecated_types.h" +#include "libmemcached-1/allocators.h" +#include "libmemcached-1/analyze.h" +#include "libmemcached-1/auto.h" +#include "libmemcached-1/behavior.h" +#include "libmemcached-1/callback.h" +#include "libmemcached-1/delete.h" +#include "libmemcached-1/dump.h" +#include "libmemcached-1/encoding_key.h" +#include "libmemcached-1/exist.h" +#include "libmemcached-1/fetch.h" +#include "libmemcached-1/flush.h" +#include "libmemcached-1/flush_buffers.h" +#include "libmemcached-1/get.h" +#include "libmemcached-1/hash.h" +#include "libmemcached-1/options.h" +#include "libmemcached-1/parse.h" +#include "libmemcached-1/quit.h" +#include "libmemcached-1/result.h" +#include "libmemcached-1/server.h" +#include "libmemcached-1/server_list.h" +#include "libmemcached-1/storage.h" +#include "libmemcached-1/strerror.h" +#include "libmemcached-1/touch.h" +#include "libmemcached-1/verbosity.h" +#include "libmemcached-1/version.h" +#include "libmemcached-1/sasl.h" + +#include "libmemcached-1/deprecated_types.h" #ifdef __cplusplus extern "C" { diff --git a/include/libmemcached-1.0/memcached.hpp b/include/libmemcached-1/memcached.hpp similarity index 99% rename from include/libmemcached-1.0/memcached.hpp rename to include/libmemcached-1/memcached.hpp index aaeb4df7..5d902561 100644 --- a/include/libmemcached-1.0/memcached.hpp +++ b/include/libmemcached-1/memcached.hpp @@ -15,7 +15,7 @@ #pragma once -#include "libmemcached-1.0/memcached.h" +#include "libmemcached-1/memcached.h" #if 0 # include "libmemcached/exception.hpp" #endif diff --git a/include/libmemcached-1.0/options.h b/include/libmemcached-1/options.h similarity index 100% rename from include/libmemcached-1.0/options.h rename to include/libmemcached-1/options.h diff --git a/include/libmemcached-1.0/parse.h b/include/libmemcached-1/parse.h similarity index 100% rename from include/libmemcached-1.0/parse.h rename to include/libmemcached-1/parse.h diff --git a/include/libmemcached-1.0/platform.h b/include/libmemcached-1/platform.h similarity index 97% rename from include/libmemcached-1.0/platform.h rename to include/libmemcached-1/platform.h index 1ab1bc07..bfc05e35 100644 --- a/include/libmemcached-1.0/platform.h +++ b/include/libmemcached-1/platform.h @@ -15,7 +15,7 @@ #pragma once -#include "libmemcached-1.0/configure.h" +#include "libmemcached-1/configure.h" /* This seems to be required for older compilers @note * http://stackoverflow.com/questions/8132399/how-to-printf-uint64-t */ diff --git a/include/libmemcached-1.0/quit.h b/include/libmemcached-1/quit.h similarity index 100% rename from include/libmemcached-1.0/quit.h rename to include/libmemcached-1/quit.h diff --git a/include/libmemcached-1.0/result.h b/include/libmemcached-1/result.h similarity index 98% rename from include/libmemcached-1.0/result.h rename to include/libmemcached-1/result.h index 301d0c11..e1c5b2b0 100644 --- a/include/libmemcached-1.0/result.h +++ b/include/libmemcached-1/result.h @@ -13,7 +13,7 @@ +--------------------------------------------------------------------+ */ -#include "libmemcached-1.0/struct/result.h" +#include "libmemcached-1/struct/result.h" #pragma once diff --git a/include/libmemcached-1.0/return.h b/include/libmemcached-1/return.h similarity index 100% rename from include/libmemcached-1.0/return.h rename to include/libmemcached-1/return.h diff --git a/include/libmemcached-1.0/sasl.h b/include/libmemcached-1/sasl.h similarity index 97% rename from include/libmemcached-1.0/sasl.h rename to include/libmemcached-1/sasl.h index 832084bd..22d3b61e 100644 --- a/include/libmemcached-1.0/sasl.h +++ b/include/libmemcached-1/sasl.h @@ -42,4 +42,4 @@ sasl_callback_t *memcached_get_sasl_callbacks(memcached_st *ptr); } #endif -#include "libmemcached-1.0/struct/sasl.h" +#include "libmemcached-1/struct/sasl.h" diff --git a/include/libmemcached-1.0/server.h b/include/libmemcached-1/server.h similarity index 98% rename from include/libmemcached-1.0/server.h rename to include/libmemcached-1/server.h index 86928c3d..3ad5199d 100644 --- a/include/libmemcached-1.0/server.h +++ b/include/libmemcached-1/server.h @@ -15,7 +15,7 @@ #pragma once -#include "libmemcached-1.0/struct/server.h" +#include "libmemcached-1/struct/server.h" #ifdef __cplusplus extern "C" { diff --git a/include/libmemcached-1.0/server_list.h b/include/libmemcached-1/server_list.h similarity index 100% rename from include/libmemcached-1.0/server_list.h rename to include/libmemcached-1/server_list.h diff --git a/include/libmemcached-1.0/stats.h b/include/libmemcached-1/stats.h similarity index 97% rename from include/libmemcached-1.0/stats.h rename to include/libmemcached-1/stats.h index 5661f505..eb02bacd 100644 --- a/include/libmemcached-1.0/stats.h +++ b/include/libmemcached-1/stats.h @@ -13,7 +13,7 @@ +--------------------------------------------------------------------+ */ -#include "libmemcached-1.0/struct/stat.h" +#include "libmemcached-1/struct/stat.h" #pragma once diff --git a/include/libmemcached-1.0/storage.h b/include/libmemcached-1/storage.h similarity index 100% rename from include/libmemcached-1.0/storage.h rename to include/libmemcached-1/storage.h diff --git a/include/libmemcached-1.0/strerror.h b/include/libmemcached-1/strerror.h similarity index 100% rename from include/libmemcached-1.0/strerror.h rename to include/libmemcached-1/strerror.h diff --git a/include/libmemcached-1.0/struct/CMakeLists.txt b/include/libmemcached-1/struct/CMakeLists.txt similarity index 85% rename from include/libmemcached-1.0/struct/CMakeLists.txt rename to include/libmemcached-1/struct/CMakeLists.txt index 548f993d..adebbfef 100644 --- a/include/libmemcached-1.0/struct/CMakeLists.txt +++ b/include/libmemcached-1/struct/CMakeLists.txt @@ -1,6 +1,6 @@ install_public_headers( - libmemcached-1.0/struct + libmemcached-1/struct allocator.h analysis.h diff --git a/include/libmemcached-1.0/struct/allocator.h b/include/libmemcached-1/struct/allocator.h similarity index 100% rename from include/libmemcached-1.0/struct/allocator.h rename to include/libmemcached-1/struct/allocator.h diff --git a/include/libmemcached-1.0/struct/analysis.h b/include/libmemcached-1/struct/analysis.h similarity index 100% rename from include/libmemcached-1.0/struct/analysis.h rename to include/libmemcached-1/struct/analysis.h diff --git a/include/libmemcached-1.0/struct/callback.h b/include/libmemcached-1/struct/callback.h similarity index 100% rename from include/libmemcached-1.0/struct/callback.h rename to include/libmemcached-1/struct/callback.h diff --git a/include/libmemcached-1.0/struct/memcached.h b/include/libmemcached-1/struct/memcached.h similarity index 100% rename from include/libmemcached-1.0/struct/memcached.h rename to include/libmemcached-1/struct/memcached.h diff --git a/include/libmemcached-1.0/struct/result.h b/include/libmemcached-1/struct/result.h similarity index 100% rename from include/libmemcached-1.0/struct/result.h rename to include/libmemcached-1/struct/result.h diff --git a/include/libmemcached-1.0/struct/sasl.h b/include/libmemcached-1/struct/sasl.h similarity index 100% rename from include/libmemcached-1.0/struct/sasl.h rename to include/libmemcached-1/struct/sasl.h diff --git a/include/libmemcached-1.0/struct/server.h b/include/libmemcached-1/struct/server.h similarity index 98% rename from include/libmemcached-1.0/struct/server.h rename to include/libmemcached-1/struct/server.h index e74767ad..4109c56d 100644 --- a/include/libmemcached-1.0/struct/server.h +++ b/include/libmemcached-1/struct/server.h @@ -15,7 +15,7 @@ #pragma once -#include "libmemcached-1.0/configure.h" +#include "libmemcached-1/configure.h" #ifdef HAVE_NETDB_H # include diff --git a/include/libmemcached-1.0/struct/stat.h b/include/libmemcached-1/struct/stat.h similarity index 100% rename from include/libmemcached-1.0/struct/stat.h rename to include/libmemcached-1/struct/stat.h diff --git a/include/libmemcached-1.0/struct/string.h b/include/libmemcached-1/struct/string.h similarity index 100% rename from include/libmemcached-1.0/struct/string.h rename to include/libmemcached-1/struct/string.h diff --git a/include/libmemcached-1.0/touch.h b/include/libmemcached-1/touch.h similarity index 100% rename from include/libmemcached-1.0/touch.h rename to include/libmemcached-1/touch.h diff --git a/include/libmemcached-1.0/triggers.h b/include/libmemcached-1/triggers.h similarity index 100% rename from include/libmemcached-1.0/triggers.h rename to include/libmemcached-1/triggers.h diff --git a/include/libmemcached-1.0/types.h b/include/libmemcached-1/types.h similarity index 100% rename from include/libmemcached-1.0/types.h rename to include/libmemcached-1/types.h diff --git a/include/libmemcached-1.0/types/CMakeLists.txt b/include/libmemcached-1/types/CMakeLists.txt similarity index 83% rename from include/libmemcached-1.0/types/CMakeLists.txt rename to include/libmemcached-1/types/CMakeLists.txt index 14ec1077..9bc619d6 100644 --- a/include/libmemcached-1.0/types/CMakeLists.txt +++ b/include/libmemcached-1/types/CMakeLists.txt @@ -1,6 +1,6 @@ install_public_headers( - libmemcached-1.0/types + libmemcached-1/types behavior.h callback.h diff --git a/include/libmemcached-1.0/types/behavior.h b/include/libmemcached-1/types/behavior.h similarity index 100% rename from include/libmemcached-1.0/types/behavior.h rename to include/libmemcached-1/types/behavior.h diff --git a/include/libmemcached-1.0/types/callback.h b/include/libmemcached-1/types/callback.h similarity index 100% rename from include/libmemcached-1.0/types/callback.h rename to include/libmemcached-1/types/callback.h diff --git a/include/libmemcached-1.0/types/connection.h b/include/libmemcached-1/types/connection.h similarity index 100% rename from include/libmemcached-1.0/types/connection.h rename to include/libmemcached-1/types/connection.h diff --git a/include/libmemcached-1.0/types/hash.h b/include/libmemcached-1/types/hash.h similarity index 100% rename from include/libmemcached-1.0/types/hash.h rename to include/libmemcached-1/types/hash.h diff --git a/include/libmemcached-1.0/types/return.h b/include/libmemcached-1/types/return.h similarity index 100% rename from include/libmemcached-1.0/types/return.h rename to include/libmemcached-1/types/return.h diff --git a/include/libmemcached-1.0/types/server_distribution.h b/include/libmemcached-1/types/server_distribution.h similarity index 100% rename from include/libmemcached-1.0/types/server_distribution.h rename to include/libmemcached-1/types/server_distribution.h diff --git a/include/libmemcached-1.0/verbosity.h b/include/libmemcached-1/verbosity.h similarity index 100% rename from include/libmemcached-1.0/verbosity.h rename to include/libmemcached-1/verbosity.h diff --git a/include/libmemcached-1.0/version.h b/include/libmemcached-1/version.h similarity index 100% rename from include/libmemcached-1.0/version.h rename to include/libmemcached-1/version.h diff --git a/include/libmemcached-1.0/visibility.h b/include/libmemcached-1/visibility.h similarity index 100% rename from include/libmemcached-1.0/visibility.h rename to include/libmemcached-1/visibility.h diff --git a/include/libmemcachedprotocol-0.0 b/include/libmemcachedprotocol-0.0 new file mode 120000 index 00000000..9157c764 --- /dev/null +++ b/include/libmemcachedprotocol-0.0 @@ -0,0 +1 @@ +libmemcachedprotocol-0 \ No newline at end of file diff --git a/include/libmemcachedprotocol-0.0/CMakeLists.txt b/include/libmemcachedprotocol-0/CMakeLists.txt similarity index 75% rename from include/libmemcachedprotocol-0.0/CMakeLists.txt rename to include/libmemcachedprotocol-0/CMakeLists.txt index 6d4fb220..62f739c3 100644 --- a/include/libmemcachedprotocol-0.0/CMakeLists.txt +++ b/include/libmemcachedprotocol-0/CMakeLists.txt @@ -1,6 +1,6 @@ install_public_headers( - libmemcachedprotocol-0.0 + libmemcachedprotocol-0 binary.h callback.h diff --git a/include/libmemcachedprotocol-0.0/binary.h b/include/libmemcachedprotocol-0/binary.h similarity index 99% rename from include/libmemcachedprotocol-0.0/binary.h rename to include/libmemcachedprotocol-0/binary.h index 837f3adf..9478c867 100644 --- a/include/libmemcachedprotocol-0.0/binary.h +++ b/include/libmemcachedprotocol-0/binary.h @@ -16,7 +16,7 @@ #ifndef PROTOCOL_BINARY_H #define PROTOCOL_BINARY_H -#include "libmemcachedprotocol-0.0/vbucket.h" +#include "libmemcachedprotocol-0/vbucket.h" /** * \addtogroup Protocol diff --git a/include/libmemcachedprotocol-0.0/callback.h b/include/libmemcachedprotocol-0/callback.h similarity index 100% rename from include/libmemcachedprotocol-0.0/callback.h rename to include/libmemcachedprotocol-0/callback.h diff --git a/include/libmemcachedprotocol-0.0/handler.h b/include/libmemcachedprotocol-0/handler.h similarity index 97% rename from include/libmemcachedprotocol-0.0/handler.h rename to include/libmemcachedprotocol-0/handler.h index 5f009056..94cc5e5c 100644 --- a/include/libmemcachedprotocol-0.0/handler.h +++ b/include/libmemcachedprotocol-0/handler.h @@ -28,10 +28,10 @@ typedef long int ssize_t; # include #endif -#include "libmemcached-1.0/visibility.h" -#include "libmemcached-1.0/platform.h" -#include "libmemcachedprotocol-0.0/binary.h" -#include "libmemcachedprotocol-0.0/callback.h" +#include "libmemcached-1/visibility.h" +#include "libmemcached-1/platform.h" +#include "libmemcachedprotocol-0/binary.h" +#include "libmemcachedprotocol-0/callback.h" /* Forward declarations */ /* diff --git a/include/libmemcachedprotocol-0.0/vbucket.h b/include/libmemcachedprotocol-0/vbucket.h similarity index 100% rename from include/libmemcachedprotocol-0.0/vbucket.h rename to include/libmemcachedprotocol-0/vbucket.h diff --git a/include/libmemcachedutil-1.0 b/include/libmemcachedutil-1.0 new file mode 120000 index 00000000..e74e2a91 --- /dev/null +++ b/include/libmemcachedutil-1.0 @@ -0,0 +1 @@ +libmemcachedutil-1 \ No newline at end of file diff --git a/include/libmemcachedutil-1.0/util.h b/include/libmemcachedutil-1.0/util.h deleted file mode 100644 index b4cf2e45..00000000 --- a/include/libmemcachedutil-1.0/util.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - +--------------------------------------------------------------------+ - | libmemcached - C/C++ Client Library for memcached | - +--------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted under the terms of the BSD license. | - | You should have received a copy of the license in a bundled file | - | named LICENSE; in case you did not receive a copy you can review | - | the terms online at: https://opensource.org/licenses/BSD-3-Clause | - +--------------------------------------------------------------------+ - | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ | - | Copyright (c) 2020 Michael Wallner | - +--------------------------------------------------------------------+ -*/ - -#pragma once - -#include "libmemcached-1.0/memcached.h" - -#include "libmemcachedutil-1.0/pid.h" -#include "libmemcachedutil-1.0/flush.h" -#include "libmemcachedutil-1.0/ping.h" -#include "libmemcachedutil-1.0/pool.h" -#include "libmemcachedutil-1.0/version.h" diff --git a/include/libmemcachedutil-1.0/CMakeLists.txt b/include/libmemcachedutil-1/CMakeLists.txt similarity index 83% rename from include/libmemcachedutil-1.0/CMakeLists.txt rename to include/libmemcachedutil-1/CMakeLists.txt index a6e353d1..d15f2e87 100644 --- a/include/libmemcachedutil-1.0/CMakeLists.txt +++ b/include/libmemcachedutil-1/CMakeLists.txt @@ -1,6 +1,6 @@ install_public_headers( - libmemcachedutil-1.0 + libmemcachedutil-1 flush.h ostream.hpp diff --git a/include/libmemcachedutil-1.0/flush.h b/include/libmemcachedutil-1/flush.h similarity index 100% rename from include/libmemcachedutil-1.0/flush.h rename to include/libmemcachedutil-1/flush.h diff --git a/include/libmemcachedutil-1.0/ostream.hpp b/include/libmemcachedutil-1/ostream.hpp similarity index 100% rename from include/libmemcachedutil-1.0/ostream.hpp rename to include/libmemcachedutil-1/ostream.hpp diff --git a/include/libmemcachedutil-1.0/pid.h b/include/libmemcachedutil-1/pid.h similarity index 100% rename from include/libmemcachedutil-1.0/pid.h rename to include/libmemcachedutil-1/pid.h diff --git a/include/libmemcachedutil-1.0/ping.h b/include/libmemcachedutil-1/ping.h similarity index 100% rename from include/libmemcachedutil-1.0/ping.h rename to include/libmemcachedutil-1/ping.h diff --git a/include/libmemcachedutil-1.0/pool.h b/include/libmemcachedutil-1/pool.h similarity index 98% rename from include/libmemcachedutil-1.0/pool.h rename to include/libmemcachedutil-1/pool.h index e93b65e6..155862e2 100644 --- a/include/libmemcachedutil-1.0/pool.h +++ b/include/libmemcachedutil-1/pool.h @@ -15,7 +15,7 @@ #pragma once -#include "libmemcached-1.0/memcached.h" +#include "libmemcached-1/memcached.h" #ifdef __cplusplus extern "C" { diff --git a/include/libmemcachedutil-1/util.h b/include/libmemcachedutil-1/util.h new file mode 100644 index 00000000..48e5a9a0 --- /dev/null +++ b/include/libmemcachedutil-1/util.h @@ -0,0 +1,24 @@ +/* + +--------------------------------------------------------------------+ + | libmemcached - C/C++ Client Library for memcached | + +--------------------------------------------------------------------+ + | Redistribution and use in source and binary forms, with or without | + | modification, are permitted under the terms of the BSD license. | + | You should have received a copy of the license in a bundled file | + | named LICENSE; in case you did not receive a copy you can review | + | the terms online at: https://opensource.org/licenses/BSD-3-Clause | + +--------------------------------------------------------------------+ + | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ | + | Copyright (c) 2020 Michael Wallner | + +--------------------------------------------------------------------+ +*/ + +#pragma once + +#include "libmemcached-1/memcached.h" + +#include "libmemcachedutil-1/pid.h" +#include "libmemcachedutil-1/flush.h" +#include "libmemcachedutil-1/ping.h" +#include "libmemcachedutil-1/pool.h" +#include "libmemcachedutil-1/version.h" diff --git a/include/libmemcachedutil-1.0/version.h b/include/libmemcachedutil-1/version.h similarity index 100% rename from include/libmemcachedutil-1.0/version.h rename to include/libmemcachedutil-1/version.h diff --git a/src/bin/memcapable.cc b/src/bin/memcapable.cc index 54e9c224..a95fc1d1 100644 --- a/src/bin/memcapable.cc +++ b/src/bin/memcapable.cc @@ -36,8 +36,8 @@ #include "p9y/socket.hpp" #include "p9y/poll.hpp" -#include "libmemcached-1.0/memcached.h" -#include "libmemcachedprotocol-0.0/binary.h" +#include "libmemcached-1/memcached.h" +#include "libmemcachedprotocol-0/binary.h" #include "libmemcached/byteorder.h" #include diff --git a/src/bin/memparse.cc b/src/bin/memparse.cc index d08c9d99..be3211ce 100644 --- a/src/bin/memparse.cc +++ b/src/bin/memparse.cc @@ -19,7 +19,7 @@ #include #include -#include "libmemcached-1.0/memcached.h" +#include "libmemcached-1/memcached.h" int main(int argc, char *argv[]) { if (argc < 2) { diff --git a/src/libhashkit/common.h b/src/libhashkit/common.h index 6d483584..ddd7bb03 100644 --- a/src/libhashkit/common.h +++ b/src/libhashkit/common.h @@ -30,7 +30,7 @@ # endif #endif -#include "libhashkit-1.0/hashkit.h" +#include "libhashkit-1/hashkit.h" #include "libhashkit/algorithm.h" #include "libhashkit/is.h" #include "libhashkit/string.h" diff --git a/src/libhashkit/hashkit.h b/src/libhashkit/hashkit.h index e4285233..35380dff 100644 --- a/src/libhashkit/hashkit.h +++ b/src/libhashkit/hashkit.h @@ -15,4 +15,4 @@ #pragma once -#include "libhashkit-1.0/hashkit.h" +#include "libhashkit-1/hashkit.h" diff --git a/src/libmemcached/common.h b/src/libmemcached/common.h index c36384b2..ed878cb1 100644 --- a/src/libmemcached/common.h +++ b/src/libmemcached/common.h @@ -54,7 +54,7 @@ # include #endif -#include "libmemcached-1.0/memcached.h" +#include "libmemcached-1/memcached.h" #include "libmemcached/watchpoint.h" #include "libmemcached/is.h" typedef struct memcached_st Memcached; @@ -69,7 +69,7 @@ memcached_instance_st *memcached_instance_fetch(memcached_st *ptr, uint32_t serv #include "libmemcached/io.h" #ifdef __cplusplus # include "libmemcached/string.hpp" -# include "libmemcachedprotocol-0.0/binary.h" +# include "libmemcachedprotocol-0/binary.h" # include "libmemcached/io.hpp" # include "libmemcached/udp.hpp" # include "libmemcached/do.hpp" diff --git a/src/libmemcached/memcached.h b/src/libmemcached/memcached.h index c0878dc3..b3dbcb27 100644 --- a/src/libmemcached/memcached.h +++ b/src/libmemcached/memcached.h @@ -15,4 +15,4 @@ #pragma once -#include "libmemcached-1.0/memcached.h" +#include "libmemcached-1/memcached.h" diff --git a/src/libmemcached/memcached.hpp b/src/libmemcached/memcached.hpp index 6ebb5c4d..381ca13b 100644 --- a/src/libmemcached/memcached.hpp +++ b/src/libmemcached/memcached.hpp @@ -15,4 +15,4 @@ #pragma once -#include "libmemcached-1.0/memcached.hpp" +#include "libmemcached-1/memcached.hpp" diff --git a/src/libmemcached/util.h b/src/libmemcached/util.h index 48c7fc49..7b808283 100644 --- a/src/libmemcached/util.h +++ b/src/libmemcached/util.h @@ -15,4 +15,4 @@ #pragma once -#include "libmemcachedutil-1.0/util.h" +#include "libmemcachedutil-1/util.h" diff --git a/src/libmemcachedprotocol/common.h b/src/libmemcachedprotocol/common.h index 39f0464e..0e6a1005 100644 --- a/src/libmemcachedprotocol/common.h +++ b/src/libmemcachedprotocol/common.h @@ -18,7 +18,7 @@ #include "mem_config.h" #include -#include "libmemcachedprotocol-0.0/handler.h" +#include "libmemcachedprotocol-0/handler.h" #include "libmemcachedprotocol/cache.h" #include "libmemcached/byteorder.h" diff --git a/src/libmemcachedutil/common.h b/src/libmemcachedutil/common.h index 680f85c0..ddfac589 100644 --- a/src/libmemcachedutil/common.h +++ b/src/libmemcachedutil/common.h @@ -22,6 +22,6 @@ #include #include -#include "libmemcachedutil-1.0/util.h" +#include "libmemcachedutil-1/util.h" #include "libmemcached/assert.hpp" #include "libmemcached/backtrace.hpp" diff --git a/src/p9y/gettimeofday.hpp b/src/p9y/gettimeofday.hpp index 02b8d6d9..aaba58bb 100644 --- a/src/p9y/gettimeofday.hpp +++ b/src/p9y/gettimeofday.hpp @@ -1,6 +1,6 @@ #pragma once -#include "libmemcached-1.0/platform.h" +#include "libmemcached-1/platform.h" #include #if defined HAVE_SYS_TIME_H diff --git a/src/p9y/poll.hpp b/src/p9y/poll.hpp index 6a242618..57fee463 100644 --- a/src/p9y/poll.hpp +++ b/src/p9y/poll.hpp @@ -1,6 +1,6 @@ #pragma once -#include "libmemcached-1.0/platform.h" +#include "libmemcached-1/platform.h" #if defined HAVE_SYS_POLL_H # include diff --git a/src/p9y/socket.hpp b/src/p9y/socket.hpp index 139ebb56..23237e73 100644 --- a/src/p9y/socket.hpp +++ b/src/p9y/socket.hpp @@ -1,6 +1,6 @@ #pragma once -#include "libmemcached-1.0/platform.h" +#include "libmemcached-1/platform.h" #if defined __cplusplus # include diff --git a/src/win32/wrappers.h b/src/win32/wrappers.h deleted file mode 100644 index a009fbdc..00000000 --- a/src/win32/wrappers.h +++ /dev/null @@ -1,104 +0,0 @@ -/* LibMemcached - * Copyright (C) 2010 Brian Aker, Trond Norbye - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - * - * Summary: "Implementation" of the function we don't have on windows - * to avoid a bunch of ifdefs in the rest of the code - * - */ -#pragma once - -#include - -/* - * One of the Windows headers define interface as a macro, but that - * is causing problems with the member named "interface" in some of the - * structs. - */ -#undef interface - -#undef malloc -#undef realloc - - -/* - * WinSock use a separate range for error codes. Let's just map to the - * WinSock ones. - */ -#ifndef EADDRINUSE -# define EADDRINUSE WSAEADDRINUSE -#endif - -#ifndef EWOULDBLOCK -# define EWOULDBLOCK WSAEWOULDBLOCK -#endif - -#ifndef EINPROGRESS -# define EINPROGRESS WSAEINPROGRESS -#endif - -#ifndef EALREADY -# define EALREADY WSAEALREADY -#endif - -#ifndef EISCONN -# define EISCONN WSAEISCONN -#endif - -#ifndef ENOTCONN -# define ENOTCONN WSAENOTCONN -#endif - -#ifndef ENOBUFS -# define ENOBUFS WSAENOBUFS -#endif - -#ifndef SHUT_RDWR -# define SHUT_RDWR SD_BOTH -#endif -#ifndef SHUT_WR -# define SHUT_WR SD_SEND -#endif -#ifndef SHUT_RD -# define SHUT_RD SD_RECEIVE -#endif - -/* EAI_SYSTEM isn't defined anywhere... just set it to... 11? */ -#ifndef EAI_SYSTEM -# define EAI_SYSTEM 11 -#endif - -/* Best effort mapping of functions to alternative functions */ -#define index(a,b) strchr(a,b) -#define rindex(a,b) strrchr(a,b) -#define random() rand() -#define srandom(a) while (false) {} -#define kill(a, b) while (false) {} -#define fork() (-1) -#define waitpid(a,b,c) (-1) -#define fnmatch(a,b,c) (-1) -#define sleep(a) Sleep(a*1000) - -#ifdef __cplusplus -# include -static inline int gettimeofday(struct timeval* tp, struct timezone* tzp) { - using clock = std::chrono::system_clock; - auto as_sec = [] (auto d) { - return std::chrono::duration_cast(d); - }; - auto as_usec = [] (auto d) { - return std::chrono::duration_cast(d); - }; - - auto now = clock::now().time_since_epoch(); - auto sec = as_sec(now); - auto usec = as_usec(now - sec); - - tp->tv_sec = sec.count(); - tp->tv_usec = usec.count(); - return 0; -} -#endif \ No newline at end of file diff --git a/support/ax_libmemcached.m4 b/support/ax_libmemcached.m4 index 95e5c9f7..d847f99b 100644 --- a/support/ax_libmemcached.m4 +++ b/support/ax_libmemcached.m4 @@ -52,13 +52,13 @@ #serial 1 AC_DEFUN([AX_LIBMEMCACHED], [ - AC_CHECK_HEADER([libmemcached-1.0/memcached.h], [ + AC_CHECK_HEADER([libmemcached-1/memcached.h], [ AC_CACHE_CHECK([check for -lmemcached], [ax_cv_libmemcached], [ AC_LANG_PUSH([C]) AX_SAVE_FLAGS LIBS="-lmemcached $LIBS" AC_RUN_IFELSE([ - AC_LANG_PROGRAM([#include ], [ + AC_LANG_PROGRAM([#include ], [ memcached_st *memc; memc= memcached(NULL, 0); memcached_free(memc); @@ -72,22 +72,22 @@ AC_DEFUN([AX_LIBMEMCACHED], [ ]) AS_IF([test "x$ax_cv_libmemcached" = "xyes"], [ - AC_DEFINE([HAVE_LIBMEMCACHED_MEMCACHED_H], [1], [Have libmemcached-1.0/memcached.h]) + AC_DEFINE([HAVE_LIBMEMCACHED_MEMCACHED_H], [1], [Have libmemcached-1/memcached.h]) ],[ - AC_DEFINE([HAVE_LIBMEMCACHED_MEMCACHED_H], [0], [Have libmemcached-1.0/memcached.h]) + AC_DEFINE([HAVE_LIBMEMCACHED_MEMCACHED_H], [0], [Have libmemcached-1/memcached.h]) ]) ]) AC_DEFUN([AX_LIBMEMCACHED_UTIL], [ AC_REQUIRE([AX_LIBMEMCACHED]) AS_IF([test "$ax_cv_libmemcached" = yes], [ - AC_CHECK_HEADER([libmemcachedutil-1.0/util.h], [ + AC_CHECK_HEADER([libmemcachedutil-1/util.h], [ AC_CACHE_CHECK([check for -lmemcachedutil], [ax_cv_libmemcached_util], [ AX_SAVE_FLAGS AC_LANG_PUSH([C]) LIBS="-lmemcachedutil -lmemcached $LIBS" AC_RUN_IFELSE([ - AC_LANG_PROGRAM([#include ], [ + AC_LANG_PROGRAM([#include ], [ memcached_pool_st *memc_pool= memcached_pool_create(NULL, 0, 3); memcached_pool_destroy(memc_pool); ])], @@ -101,9 +101,9 @@ AC_DEFUN([AX_LIBMEMCACHED], [ ]) AS_IF([test "x$ax_cv_libmemcached_util" = "xyes"], [ - AC_DEFINE([HAVE_LIBMEMCACHED_UTIL_H], [1], [Have libmemcachedutil-1.0/util.h]) + AC_DEFINE([HAVE_LIBMEMCACHED_UTIL_H], [1], [Have libmemcachedutil-1/util.h]) ],[ - AC_DEFINE([HAVE_LIBMEMCACHED_UTIL_H], [0], [Have libmemcachedutil-1.0/util.h]) + AC_DEFINE([HAVE_LIBMEMCACHED_UTIL_H], [0], [Have libmemcachedutil-1/util.h]) ]) ]) diff --git a/test/tests/hashkit/basic.cpp b/test/tests/hashkit/basic.cpp index 369b530f..1a3cc22e 100644 --- a/test/tests/hashkit/basic.cpp +++ b/test/tests/hashkit/basic.cpp @@ -1,7 +1,7 @@ #include "test/lib/common.hpp" #include "test/fixtures/hashes.hpp" -#include "libhashkit-1.0/hashkit.hpp" +#include "libhashkit-1/hashkit.hpp" TEST_CASE("hashkit") { hashkit_st st, *hp = hashkit_create(nullptr); diff --git a/test/tests/memcached/regression/lp_000-962-815.cpp b/test/tests/memcached/regression/lp_000-962-815.cpp index bde4dfce..389064db 100644 --- a/test/tests/memcached/regression/lp_000-962-815.cpp +++ b/test/tests/memcached/regression/lp_000-962-815.cpp @@ -1,7 +1,7 @@ #include "test/lib/common.hpp" #include "test/lib/MemcachedCluster.hpp" -#include "libmemcachedutil-1.0/pool.h" +#include "libmemcachedutil-1/pool.h" #include #include diff --git a/test/tests/memcached/util_pool_thread.cpp b/test/tests/memcached/util_pool_thread.cpp index f8ac8501..b177b2a3 100644 --- a/test/tests/memcached/util_pool_thread.cpp +++ b/test/tests/memcached/util_pool_thread.cpp @@ -1,6 +1,6 @@ #include "test/lib/common.hpp" -#include "libmemcachedutil-1.0/pool.h" +#include "libmemcachedutil-1/pool.h" #include struct test_pool_context_st { diff --git a/tests/keys.hpp b/tests/keys.hpp deleted file mode 100644 index 1034a672..00000000 --- a/tests/keys.hpp +++ /dev/null @@ -1,145 +0,0 @@ -/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: - * - * Libmemcached library - * - * Copyright (C) 2012-2013 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. - * - */ - - -#if defined(HAVE_UUID_UUID_H) && HAVE_UUID_UUID_H -#include -#endif - -struct keys_st { -public: - keys_st(size_t arg) - { - init(arg, UUID_STRING_MAXLENGTH); - } - - keys_st(size_t arg, size_t padding) - { - init(arg, padding); - } - - void init(size_t arg, size_t padding) - { - _lengths.resize(arg); - _keys.resize(arg); - - for (size_t x= 0; x < _keys.size(); x++) - { - libtest::vchar_t key_buffer; - key_buffer.resize(padding +1); - memset(&key_buffer[0], 'x', padding); - -#if defined(HAVE_UUID_UUID_H) && HAVE_UUID_UUID_H - if (HAVE_UUID_UUID_H) - { - uuid_t out; - uuid_generate(out); - - uuid_unparse(out, &key_buffer[0]); - _keys[x]= strdup(&key_buffer[0]); - (_keys[x])[UUID_STRING_MAXLENGTH]= 'x'; - } - else // We just use a number and pad the string if UUID is not available -#endif - { - char int_buffer[MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH +1]; - int key_length= snprintf(int_buffer, sizeof(int_buffer), "%u", uint32_t(x)); - memcpy(&key_buffer[0], int_buffer, key_length); - _keys[x]= strdup(&key_buffer[0]); - } - _lengths[x]= padding; - } - } - - ~keys_st() - { - for (libtest::vchar_ptr_t::iterator iter= _keys.begin(); - iter != _keys.end(); - ++iter) - { - ::free(*iter); - } - } - - libtest::vchar_ptr_t::iterator begin() - { - return _keys.begin(); - } - - libtest::vchar_ptr_t::iterator end() - { - return _keys.end(); - } - - size_t size() const - { - return _keys.size(); - } - - std::vector& lengths() - { - return _lengths; - } - - libtest::vchar_ptr_t& keys() - { - return _keys; - } - - size_t* lengths_ptr() - { - return &_lengths[0]; - } - - char** keys_ptr() - { - return &_keys[0]; - } - - char* key_at(size_t arg) - { - return _keys[arg]; - } - - size_t length_at(size_t arg) - { - return _lengths[arg]; - } - -private: - libtest::vchar_ptr_t _keys; - std::vector _lengths; -}; diff --git a/tests/libmemcached-1.0/CMakeLists.txt b/tests/libmemcached-1.0/CMakeLists.txt deleted file mode 100644 index fe7dc133..00000000 --- a/tests/libmemcached-1.0/CMakeLists.txt +++ /dev/null @@ -1,99 +0,0 @@ - -add_executable(internals internals.cc string.cc) -target_link_libraries(internals PRIVATE libtest libmemcachedinternal Threads::Threads) -add_test(internals internals) - -if(LIBMEMCACHED_WITH_SASL_SUPPORT) - add_executable(testsasl - basic.cc - debug.cc - deprecated.cc - error_conditions.cc - ketama.cc - namespace.cc - parser.cc - pool.cc - print.cc - replication.cc - sasl.cc - virtual_buckets.cc - callback_counter.cc - fetch_all_results.cc - generate.cc - ) - target_link_libraries(testsasl PRIVATE - libclient_utilities - libhashkit - libmemcached - libmemcachedutil - libtest - Threads::Threads - ) - add_test(testsasl testsasl) -endif() - -add_executable(atomsmasher atomsmasher.cc) -add_executable(testplus plus.cpp) - -foreach(TEST IN ITEMS atomsmasher testplus) - target_sources(${TEST} PRIVATE - callback_counter.cc - debug.cc - fetch_all_results.cc - generate.cc - print.cc - ) - target_link_libraries(${TEST} PRIVATE - libclient_utilities - libhashkit - libmemcached - libmemcachedutil - libtest - ) - add_test(${TEST} ${TEST}) -endforeach() - - -add_executable(testapp all_tests.cc) -add_executable(testsocket all_tests_socket.cc) - -foreach(TEST IN ITEMS testapp testsocket) - target_sources(${TEST} PRIVATE - basic.cc - callback_counter.cc - callbacks.cc - debug.cc - deprecated.cc - dump.cc - encoding_key.cc - error_conditions.cc - exist.cc - fetch_all_results.cc - generate.cc - haldenbrand.cc - ketama.cc - mem_functions.cc - memcached_get.cc - namespace.cc - parser.cc - pool.cc - print.cc - replication.cc - server_add.cc - setup_and_teardowns.cc - stat.cc - touch.cc - virtual_buckets.cc - ) - target_link_libraries(${TEST} PRIVATE - libclient_utilities - libhashkit - libmemcached - libmemcachedutil - libtest - Threads::Threads - ${LIBUUID_LIBRARIES} - ) - target_include_directories(${TEST} PRIVATE ${LIBUUID_INCLUDEDIR}) - add_test(${TEST} ${TEST}) -endforeach() diff --git a/tests/libmemcached-1.0/all_tests.cc b/tests/libmemcached-1.0/all_tests.cc deleted file mode 100644 index a7cbd2c0..00000000 --- a/tests/libmemcached-1.0/all_tests.cc +++ /dev/null @@ -1,97 +0,0 @@ -/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: - * - * Libmemcached Client and Server - * - * Copyright (C) 2012 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. - * - */ - -#include "mem_config.h" -#include "libtest/test.hpp" -#include "libmemcached-1.0/memcached.h" -#include "tests/basic.h" -#include "tests/debug.h" -#include "tests/deprecated.h" -#include "tests/error_conditions.h" -#include "tests/exist.h" -#include "tests/ketama.h" -#include "tests/namespace.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/pool.h" -#include "tests/print.h" -#include "tests/replication.h" -#include "tests/server_add.h" -#include "tests/virtual_buckets.h" - -#include "tests/libmemcached-1.0/setup_and_teardowns.h" - - -#include "tests/libmemcached-1.0/mem_functions.h" -#include "tests/libmemcached-1.0/encoding_key.h" - -/* Collections we are running */ -#include "tests/libmemcached-1.0/all_tests.h" - -#include "tests/libmemcached_world.h" - -#include - -void get_world(libtest::Framework* world) -{ - if (getenv("LIBMEMCACHED_SERVER_NUMBER")) - { - 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 - { - // Assume a minimum of 3, and a maximum of 8 - world->servers().set_servers_to_run((libtest::number_of_cpus() > 3) ? - std::min(libtest::number_of_cpus(), size_t(8)) : 3); - } - - world->collections(collection); - - world->create((test_callback_create_fn*)world_create); - world->destroy((test_callback_destroy_fn*)world_destroy); - - world->set_runner(new LibmemcachedRunner); - - world->set_socket(); -} diff --git a/tests/libmemcached-1.0/all_tests_socket.cc b/tests/libmemcached-1.0/all_tests_socket.cc deleted file mode 100644 index ad8a37f5..00000000 --- a/tests/libmemcached-1.0/all_tests_socket.cc +++ /dev/null @@ -1,80 +0,0 @@ -/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: - * - * Libmemcached Client and Server - * - * Copyright (C) 2012 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. - * - */ - -#include "mem_config.h" -#include "libtest/test.hpp" -#include "libmemcached-1.0/memcached.h" -#include "tests/basic.h" -#include "tests/debug.h" -#include "tests/deprecated.h" -#include "tests/error_conditions.h" -#include "tests/exist.h" -#include "tests/ketama.h" -#include "tests/namespace.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" -#include "tests/libmemcached-1.0/stat.h" -#include "tests/touch.h" -#include "tests/callbacks.h" -#include "tests/pool.h" -#include "tests/print.h" -#include "tests/replication.h" -#include "tests/server_add.h" -#include "tests/virtual_buckets.h" - -#include "tests/libmemcached-1.0/setup_and_teardowns.h" - - -#include "tests/libmemcached-1.0/mem_functions.h" -#include "tests/libmemcached-1.0/encoding_key.h" - -/* Collections we are running */ -#include "tests/libmemcached-1.0/all_tests.h" - -#include "tests/libmemcached_world_socket.h" - -void get_world(libtest::Framework* world) -{ - world->collections(collection); - - world->create((test_callback_create_fn*)world_create); - world->destroy((test_callback_destroy_fn*)world_destroy); - - world->set_runner(new LibmemcachedRunner); -} diff --git a/tests/libmemcached-1.0/generate.cc b/tests/libmemcached-1.0/generate.cc deleted file mode 100644 index d876b209..00000000 --- a/tests/libmemcached-1.0/generate.cc +++ /dev/null @@ -1,396 +0,0 @@ -/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: - * - * Libmemcached Client and Server - * - * Copyright (C) 2012 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. - * - */ - -#include "mem_config.h" -#include "libtest/test.hpp" - -#include "libmemcachedutil-1.0/util.h" -#include "libmemcached/is.h" - -#include "tests/libmemcached-1.0/generate.h" -#include "tests/libmemcached-1.0/fetch_all_results.h" -#include "tests/libmemcached-1.0/callback_counter.h" - -#include "bin/generator.h" -#include "bin/execute.h" - -#include "tests/memc.hpp" - -#ifdef __APPLE__ -# define GLOBAL_COUNT 3000 -#else -# define GLOBAL_COUNT 10000 -#endif - -#define GLOBAL2_COUNT 100 - -using namespace libtest; - -static pairs_st *global_pairs= NULL; -static const char *global_keys[GLOBAL_COUNT]; -static size_t global_keys_length[GLOBAL_COUNT]; -static size_t global_count= 0; - -test_return_t cleanup_pairs(memcached_st*) -{ - pairs_free(global_pairs); - global_pairs= NULL; - - return TEST_SUCCESS; -} - -static test_return_t generate_pairs(memcached_st *) -{ - global_pairs= pairs_generate(GLOBAL_COUNT, 400); - - for (size_t x= 0; x < GLOBAL_COUNT; ++x) - { - global_keys[x]= global_pairs[x].key; - global_keys_length[x]= global_pairs[x].key_length; - } - - return TEST_SUCCESS; -} - -test_return_t generate_large_pairs(memcached_st *memc) -{ - global_pairs= pairs_generate(GLOBAL2_COUNT, MEMCACHED_MAX_BUFFER+10); - - for (size_t x= 0; x < GLOBAL2_COUNT; x++) - { - global_keys[x]= global_pairs[x].key; - global_keys_length[x]= global_pairs[x].key_length; - } - - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, true); - global_count= execute_set(memc, global_pairs, (unsigned int)GLOBAL2_COUNT); - - ASSERT_TRUE(global_count > (GLOBAL2_COUNT / 2)); - - return TEST_SUCCESS; -} - -test_return_t generate_data(memcached_st *memc) -{ - test_compare(TEST_SUCCESS, generate_pairs(memc)); - - global_count= execute_set(memc, global_pairs, (unsigned int)GLOBAL_COUNT); - - /* Possible false, positive, memcached may have ejected key/value based on - * memory needs. */ - - ASSERT_TRUE(global_count > (GLOBAL2_COUNT / 2)); - - return TEST_SUCCESS; -} - -test_return_t generate_data_with_stats(memcached_st *memc) -{ - test_compare(TEST_SUCCESS, generate_pairs(memc)); - - global_count= execute_set(memc, global_pairs, (unsigned int)GLOBAL2_COUNT); - - ASSERT_EQ(global_count, GLOBAL2_COUNT); - - // @todo hosts used size stats - memcached_return_t rc; - memcached_stat_st *stat_p= memcached_stat(memc, NULL, &rc); - test_true(stat_p); - - for (uint32_t host_index= 0; host_index < memcached_server_count(memc); host_index++) - { - /* This test was changes so that "make test" would work properlly */ - if (DEBUG) - { - const memcached_instance_st * instance= - memcached_server_instance_by_position(memc, host_index); - - printf("\nserver %u|%s|%u bytes: %llu\n", - host_index, - memcached_server_name(instance), - memcached_server_port(instance), - (unsigned long long)(stat_p + host_index)->bytes); - } - test_true((unsigned long long)(stat_p + host_index)->bytes); - } - - memcached_stat_free(NULL, stat_p); - - return TEST_SUCCESS; -} - -test_return_t generate_buffer_data(memcached_st *memc) -{ - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, true); - generate_data(memc); - - return TEST_SUCCESS; -} - -test_return_t get_read_count(memcached_st *memc) -{ - memcached_st *memc_clone= memcached_clone(NULL, memc); - test_true(memc_clone); - - memcached_server_add_with_weight(memc_clone, "localhost", 6666, 0); - - { - char *return_value; - size_t return_value_length; - uint32_t flags; - uint32_t count; - - for (size_t x= count= 0; x < global_count; ++x) - { - memcached_return_t rc; - return_value= memcached_get(memc_clone, global_keys[x], global_keys_length[x], - &return_value_length, &flags, &rc); - if (rc == MEMCACHED_SUCCESS) - { - count++; - if (return_value) - { - free(return_value); - } - } - } - } - - memcached_free(memc_clone); - - return TEST_SUCCESS; -} - -test_return_t get_read(memcached_st *memc) -{ - test::Memc clone(memc); - size_t keys_returned= 0; - for (size_t x= 0; x < global_count; ++x) - { - size_t return_value_length; - uint32_t flags; - memcached_return_t rc; - char *return_value= memcached_get(&clone, global_keys[x], global_keys_length[x], - &return_value_length, &flags, &rc); - /* - test_true(return_value); - test_compare(MEMCACHED_SUCCESS, rc); - */ - if (rc == MEMCACHED_SUCCESS && return_value) - { - keys_returned++; - free(return_value); - } - } - /* - Possible false, positive, memcached may have ejected key/value based on memory needs. - */ - test_true(keys_returned > (global_count / 2)); - - return TEST_SUCCESS; -} - -test_return_t mget_read(memcached_st *memc) -{ - - test_skip(true, bool(libmemcached_util_version_check(memc, 1, 4, 4))); - - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, global_keys, global_keys_length, global_count)); - - // Go fetch the keys and test to see if all of them were returned - { - unsigned int keys_returned; - test_compare(TEST_SUCCESS, fetch_all_results(memc, keys_returned)); - test_true(keys_returned > (global_count / 2)); - } - - return TEST_SUCCESS; -} - -test_return_t mget_read_result(memcached_st *memc) -{ - - test_skip(true, bool(libmemcached_util_version_check(memc, 1, 4, 4))); - - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, global_keys, global_keys_length, global_count)); - - /* Turn this into a help function */ - { - memcached_result_st results_obj; - memcached_result_st *results= memcached_result_create(memc, &results_obj); - test_true(results); - - memcached_return_t rc; - while ((results= memcached_fetch_result(memc, &results_obj, &rc))) - { - if (rc == MEMCACHED_IN_PROGRESS) - { - continue; - } - - test_true(results); - test_compare(MEMCACHED_SUCCESS, rc); - } - test_compare(MEMCACHED_END, rc); - - memcached_result_free(&results_obj); - } - - return TEST_SUCCESS; -} - -test_return_t mget_read_partial_result(memcached_st *memc) -{ - - test_skip(true, bool(libmemcached_util_version_check(memc, 1, 4, 4))); - - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, global_keys, global_keys_length, global_count)); - - // We will scan for just one key - { - memcached_result_st results_obj; - memcached_result_st *results= memcached_result_create(memc, &results_obj); - - memcached_return_t rc; - results= memcached_fetch_result(memc, results, &rc); - test_true(results); - test_compare(MEMCACHED_SUCCESS, rc); - - memcached_result_free(&results_obj); - } - - // We already have a read happening, lets start up another one. - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, global_keys, global_keys_length, global_count)); - { - memcached_result_st results_obj; - memcached_result_st *results= memcached_result_create(memc, &results_obj); - test_true(results); - test_false(memcached_is_allocated(results)); - - memcached_return_t rc; - while ((results= memcached_fetch_result(memc, &results_obj, &rc))) - { - test_true(results); - test_compare(MEMCACHED_SUCCESS, rc); - } - test_compare(MEMCACHED_END, rc); - - memcached_result_free(&results_obj); - } - - return TEST_SUCCESS; -} - -test_return_t mget_read_function(memcached_st *memc) -{ - test_skip(true, bool(libmemcached_util_version_check(memc, 1, 4, 4))); - - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, global_keys, global_keys_length, global_count)); - - memcached_execute_fn callbacks[]= { &callback_counter }; - size_t counter= 0; - test_compare(MEMCACHED_SUCCESS, - memcached_fetch_execute(memc, callbacks, (void *)&counter, 1)); - - return TEST_SUCCESS; -} - -test_return_t delete_generate(memcached_st *memc) -{ - size_t total= 0; - for (size_t x= 0; x < global_count; x++) - { - if (memcached_success(memcached_delete(memc, global_keys[x], global_keys_length[x], (time_t)0))) - { - total++; - } - } - - /* - Possible false, positive, memcached may have ejected key/value based on memory needs. - */ - ASSERT_TRUE(total); - - return TEST_SUCCESS; -} - -test_return_t delete_buffer_generate(memcached_st *memc) -{ - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, true); - - size_t total= 0; - for (size_t x= 0; x < global_count; x++) - { - if (memcached_success(memcached_delete(memc, global_keys[x], global_keys_length[x], (time_t)0))) - { - total++; - } - } - - ASSERT_TRUE(total); - - return TEST_SUCCESS; -} - -test_return_t mget_read_internal_result(memcached_st *memc) -{ - - test_skip(true, bool(libmemcached_util_version_check(memc, 1, 4, 4))); - - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, global_keys, global_keys_length, global_count)); - { - memcached_result_st *results= NULL; - memcached_return_t rc; - while ((results= memcached_fetch_result(memc, results, &rc))) - { - test_true(results); - test_compare(MEMCACHED_SUCCESS, rc); - } - test_compare(MEMCACHED_END, rc); - - memcached_result_free(results); - } - - return TEST_SUCCESS; -} - diff --git a/tests/libmemcached-1.0/mem_functions.cc b/tests/libmemcached-1.0/mem_functions.cc deleted file mode 100644 index 2c12f9d7..00000000 --- a/tests/libmemcached-1.0/mem_functions.cc +++ /dev/null @@ -1,1262 +0,0 @@ -/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: - * - * Libmemcached library - * - * Copyright (C) 2011 Data Differential, http://datadifferential.com/ - * Copyright (C) 2006-2009 Brian Aker 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. - * - */ - -#include "mem_config.h" -#include "libtest/test.hpp" - -#if defined(HAVE_LIBUUID) && HAVE_LIBUUID -# include -#endif - -/* - Test cases -*/ - -#include "libmemcached-1.0/memcached.h" -#include "libmemcached/is.h" -#include "libmemcached/server_instance.h" - -#include "libhashkit-1.0/hashkit.h" - -#include "libtest/memcached.hpp" - -#include -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_TIME_H -# include -#endif -#include -#include -#if HAVE_UNISTD_H -# include -#endif -#include - -#include "libtest/server.h" - -#include "bin/generator.h" - -#define SMALL_STRING_LEN 1024 - -#include "libtest/test.hpp" - -using namespace libtest; - -#include "libmemcachedutil-1.0/util.h" - -#include "tests/hash_results.h" - -#include "tests/libmemcached-1.0/callback_counter.h" -#include "tests/libmemcached-1.0/fetch_all_results.h" -#include "tests/libmemcached-1.0/mem_functions.h" -#include "tests/libmemcached-1.0/setup_and_teardowns.h" -#include "tests/print.h" -#include "tests/debug.h" -#include "tests/memc.hpp" - -#define UUID_STRING_MAXLENGTH 36 - -#include "tests/keys.hpp" - -#include "libmemcached/instance.hpp" - - -test_return_t mget_end(memcached_st *memc) -{ - const char *keys[]= { "foo", "foo2" }; - size_t lengths[]= { 3, 4 }; - const char *values[]= { "fjord", "41" }; - - // Set foo and foo2 - for (size_t x= 0; x < test_array_length(keys); x++) - { - test_compare(MEMCACHED_SUCCESS, - memcached_set(memc, - keys[x], lengths[x], - values[x], strlen(values[x]), - time_t(0), uint32_t(0))); - } - - char *string; - size_t string_length; - uint32_t flags; - - // retrieve both via mget - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, - keys, lengths, - test_array_length(keys))); - - char key[MEMCACHED_MAX_KEY]; - size_t key_length; - memcached_return_t rc; - - // this should get both - for (size_t x= 0; x < test_array_length(keys); x++) - { - string= memcached_fetch(memc, key, &key_length, &string_length, - &flags, &rc); - test_compare(MEMCACHED_SUCCESS, rc); - int val = 0; - if (key_length == 4) - { - val= 1; - } - - test_compare(string_length, strlen(values[val])); - test_true(strncmp(values[val], string, string_length) == 0); - free(string); - } - - // this should indicate end - string= memcached_fetch(memc, key, &key_length, &string_length, &flags, &rc); - test_compare(MEMCACHED_END, rc); - test_null(string); - - // now get just one - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, keys, lengths, 1)); - - string= memcached_fetch(memc, key, &key_length, &string_length, &flags, &rc); - test_compare(key_length, lengths[0]); - test_true(strncmp(keys[0], key, key_length) == 0); - test_compare(string_length, strlen(values[0])); - test_true(strncmp(values[0], string, string_length) == 0); - test_compare(MEMCACHED_SUCCESS, rc); - free(string); - - // this should indicate end - string= memcached_fetch(memc, key, &key_length, &string_length, &flags, &rc); - test_compare(MEMCACHED_END, rc); - test_null(string); - - return TEST_SUCCESS; -} - -test_return_t mget_result_test(memcached_st *memc) -{ - const char *keys[]= {"fudge", "son", "food"}; - size_t key_length[]= {5, 3, 4}; - - memcached_result_st results_obj; - memcached_result_st *results= memcached_result_create(memc, &results_obj); - test_true(results); - test_true(&results_obj == results); - - /* We need to empty the server before continueing test */ - test_compare(MEMCACHED_SUCCESS, - memcached_flush(memc, 0)); - - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, keys, key_length, 3)); - - memcached_return_t rc; - while ((results= memcached_fetch_result(memc, &results_obj, &rc))) - { - test_true(results); - } - - while ((results= memcached_fetch_result(memc, &results_obj, &rc))) { test_true(false); /* We should never see a value returned */ }; - test_false(results); - test_compare(MEMCACHED_NOTFOUND, rc); - - for (uint32_t x= 0; x < 3; x++) - { - rc= memcached_set(memc, keys[x], key_length[x], - keys[x], key_length[x], - (time_t)50, (uint32_t)9); - test_true(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED); - } - - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, keys, key_length, 3)); - - while ((results= memcached_fetch_result(memc, &results_obj, &rc))) - { - test_true(results); - test_true(&results_obj == results); - test_compare(MEMCACHED_SUCCESS, rc); - test_memcmp(memcached_result_key_value(results), - memcached_result_value(results), - memcached_result_length(results)); - test_compare(memcached_result_key_length(results), memcached_result_length(results)); - } - - memcached_result_free(&results_obj); - - return TEST_SUCCESS; -} - -test_return_t mget_result_alloc_test(memcached_st *memc) -{ - const char *keys[]= {"fudge", "son", "food"}; - size_t key_length[]= {5, 3, 4}; - - memcached_result_st *results; - - /* We need to empty the server before continueing test */ - test_compare(MEMCACHED_SUCCESS, - memcached_flush(memc, 0)); - - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, keys, key_length, 3)); - - memcached_return_t rc; - while ((results= memcached_fetch_result(memc, NULL, &rc))) - { - test_true(results); - } - test_false(results); - test_compare(MEMCACHED_NOTFOUND, rc); - - for (uint32_t x= 0; x < 3; x++) - { - rc= memcached_set(memc, keys[x], key_length[x], - keys[x], key_length[x], - (time_t)50, (uint32_t)9); - test_true(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED); - } - - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, keys, key_length, 3)); - - uint32_t x= 0; - while ((results= memcached_fetch_result(memc, NULL, &rc))) - { - test_true(results); - test_compare(MEMCACHED_SUCCESS, rc); - test_compare(memcached_result_key_length(results), memcached_result_length(results)); - test_memcmp(memcached_result_key_value(results), - memcached_result_value(results), - memcached_result_length(results)); - memcached_result_free(results); - x++; - } - - return TEST_SUCCESS; -} - -test_return_t mget_result_function(memcached_st *memc) -{ - const char *keys[]= {"fudge", "son", "food"}; - size_t key_length[]= {5, 3, 4}; - size_t counter; - memcached_execute_fn callbacks[1]; - - for (uint32_t x= 0; x < 3; x++) - { - test_compare(return_value_based_on_buffering(memc), - memcached_set(memc, keys[x], key_length[x], - keys[x], key_length[x], - time_t(50), uint32_t(9))); - } - test_compare(MEMCACHED_SUCCESS, memcached_flush_buffers(memc)); - memcached_quit(memc); - - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, keys, key_length, 3)); - - callbacks[0]= &callback_counter; - counter= 0; - - test_compare(MEMCACHED_SUCCESS, - memcached_fetch_execute(memc, callbacks, (void *)&counter, 1)); - - test_compare(size_t(3), counter); - - return TEST_SUCCESS; -} - -test_return_t mget_test(memcached_st *memc) -{ - const char *keys[]= {"fudge", "son", "food"}; - size_t key_length[]= {5, 3, 4}; - - char return_key[MEMCACHED_MAX_KEY]; - size_t return_key_length; - char *return_value; - size_t return_value_length; - - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, keys, key_length, 3)); - - uint32_t flags; - memcached_return_t rc; - while ((return_value= memcached_fetch(memc, return_key, &return_key_length, - &return_value_length, &flags, &rc))) - { - test_true(return_value); - } - test_false(return_value); - test_zero(return_value_length); - test_compare(MEMCACHED_NOTFOUND, rc); - - for (uint32_t x= 0; x < 3; x++) - { - rc= memcached_set(memc, keys[x], key_length[x], - keys[x], key_length[x], - (time_t)50, (uint32_t)9); - test_true(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED); - } - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, keys, key_length, 3)); - - uint32_t x= 0; - while ((return_value= memcached_fetch(memc, return_key, &return_key_length, - &return_value_length, &flags, &rc))) - { - test_true(return_value); - test_compare(MEMCACHED_SUCCESS, rc); - if (not memc->_namespace) - { - test_compare(return_key_length, return_value_length); - test_memcmp(return_value, return_key, return_value_length); - } - free(return_value); - x++; - } - - return TEST_SUCCESS; -} - -test_return_t mget_execute(memcached_st *original_memc) -{ - test_skip(true, memcached_behavior_get(original_memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL)); - - memcached_st *memc= create_single_instance_memcached(original_memc, "--BINARY-PROTOCOL"); - test_true(memc); - - keys_st keys(20480); - - /* First add all of the items.. */ - char blob[1024] = {0}; - - for (size_t x= 0; x < keys.size(); ++x) - { - uint64_t query_id= memcached_query_id(memc); - memcached_return_t rc= memcached_add(memc, - keys.key_at(x), keys.length_at(x), - blob, sizeof(blob), - 0, 0); - ASSERT_TRUE_(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED, "Returned %s", memcached_strerror(NULL, rc)); - test_compare(query_id +1, memcached_query_id(memc)); - } - - /* Try to get all of them with a large multiget */ - size_t counter= 0; - memcached_execute_fn callbacks[]= { &callback_counter }; - test_compare(MEMCACHED_SUCCESS, - memcached_mget_execute(memc, - keys.keys_ptr(), keys.lengths_ptr(), - keys.size(), callbacks, &counter, 1)); - - { - uint64_t query_id= memcached_query_id(memc); - test_compare(MEMCACHED_SUCCESS, - memcached_fetch_execute(memc, callbacks, (void *)&counter, 1)); - test_compare(query_id, memcached_query_id(memc)); - - /* Verify that we got all of the items */ - test_compare(keys.size(), counter); - } - - memcached_free(memc); - - return TEST_SUCCESS; -} - - - -test_return_t memcached_fetch_result_NOT_FOUND(memcached_st *memc) -{ - memcached_return_t rc; - - const char *key= "not_found"; - size_t key_length= test_literal_param_size("not_found"); - - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, &key, &key_length, 1)); - - memcached_result_st *result= memcached_fetch_result(memc, NULL, &rc); - test_null(result); - test_compare(MEMCACHED_NOTFOUND, rc); - - memcached_result_free(result); - - return TEST_SUCCESS; -} - -/* - Bug found where incr was not returning MEMCACHED_NOTFOUND when object did not exist. -*/ -test_return_t user_supplied_bug12(memcached_st *memc) -{ - memcached_return_t rc; - uint32_t flags; - size_t value_length; - char *value; - uint64_t number_value; - - value= memcached_get(memc, "autoincrement", strlen("autoincrement"), - &value_length, &flags, &rc); - test_null(value); - test_compare(MEMCACHED_NOTFOUND, rc); - - rc= memcached_increment(memc, "autoincrement", strlen("autoincrement"), - 1, &number_value); - test_null(value); - /* The binary protocol will set the key if it doesn't exist */ - if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == 1) - { - test_compare(MEMCACHED_SUCCESS, rc); - } - else - { - test_compare(MEMCACHED_NOTFOUND, rc); - } - - test_compare(MEMCACHED_SUCCESS, - memcached_set(memc, "autoincrement", strlen("autoincrement"), "1", 1, 0, 0)); - - value= memcached_get(memc, "autoincrement", strlen("autoincrement"), &value_length, &flags, &rc); - test_true(value); - free(value); - - test_compare(MEMCACHED_SUCCESS, - memcached_increment(memc, "autoincrement", strlen("autoincrement"), 1, &number_value)); - test_compare(2UL, number_value); - - return TEST_SUCCESS; -} - -/* - Bug found where command total one more than MEMCACHED_MAX_BUFFER - set key34567890 0 0 8169 \r\n is sent followed by buffer of size 8169, followed by 8169 -*/ -test_return_t user_supplied_bug13(memcached_st *memc) -{ - char key[] = "key34567890"; - - char commandFirst[]= "set key34567890 0 0 "; - char commandLast[] = " \r\n"; /* first line of command sent to server */ - size_t commandLength; - - commandLength = strlen(commandFirst) + strlen(commandLast) + 4; /* 4 is number of characters in size, probably 8196 */ - - size_t overflowSize = MEMCACHED_MAX_BUFFER - commandLength; - - for (size_t testSize= overflowSize - 1; testSize < overflowSize + 1; testSize++) - { - char *overflow= new (std::nothrow) char[testSize]; - test_true(overflow); - - memset(overflow, 'x', testSize); - test_compare(MEMCACHED_SUCCESS, - memcached_set(memc, key, strlen(key), - overflow, testSize, 0, 0)); - delete [] overflow; - } - - return TEST_SUCCESS; -} - - -/* - Test values of many different sizes - Bug found where command total one more than MEMCACHED_MAX_BUFFER - set key34567890 0 0 8169 \r\n - is sent followed by buffer of size 8169, followed by 8169 -*/ -test_return_t user_supplied_bug14(memcached_st *memc) -{ - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, true); - - libtest::vchar_t value; - value.reserve(18000); - for (ptrdiff_t x= 0; x < 18000; x++) - { - value.push_back((char) (x % 127)); - } - - for (size_t current_length= 1; current_length < value.size(); current_length++) - { - memcached_return_t rc= memcached_set(memc, test_literal_param("foo"), - &value[0], current_length, - (time_t)0, (uint32_t)0); - ASSERT_TRUE_(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED, "Instead got %s", memcached_strerror(NULL, rc)); - - size_t string_length; - uint32_t flags; - char *string= memcached_get(memc, test_literal_param("foo"), - &string_length, &flags, &rc); - - test_compare(MEMCACHED_SUCCESS, rc); - test_compare(string_length, current_length); - char buffer[1024]; - snprintf(buffer, sizeof(buffer), "%u", uint32_t(string_length)); - test_memcmp(string, &value[0], string_length); - - free(string); - } - - return TEST_SUCCESS; -} - -/* - From Andrei on IRC -*/ - -test_return_t user_supplied_bug19(memcached_st *) -{ - memcached_return_t res; - - memcached_st *memc= memcached(test_literal_param("--server=localhost:11311/?100 --server=localhost:11312/?100")); - - const memcached_instance_st * server= memcached_server_by_key(memc, "a", 1, &res); - test_true(server); - - memcached_free(memc); - - return TEST_SUCCESS; -} - -/* CAS test from Andei */ -test_return_t user_supplied_bug20(memcached_st *memc) -{ - const char *key= "abc"; - size_t key_len= strlen("abc"); - - test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, true)); - - test_compare(MEMCACHED_SUCCESS, - memcached_set(memc, - test_literal_param("abc"), - test_literal_param("foobar"), - (time_t)0, (uint32_t)0)); - - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, &key, &key_len, 1)); - - memcached_result_st result_obj; - memcached_result_st *result= memcached_result_create(memc, &result_obj); - test_true(result); - - memcached_result_create(memc, &result_obj); - memcached_return_t status; - result= memcached_fetch_result(memc, &result_obj, &status); - - test_true(result); - test_compare(MEMCACHED_SUCCESS, status); - - memcached_result_free(result); - - return TEST_SUCCESS; -} - -/* Large mget() of missing keys with binary proto - * - * If many binary quiet commands (such as getq's in an mget) fill the output - * buffer and the server chooses not to respond, memcached_flush hangs. See - * http://lists.tangent.org/pipermail/libmemcached/2009-August/000918.html - */ - -/* sighandler_t function that always asserts false */ -static __attribute__((noreturn)) void fail(int) -{ - fatal_assert(0); -} - - -test_return_t _user_supplied_bug21(memcached_st* memc, size_t key_count) -{ -#ifdef WIN32 - (void)memc; - (void)key_count; - return TEST_SKIPPED; -#else - void (*oldalarm)(int); - - memcached_st *memc_clone= memcached_clone(NULL, memc); - test_true(memc_clone); - - /* only binproto uses getq for mget */ - test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, true)); - - /* empty the cache to ensure misses (hence non-responses) */ - test_compare(MEMCACHED_SUCCESS, memcached_flush(memc_clone, 0)); - - keys_st keys(key_count); - - oldalarm= signal(SIGALRM, fail); - alarm(5); - - test_compare_got(MEMCACHED_SUCCESS, - memcached_mget(memc_clone, keys.keys_ptr(), keys.lengths_ptr(), keys.size()), - memcached_last_error_message(memc_clone)); - - alarm(0); - signal(SIGALRM, oldalarm); - - memcached_return_t rc; - uint32_t flags; - char return_key[MEMCACHED_MAX_KEY]; - size_t return_key_length; - char *return_value; - size_t return_value_length; - while ((return_value= memcached_fetch(memc, return_key, &return_key_length, - &return_value_length, &flags, &rc))) - { - test_false(return_value); // There are no keys to fetch, so the value should never be returned - } - test_compare(MEMCACHED_NOTFOUND, rc); - test_zero(return_value_length); - test_zero(return_key_length); - test_false(return_key[0]); - test_false(return_value); - - memcached_free(memc_clone); - - return TEST_SUCCESS; -#endif -} - -test_return_t user_supplied_bug21(memcached_st *memc) -{ - test_skip(TEST_SUCCESS, pre_binary(memc)); - - /* should work as of r580 */ - test_compare(TEST_SUCCESS, - _user_supplied_bug21(memc, 10)); - - /* should fail as of r580 */ - test_compare(TEST_SUCCESS, - _user_supplied_bug21(memc, 1000)); - - return TEST_SUCCESS; -} - -test_return_t comparison_operator_memcached_st_and__memcached_return_t_TEST(memcached_st *) -{ - test::Memc memc_; - - memcached_st *memc= &memc_; - - ASSERT_EQ(memc, MEMCACHED_SUCCESS); - test_compare(memc, MEMCACHED_SUCCESS); - - ASSERT_NEQ(memc, MEMCACHED_FAILURE); - - return TEST_SUCCESS; -} - - -static void my_free(const memcached_st *ptr, void *mem, void *context) -{ - (void)context; - (void)ptr; -#ifdef HARD_MALLOC_TESTS - void *real_ptr= (mem == NULL) ? mem : (void*)((caddr_t)mem - 8); - free(real_ptr); -#else - free(mem); -#endif -} - - -static void *my_malloc(const memcached_st *ptr, const size_t size, void *context) -{ - (void)context; - (void)ptr; -#ifdef HARD_MALLOC_TESTS - void *ret= malloc(size + 8); - if (ret != NULL) - { - ret= (void*)((caddr_t)ret + 8); - } -#else - void *ret= malloc(size); -#endif - - if (ret != NULL) - { - memset(ret, 0xff, size); - } - - return ret; -} - - -static void *my_realloc(const memcached_st *ptr, void *mem, const size_t size, void *) -{ -#ifdef HARD_MALLOC_TESTS - void *real_ptr= (mem == NULL) ? NULL : (void*)((caddr_t)mem - 8); - void *nmem= realloc(real_ptr, size + 8); - - void *ret= NULL; - if (nmem != NULL) - { - ret= (void*)((caddr_t)nmem + 8); - } - - return ret; -#else - (void)ptr; - return realloc(mem, size); -#endif -} - - -static void *my_calloc(const memcached_st *ptr, size_t nelem, const size_t size, void *) -{ -#ifdef HARD_MALLOC_TESTS - void *mem= my_malloc(ptr, nelem * size); - if (mem) - { - memset(mem, 0, nelem * size); - } - - return mem; -#else - (void)ptr; - return calloc(nelem, size); -#endif -} - -#ifdef MEMCACHED_ENABLE_DEPRECATED -test_return_t deprecated_set_memory_alloc(memcached_st *memc) -{ - void *test_ptr= NULL; - void *cb_ptr= NULL; - { - memcached_malloc_fn malloc_cb= (memcached_malloc_fn)my_malloc; - cb_ptr= *(void **)&malloc_cb; - memcached_return_t rc; - - test_compare(MEMCACHED_SUCCESS, - memcached_callback_set(memc, MEMCACHED_CALLBACK_MALLOC_FUNCTION, cb_ptr)); - test_ptr= memcached_callback_get(memc, MEMCACHED_CALLBACK_MALLOC_FUNCTION, &rc); - test_compare(MEMCACHED_SUCCESS, rc); - test_true(test_ptr == cb_ptr); - } - - { - memcached_realloc_fn realloc_cb= - (memcached_realloc_fn)my_realloc; - cb_ptr= *(void **)&realloc_cb; - memcached_return_t rc; - - test_compare(MEMCACHED_SUCCESS, - memcached_callback_set(memc, MEMCACHED_CALLBACK_REALLOC_FUNCTION, cb_ptr)); - test_ptr= memcached_callback_get(memc, MEMCACHED_CALLBACK_REALLOC_FUNCTION, &rc); - test_compare(MEMCACHED_SUCCESS, rc); - test_true(test_ptr == cb_ptr); - } - - { - memcached_free_fn free_cb= - (memcached_free_fn)my_free; - cb_ptr= *(void **)&free_cb; - memcached_return_t rc; - - test_compare(MEMCACHED_SUCCESS, - memcached_callback_set(memc, MEMCACHED_CALLBACK_FREE_FUNCTION, cb_ptr)); - test_ptr= memcached_callback_get(memc, MEMCACHED_CALLBACK_FREE_FUNCTION, &rc); - test_compare(MEMCACHED_SUCCESS, rc); - test_true(test_ptr == cb_ptr); - } - - return TEST_SUCCESS; -} -#endif - - -test_return_t set_memory_alloc(memcached_st *memc) -{ - test_compare(MEMCACHED_INVALID_ARGUMENTS, - memcached_set_memory_allocators(memc, NULL, my_free, - my_realloc, my_calloc, NULL)); - - test_compare(MEMCACHED_SUCCESS, - memcached_set_memory_allocators(memc, my_malloc, my_free, - my_realloc, my_calloc, NULL)); - - memcached_malloc_fn mem_malloc; - memcached_free_fn mem_free; - memcached_realloc_fn mem_realloc; - memcached_calloc_fn mem_calloc; - memcached_get_memory_allocators(memc, &mem_malloc, &mem_free, - &mem_realloc, &mem_calloc); - - test_true(mem_malloc == my_malloc); - test_true(mem_realloc == my_realloc); - test_true(mem_calloc == my_calloc); - test_true(mem_free == my_free); - - return TEST_SUCCESS; -} - - - -/* - Test case adapted from John Gorman - - We are testing the error condition when we connect to a server via memcached_get() - but find that the server is not available. -*/ -test_return_t memcached_get_MEMCACHED_ERRNO(memcached_st *) -{ - size_t len; - uint32_t flags; - memcached_return rc; - - // Create a handle. - memcached_st *tl_memc_h= memcached(test_literal_param("--server=localhost:9898 --server=localhost:9899")); // This server should not exist - - // See if memcached is reachable. - char *value= memcached_get(tl_memc_h, - test_literal_param(__func__), - &len, &flags, &rc); - - test_false(value); - test_zero(len); - test_true(memcached_failed(rc)); - - memcached_free(tl_memc_h); - - return TEST_SUCCESS; -} - -/* - Test case adapted from John Gorman - - We are testing the error condition when we connect to a server via memcached_get_by_key() - but find that the server is not available. -*/ -test_return_t memcached_get_by_key_MEMCACHED_ERRNO(memcached_st *) -{ - size_t len; - uint32_t flags; - memcached_return rc; - - // Create a handle. - memcached_st *tl_memc_h= memcached_create(NULL); - memcached_server_st *servers= memcached_servers_parse("localhost:9898,localhost:9899"); // This server should not exist - memcached_server_push(tl_memc_h, servers); - memcached_server_list_free(servers); - - // See if memcached is reachable. - char *value= memcached_get_by_key(tl_memc_h, - test_literal_param(__func__), // Key - test_literal_param(__func__), // Value - &len, &flags, &rc); - - test_false(value); - test_zero(len); - test_true(memcached_failed(rc)); - - memcached_free(tl_memc_h); - - return TEST_SUCCESS; -} - -/* Test memcached_server_get_last_disconnect - * For a working server set, shall be NULL - * For a set of non existing server, shall not be NULL - */ -test_return_t test_get_last_disconnect(memcached_st *memc) -{ - memcached_return_t rc; - const memcached_instance_st * disconnected_server; - - /* With the working set of server */ - const char *key= "marmotte"; - const char *value= "milka"; - - memcached_reset_last_disconnected_server(memc); - test_false(memc->last_disconnected_server); - rc= memcached_set(memc, key, strlen(key), - value, strlen(value), - (time_t)0, (uint32_t)0); - test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); - - disconnected_server = memcached_server_get_last_disconnect(memc); - test_false(disconnected_server); - - /* With a non existing server */ - memcached_st *mine; - memcached_server_st *servers; - - const char *server_list= "localhost:9"; - - servers= memcached_servers_parse(server_list); - test_true(servers); - mine= memcached_create(NULL); - rc= memcached_server_push(mine, servers); - test_compare(MEMCACHED_SUCCESS, rc); - memcached_server_list_free(servers); - test_true(mine); - - rc= memcached_set(mine, key, strlen(key), - value, strlen(value), - (time_t)0, (uint32_t)0); - test_true(memcached_failed(rc)); - - disconnected_server= memcached_server_get_last_disconnect(mine); - test_true_got(disconnected_server, memcached_strerror(mine, rc)); - test_compare(in_port_t(9), memcached_server_port(disconnected_server)); - test_false(strncmp(memcached_server_name(disconnected_server),"localhost",9)); - - memcached_quit(mine); - memcached_free(mine); - - return TEST_SUCCESS; -} - -test_return_t test_multiple_get_last_disconnect(memcached_st *) -{ - const char *server_string= "--server=localhost:8888 --server=localhost:8889 --server=localhost:8890 --server=localhost:8891 --server=localhost:8892"; - char buffer[BUFSIZ]; - - test_compare(MEMCACHED_SUCCESS, - libmemcached_check_configuration(server_string, strlen(server_string), buffer, sizeof(buffer))); - - memcached_st *memc= memcached(server_string, strlen(server_string)); - test_true(memc); - - // We will just use the error strings as our keys - uint32_t counter= 100; - while (--counter) - { - for (int x= int(MEMCACHED_SUCCESS); x < int(MEMCACHED_MAXIMUM_RETURN); ++x) - { - const char *msg= memcached_strerror(memc, memcached_return_t(x)); - memcached_return_t ret= memcached_set(memc, msg, strlen(msg), NULL, 0, (time_t)0, (uint32_t)0); - test_true_got((ret == MEMCACHED_CONNECTION_FAILURE or ret == MEMCACHED_SERVER_TEMPORARILY_DISABLED), memcached_last_error_message(memc)); - - const memcached_instance_st * disconnected_server= memcached_server_get_last_disconnect(memc); - test_true(disconnected_server); - test_strcmp("localhost", memcached_server_name(disconnected_server)); - test_true(memcached_server_port(disconnected_server) >= 8888 and memcached_server_port(disconnected_server) <= 8892); - - if (random() % 2) - { - memcached_reset_last_disconnected_server(memc); - } - } - } - - memcached_free(memc); - - return TEST_SUCCESS; -} - -/* - * This test ensures that the failure counter isn't incremented during - * normal termination of the memcached instance. - */ -test_return_t wrong_failure_counter_test(memcached_st *original_memc) -{ - memcached_st* memc= create_single_instance_memcached(original_memc, NULL); - - /* Ensure that we are connected to the server by setting a value */ - memcached_return_t rc= memcached_set(memc, - test_literal_param(__func__), // Key - test_literal_param(__func__), // Value - time_t(0), uint32_t(0)); - test_true(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED); - - - const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 0); - - /* The test is to see that the memcached_quit doesn't increase the - * the server failure conter, so let's ensure that it is zero - * before sending quit - */ - ((memcached_server_write_instance_st)instance)->server_failure_counter= 0; - - memcached_quit(memc); - - /* Verify that it memcached_quit didn't increment the failure counter - * Please note that this isn't bullet proof, because an error could - * occur... - */ - test_zero(instance->server_failure_counter); - - memcached_free(memc); - - return TEST_SUCCESS; -} - -/* - * This tests ensures expected disconnections (for some behavior changes - * for instance) do not wrongly increase failure counter - */ -test_return_t wrong_failure_counter_two_test(memcached_st *memc) -{ - /* Set value to force connection to the server */ - const char *key= "marmotte"; - const char *value= "milka"; - - test_compare_hint(MEMCACHED_SUCCESS, - memcached_set(memc, key, strlen(key), - value, strlen(value), - (time_t)0, (uint32_t)0), - memcached_last_error_message(memc)); - - - /* put failure limit to 1 */ - test_compare(MEMCACHED_SUCCESS, - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT, true)); - - /* Put a retry timeout to effectively activate failure_limit effect */ - test_compare(MEMCACHED_SUCCESS, - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_RETRY_TIMEOUT, 1)); - - /* change behavior that triggers memcached_quit()*/ - test_compare(MEMCACHED_SUCCESS, - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, true)); - - - /* Check if we still are connected */ - uint32_t flags; - size_t string_length; - memcached_return rc; - char *string= memcached_get(memc, key, strlen(key), - &string_length, &flags, &rc); - - test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); - test_true(string); - free(string); - - return TEST_SUCCESS; -} - - -#define regression_bug_655423_COUNT 6000 -test_return_t regression_bug_655423(memcached_st *memc) -{ - memcached_st *clone= memcached_clone(NULL, memc); - memc= NULL; // Just to make sure it is not used - test_true(clone); - char payload[100]; - -#ifdef __APPLE__ - return TEST_SKIPPED; -#endif - - test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1)); - test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(clone, MEMCACHED_BEHAVIOR_SUPPORT_CAS, 1)); - test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(clone, MEMCACHED_BEHAVIOR_TCP_NODELAY, 1)); - test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(clone, MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH, 1)); - - memset(payload, int('x'), sizeof(payload)); - - keys_st keys(regression_bug_655423_COUNT); - - for (size_t x= 0; x < keys.size(); x++) - { - test_compare(MEMCACHED_SUCCESS, memcached_set(clone, - keys.key_at(x), - keys.length_at(x), - payload, sizeof(payload), 0, 0)); - } - - for (size_t x= 0; x < keys.size(); x++) - { - size_t value_length; - memcached_return_t rc; - char *value= memcached_get(clone, - keys.key_at(x), - keys.length_at(x), - &value_length, NULL, &rc); - - if (rc == MEMCACHED_NOTFOUND) - { - test_false(value); - test_zero(value_length); - continue; - } - - test_compare(MEMCACHED_SUCCESS, rc); - test_true(value); - test_compare(100LLU, value_length); - free(value); - } - - test_compare(MEMCACHED_SUCCESS, - memcached_mget(clone, - keys.keys_ptr(), keys.lengths_ptr(), - keys.size())); - - uint32_t count= 0; - memcached_result_st *result= NULL; - while ((result= memcached_fetch_result(clone, result, NULL))) - { - test_compare(size_t(100), memcached_result_length(result)); - count++; - } - - test_true(count > 100); // If we don't get back atleast this, something is up - - memcached_free(clone); - - return TEST_SUCCESS; -} - -/* - * Test that ensures that buffered set to not trigger problems during io_flush - */ -#define regression_bug_490520_COUNT 200480 -test_return_t regression_bug_490520(memcached_st *original_memc) -{ - memcached_st* memc= create_single_instance_memcached(original_memc, NULL); - - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK,1); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS,1); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, 1000); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT,1); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_RETRY_TIMEOUT, 3600); - - /* First add all of the items.. */ - char blob[3333] = {0}; - for (uint32_t x= 0; x < regression_bug_490520_COUNT; ++x) - { - char key[251]; - int key_length= snprintf(key, sizeof(key), "0200%u", x); - - memcached_return rc= memcached_set(memc, key, key_length, blob, sizeof(blob), 0, 0); - test_true_got(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED, memcached_last_error_message(memc)); - } - - memcached_free(memc); - - return TEST_SUCCESS; -} - -test_return_t regression_bug_1251482(memcached_st*) -{ - test::Memc memc("--server=localhost:5"); - - memcached_behavior_set(&memc, MEMCACHED_BEHAVIOR_RETRY_TIMEOUT, 0); - - for (size_t x= 0; x < 5; ++x) - { - size_t value_length; - memcached_return_t rc; - char *value= memcached_get(&memc, - test_literal_param(__func__), - &value_length, NULL, &rc); - - test_false(value); - test_compare(0LLU, value_length); - if (x) { - test_ne_compare(MEMCACHED_SUCCESS, rc); - } else { - test_compare(MEMCACHED_CONNECTION_FAILURE, rc); - } - } - - return TEST_SUCCESS; -} - -test_return_t regression_1009493_TEST(memcached_st*) -{ - memcached_st* memc= memcached_create(NULL); - test_true(memc); - test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA, true)); - - memcached_st* clone= memcached_clone(NULL, memc); - test_true(clone); - - test_compare(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED), - memcached_behavior_get(clone, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED)); - - memcached_free(memc); - memcached_free(clone); - - return TEST_SUCCESS; -} - -test_return_t regression_994772_TEST(memcached_st* memc) -{ - test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1)); - - test_compare(MEMCACHED_SUCCESS, - memcached_set(memc, - test_literal_param(__func__), // Key - test_literal_param(__func__), // Value - time_t(0), uint32_t(0))); - - const char *keys[] = { __func__ }; - size_t key_length[]= { strlen(__func__) }; - test_compare(MEMCACHED_SUCCESS, - memcached_mget(memc, keys, key_length, 1)); - - memcached_return_t rc; - memcached_result_st *results= memcached_fetch_result(memc, NULL, &rc); - test_true(results); - test_compare(MEMCACHED_SUCCESS, rc); - - test_strcmp(__func__, memcached_result_value(results)); - uint64_t cas_value= memcached_result_cas(results); - test_true(cas_value); - - char* take_value= memcached_result_take_value(results); - test_strcmp(__func__, take_value); - free(take_value); - - memcached_result_free(results); - - // Bad cas value, sanity check - test_true(cas_value != 9999); - test_compare(MEMCACHED_END, - memcached_cas(memc, - test_literal_param(__func__), // Key - test_literal_param(__FILE__), // Value - time_t(0), uint32_t(0), 9999)); - - test_compare(MEMCACHED_SUCCESS, memcached_set(memc, - "different", strlen("different"), // Key - test_literal_param(__FILE__), // Value - time_t(0), uint32_t(0))); - - return TEST_SUCCESS; -} diff --git a/tests/libmemcached-1.0/mem_functions.h b/tests/libmemcached-1.0/mem_functions.h deleted file mode 100644 index 04ec19f0..00000000 --- a/tests/libmemcached-1.0/mem_functions.h +++ /dev/null @@ -1,190 +0,0 @@ -/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: - * - * Libmemcached Client and Server - * - * Copyright (C) 2012 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 - -test_return_t MEMCACHED_BEHAVIOR_CORK_test(memcached_st *memc); -test_return_t MEMCACHED_BEHAVIOR_POLL_TIMEOUT_test(memcached_st *memc); -test_return_t MEMCACHED_BEHAVIOR_TCP_KEEPALIVE_test(memcached_st *memc); -test_return_t MEMCACHED_BEHAVIOR_TCP_KEEPIDLE_test(memcached_st *memc); -test_return_t _user_supplied_bug21(memcached_st* memc, size_t key_count); -test_return_t add_host_test(memcached_st *memc); -test_return_t add_host_test1(memcached_st *memc); -test_return_t memcached_add_SUCCESS_TEST(memcached_st*); -test_return_t add_test(memcached_st *memc); -test_return_t add_wrapper(memcached_st *memc); -test_return_t allocation_test(memcached_st *not_used); -test_return_t analyzer_test(memcached_st *memc); -test_return_t append_binary_test(memcached_st *memc); -test_return_t append_test(memcached_st *memc); -test_return_t bad_key_test(memcached_st *memc); -test_return_t behavior_test(memcached_st *memc); -test_return_t binary_add_regression(memcached_st *memc); -test_return_t binary_increment_with_prefix_test(memcached_st *memc); -test_return_t block_add_regression(memcached_st *memc); -test_return_t callback_test(memcached_st *memc); -test_return_t cas2_test(memcached_st *memc); -test_return_t cas_test(memcached_st *memc); -test_return_t check_for_1_2_3(memcached_st *memc); -test_return_t clone_test(memcached_st *memc); -test_return_t connection_test(memcached_st *memc); -test_return_t crc_run (memcached_st *); -test_return_t decrement_by_key_test(memcached_st *memc); -test_return_t decrement_test(memcached_st *memc); -test_return_t decrement_with_initial_by_key_test(memcached_st *memc); -test_return_t decrement_with_initial_test(memcached_st *memc); -test_return_t decrement_with_initial_999_test(memcached_st *memc); -test_return_t delete_test(memcached_st *memc); -test_return_t deprecated_set_memory_alloc(memcached_st *memc); -test_return_t enable_cas(memcached_st *memc); -test_return_t enable_consistent_crc(memcached_st *memc); -test_return_t enable_consistent_hsieh(memcached_st *memc); -test_return_t flush_test(memcached_st *memc); -test_return_t fnv1_32_run (memcached_st *); -test_return_t fnv1_64_run (memcached_st *); -test_return_t fnv1a_32_run (memcached_st *); -test_return_t fnv1a_64_run (memcached_st *); -test_return_t get_stats(memcached_st *memc); -test_return_t get_stats_keys(memcached_st *memc); -test_return_t getpid_connection_failure_test(memcached_st *memc); -test_return_t getpid_test(memcached_st *memc); -test_return_t hash_sanity_test (memcached_st *memc); -test_return_t hsieh_avaibility_test (memcached_st *memc); -test_return_t hsieh_run (memcached_st *); -test_return_t increment_by_key_test(memcached_st *memc); -test_return_t increment_test(memcached_st *memc); -test_return_t increment_with_initial_by_key_test(memcached_st *memc); -test_return_t increment_with_initial_test(memcached_st *memc); -test_return_t increment_with_initial_999_test(memcached_st *memc); -test_return_t init_test(memcached_st *not_used); -test_return_t jenkins_run (memcached_st *); -test_return_t key_setup(memcached_st *memc); -test_return_t key_teardown(memcached_st *); -test_return_t libmemcached_string_behavior_test(memcached_st *); -test_return_t libmemcached_string_distribution_test(memcached_st *); -test_return_t md5_run (memcached_st *); -test_return_t memcached_fetch_result_NOT_FOUND(memcached_st *memc); -test_return_t memcached_get_MEMCACHED_ERRNO(memcached_st *); -test_return_t memcached_get_MEMCACHED_NOTFOUND(memcached_st *memc); -test_return_t memcached_get_by_key_MEMCACHED_ERRNO(memcached_st *memc); -test_return_t memcached_get_by_key_MEMCACHED_NOTFOUND(memcached_st *memc); -test_return_t memcached_get_hashkit_test (memcached_st *); -test_return_t memcached_mget_mixed_memcached_get_TEST(memcached_st *memc); -test_return_t memcached_return_t_TEST(memcached_st *memc); -test_return_t memcached_server_cursor_test(memcached_st *memc); -test_return_t memcached_server_remove_test(memcached_st*); -test_return_t memcached_stat_execute_test(memcached_st *memc); -test_return_t mget_end(memcached_st *memc); -test_return_t mget_execute(memcached_st *original_memc); -test_return_t MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH_TEST(memcached_st *original_memc); -test_return_t mget_result_alloc_test(memcached_st *memc); -test_return_t mget_result_function(memcached_st *memc); -test_return_t mget_result_test(memcached_st *memc); -test_return_t mget_test(memcached_st *memc); -test_return_t murmur_avaibility_test (memcached_st *memc); -test_return_t murmur_run (memcached_st *); -test_return_t murmur3_TEST(hashkit_st *); -test_return_t noreply_test(memcached_st *memc); -test_return_t one_at_a_time_run (memcached_st *); -test_return_t ketama_TEST(memcached_st *); -test_return_t output_ketama_weighted_keys(memcached_st *); -test_return_t libmemcached_util_ping_TEST(memcached_st*); -test_return_t prepend_test(memcached_st *memc); -test_return_t quit_test(memcached_st *memc); -test_return_t read_through(memcached_st *memc); -test_return_t regression_bug_(memcached_st*); -test_return_t regression_bug_421108(memcached_st*); -test_return_t regression_bug_434484(memcached_st*); -test_return_t regression_bug_434843(memcached_st*); -test_return_t regression_bug_434843_buffered(memcached_st*); -test_return_t regression_bug_442914(memcached_st*); -test_return_t regression_bug_447342(memcached_st*); -test_return_t regression_bug_463297(memcached_st*); -test_return_t regression_bug_490486(memcached_st*); -test_return_t regression_bug_490520(memcached_st*); -test_return_t regression_bug_581030(memcached_st*); -test_return_t regression_bug_583031(memcached_st*); -test_return_t regression_1021819_TEST(memcached_st*); -test_return_t regression_bug_655423(memcached_st*); -test_return_t regression_bug_854604(memcached_st*); -test_return_t replace_test(memcached_st *memc); -test_return_t result_alloc(memcached_st *memc); -test_return_t result_static(memcached_st *memc); -test_return_t selection_of_namespace_tests(memcached_st *memc); -test_return_t server_sort2_test(memcached_st *ptr); -test_return_t server_sort_test(memcached_st *ptr); -test_return_t server_unsort_test(memcached_st *ptr); -test_return_t set_memory_alloc(memcached_st *memc); -test_return_t set_namespace(memcached_st *memc); -test_return_t set_namespace_and_binary(memcached_st *memc); -test_return_t set_test(memcached_st *memc); -test_return_t set_test2(memcached_st *memc); -test_return_t set_test3(memcached_st *memc); -test_return_t stats_servername_test(memcached_st *memc); -test_return_t test_get_last_disconnect(memcached_st *memc); -test_return_t test_multiple_get_last_disconnect(memcached_st *); -test_return_t test_verbosity(memcached_st *memc); -test_return_t user_supplied_bug10(memcached_st *memc); -test_return_t user_supplied_bug11(memcached_st *memc); -test_return_t user_supplied_bug12(memcached_st *memc); -test_return_t user_supplied_bug13(memcached_st *memc); -test_return_t user_supplied_bug14(memcached_st *memc); -test_return_t user_supplied_bug15(memcached_st *memc); -test_return_t user_supplied_bug16(memcached_st *memc); -test_return_t user_supplied_bug17(memcached_st *memc); -test_return_t user_supplied_bug19(memcached_st *); -test_return_t user_supplied_bug20(memcached_st *memc); -test_return_t user_supplied_bug21(memcached_st *memc); -test_return_t user_supplied_bug4(memcached_st *memc); -test_return_t user_supplied_bug5(memcached_st *memc); -test_return_t user_supplied_bug6(memcached_st *memc); -test_return_t user_supplied_bug7(memcached_st *memc); -test_return_t user_supplied_bug8(memcached_st *); -test_return_t user_supplied_bug9(memcached_st *memc); -test_return_t userdata_test(memcached_st *memc); -test_return_t util_version_test(memcached_st *memc); -test_return_t version_string_test(memcached_st *); -test_return_t wrong_failure_counter_test(memcached_st *memc); -test_return_t wrong_failure_counter_two_test(memcached_st *memc); -test_return_t kill_TEST(memcached_st *memc); -test_return_t regression_996813_TEST(memcached_st*); -test_return_t regression_994772_TEST(memcached_st*); -test_return_t regression_1009493_TEST(memcached_st*); -test_return_t regression_1048945_TEST(memcached_st*); -test_return_t regression_1067242_TEST(memcached_st*); -test_return_t comparison_operator_memcached_st_and__memcached_return_t_TEST(memcached_st*); -test_return_t regression_bug_1251482(memcached_st*); diff --git a/tests/libmemcached-1.0/memcached_fetch_execute.cc b/tests/libmemcached-1.0/memcached_fetch_execute.cc deleted file mode 100644 index a2673e0c..00000000 --- a/tests/libmemcached-1.0/memcached_fetch_execute.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* 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 "mem_config.h" -#include "libtest/test.hpp" - -#include "libmemcached-1.0/memcached.h" -#include "libmemcached/util.h" - -using namespace libtest; - -static test_return_t memcached_fetch_execute_MEMCACHED_SUCCESS_TEST(memcached_st *memc) -{ - (void)memc; - return TEST_SUCCESS; -} - -static test_return_t memcached_fetch_execute_MEMCACHED_NOTFOUND_TEST(memcached_st *memc) -{ - (void)memc; - return TEST_SUCCESS; -} - -test_st memcached_fetch_execute_TESTS[] ={ - {"memcached_fetch_execute(MEMCACHED_SUCCESS)", true, (test_callback_fn*)memcached_fetch_execute_MEMCACHED_SUCCESS_TEST }, - {"memcached_fetch_execute(MEMCACHED_SUCCESS)", true, (test_callback_fn*)memcached_fetch_execute_MEMCACHED_NOTFOUND_TEST }, - { 0, 0, (test_callback_fn*)0 } -}; - diff --git a/tests/libmemcached-1.0/memcached_fetch_execute.h b/tests/libmemcached-1.0/memcached_fetch_execute.h deleted file mode 100644 index c4d3848c..00000000 --- a/tests/libmemcached-1.0/memcached_fetch_execute.h +++ /dev/null @@ -1,39 +0,0 @@ -/* 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. - * - */ - -#pragma once - -extern test_st *memcached_fetch_execute_TESTS; diff --git a/tests/libmemcached-1.0/memcached_get.cc b/tests/libmemcached-1.0/memcached_get.cc deleted file mode 100644 index 7a4650d9..00000000 --- a/tests/libmemcached-1.0/memcached_get.cc +++ /dev/null @@ -1,219 +0,0 @@ -/* 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 "mem_config.h" -#include "libtest/test.hpp" - -/* - Test cases -*/ - -#include "libmemcached-1.0/memcached.h" -#include "tests/libmemcached-1.0/memcached_get.h" -#include "tests/libmemcached-1.0/setup_and_teardowns.h" - -test_return_t get_test(memcached_st *memc) -{ - uint64_t query_id= memcached_query_id(memc); - memcached_return_t rc= memcached_delete(memc, - test_literal_param(__func__), - time_t(0)); - test_true(rc == MEMCACHED_BUFFERED or rc == MEMCACHED_NOTFOUND); - test_compare(query_id +1, memcached_query_id(memc)); - - size_t string_length; - uint32_t flags; - char *string= memcached_get(memc, - test_literal_param(__func__), - &string_length, &flags, &rc); - - test_compare(MEMCACHED_NOTFOUND, rc); - test_false(string_length); - test_false(string); - - return TEST_SUCCESS; -} - -test_return_t get_test2(memcached_st *memc) -{ - const char *value= "when we sanitize"; - - uint64_t query_id= memcached_query_id(memc); - test_compare(return_value_based_on_buffering(memc), - memcached_set(memc, - test_literal_param(__func__), - value, strlen(value), - time_t(0), uint32_t(0))); - test_compare(query_id +1, memcached_query_id(memc)); - - query_id= memcached_query_id(memc); - test_true(query_id); - - uint32_t flags; - size_t string_length; - memcached_return_t rc; - char *string= memcached_get(memc, - test_literal_param(__func__), - &string_length, &flags, &rc); - test_compare(query_id +1, memcached_query_id(memc)); - - test_compare(MEMCACHED_SUCCESS, rc); - test_compare(MEMCACHED_SUCCESS, memcached_last_error(memc)); - test_true(string); - test_compare(strlen(value), string_length); - test_memcmp(string, value, string_length); - - free(string); - - return TEST_SUCCESS; -} - -test_return_t get_test3(memcached_st *memc) -{ - size_t value_length= 8191; - - libtest::vchar_t value; - value.reserve(value_length); - for (uint32_t x= 0; x < value_length; x++) - { - value.push_back(char(x % 127)); - } - - test_compare(return_value_based_on_buffering(memc), - memcached_set(memc, - test_literal_param(__func__), - &value[0], value.size(), - time_t(0), uint32_t(0))); - - size_t string_length; - uint32_t flags; - memcached_return_t rc; - char *string= memcached_get(memc, - test_literal_param(__func__), - &string_length, &flags, &rc); - - test_compare(MEMCACHED_SUCCESS, rc); - test_true(string); - test_compare(value.size(), string_length); - test_memcmp(string, &value[0], string_length); - - free(string); - - return TEST_SUCCESS; -} - -test_return_t get_test4(memcached_st *memc) -{ - size_t value_length= 8191; - - libtest::vchar_t value; - value.reserve(value_length); - for (uint32_t x= 0; x < value_length; x++) - { - value.push_back(char(x % 127)); - } - - test_compare(return_value_based_on_buffering(memc), - memcached_set(memc, - test_literal_param(__func__), - &value[0], value.size(), - time_t(0), uint32_t(0))); - - for (uint32_t x= 0; x < 10; x++) - { - uint32_t flags; - size_t string_length; - memcached_return_t rc; - char *string= memcached_get(memc, - test_literal_param(__func__), - &string_length, &flags, &rc); - - test_compare(MEMCACHED_SUCCESS, rc); - test_true(string); - test_compare(value.size(), string_length); - test_memcmp(string, &value[0], string_length); - free(string); - } - - return TEST_SUCCESS; -} - -/* - * This test verifies that memcached_read_one_response doesn't try to - * dereference a NIL-pointer if you issue a multi-get and don't read out all - * responses before you execute a storage command. - */ -test_return_t get_test5(memcached_st *memc) -{ - /* - ** Request the same key twice, to ensure that we hash to the same server - ** (so that we have multiple response values queued up) ;-) - */ - const char *keys[]= { "key", "key" }; - size_t lengths[]= { 3, 3 }; - uint32_t flags; - size_t rlen; - - test_compare(return_value_based_on_buffering(memc), - memcached_set(memc, keys[0], lengths[0], - keys[0], lengths[0], - time_t(0), uint32_t(0))); - test_compare(MEMCACHED_SUCCESS, memcached_mget(memc, keys, lengths, test_array_length(keys))); - - memcached_result_st results_obj; - memcached_result_st *results= memcached_result_create(memc, &results_obj); - test_true(results); - - memcached_return_t rc; - results= memcached_fetch_result(memc, &results_obj, &rc); - test_true(results); - - memcached_result_free(&results_obj); - - /* Don't read out the second result, but issue a set instead.. */ - test_compare(MEMCACHED_SUCCESS, memcached_set(memc, keys[0], lengths[0], keys[0], lengths[0], 0, 0)); - - char *val= memcached_get_by_key(memc, keys[0], lengths[0], "yek", 3, - &rlen, &flags, &rc); - test_false(val); - test_compare(MEMCACHED_NOTFOUND, rc); - val= memcached_get(memc, keys[0], lengths[0], &rlen, &flags, &rc); - test_true(val); - test_compare(MEMCACHED_SUCCESS, rc); - free(val); - - return TEST_SUCCESS; -} diff --git a/tests/libmemcached-1.0/memcached_get.h b/tests/libmemcached-1.0/memcached_get.h deleted file mode 100644 index 46e8def3..00000000 --- a/tests/libmemcached-1.0/memcached_get.h +++ /dev/null @@ -1,44 +0,0 @@ -/* 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. - * - */ - -#pragma once - -test_return_t get_test(memcached_st*); -test_return_t get_test2(memcached_st*); -test_return_t get_test3(memcached_st*); -test_return_t get_test4(memcached_st*); -test_return_t get_test5(memcached_st*); - diff --git a/tests/libmemcached-1.0/plus.cpp b/tests/libmemcached-1.0/plus.cpp deleted file mode 100644 index 1077ae72..00000000 --- a/tests/libmemcached-1.0/plus.cpp +++ /dev/null @@ -1,342 +0,0 @@ -/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: - * - * Libmemcached library - * - * Copyright (C) 2011 Data Differential, http://datadifferential.com/ - * Copyright (C) 2006-2009 Brian Aker 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. - * - */ - -#include "mem_config.h" - -/* - C++ interface test -*/ -#include "libmemcached-1.0/memcached.hpp" -#include "libtest/test.hpp" - -#include -#include -#include -#include -#include -#include -#if HAVE_UNISTD_H -# include -#endif -#include - -#include -#include - -using namespace std; -using namespace memcache; -using namespace libtest; - -static void populate_vector(vector &vec, const string &str) -{ - vec.reserve(str.length()); - vec.assign(str.begin(), str.end()); -} - -static void copy_vec_to_string(vector &vec, string &str) -{ - str.clear(); - if (not vec.empty()) - { - str.assign(vec.begin(), vec.end()); - } -} - -static test_return_t basic_test(memcached_st *memc) -{ - Memcache foo(memc); - const string value_set("This is some data"); - std::vector value; - std::vector test_value; - - populate_vector(value, value_set); - - test_true(foo.set("mine", value, 0, 0)); - test_true(foo.get("mine", test_value)); - - test_compare(test_value.size(), value.size()); - test_memcmp(&test_value[0], &value[0], test_value.size()); - test_false(foo.set("", value, 0, 0)); - - return TEST_SUCCESS; -} - -static test_return_t increment_test(memcached_st *original) -{ - Memcache mcach(original); - const string key("blah"); - const string inc_value("1"); - std::vector inc_val; - vector ret_value; - string ret_string; - uint64_t int_inc_value; - uint64_t int_ret_value; - - populate_vector(inc_val, inc_value); - - test_true(mcach.set(key, inc_val, 0, 0)); - - test_true(mcach.get(key, ret_value)); - test_false(ret_value.empty()); - copy_vec_to_string(ret_value, ret_string); - - int_inc_value= uint64_t(atol(inc_value.c_str())); - int_ret_value= uint64_t(atol(ret_string.c_str())); - test_compare(int_inc_value, int_ret_value); - - test_true(mcach.increment(key, 1, &int_ret_value)); - test_compare(uint64_t(2), int_ret_value); - - test_true(mcach.increment(key, 1, &int_ret_value)); - test_compare(uint64_t(3), int_ret_value); - - test_true(mcach.increment(key, 5, &int_ret_value)); - test_compare(uint64_t(8), int_ret_value); - - return TEST_SUCCESS; -} - -static test_return_t basic_master_key_test(memcached_st *original) -{ - Memcache foo(original); - const string value_set("Data for server A"); - vector value; - vector test_value; - const string master_key_a("server-a"); - const string master_key_b("server-b"); - const string key("xyz"); - - populate_vector(value, value_set); - - test_true(foo.setByKey(master_key_a, key, value, 0, 0)); - test_true(foo.getByKey(master_key_a, key, test_value)); - - test_compare(value.size(), test_value.size()); - test_memcmp(&value[0], &test_value[0], value.size()); - - test_value.clear(); - -#if 0 - test_false(foo.getByKey(master_key_b, key, test_value)); - test_zero(test_value.size()); -#endif - - return TEST_SUCCESS; -} - -static test_return_t mget_test(memcached_st *original) -{ - Memcache memc(original); - memcached_return_t mc_rc; - vector keys; - vector< vector *> values; - keys.reserve(3); - keys.push_back("fudge"); - keys.push_back("son"); - keys.push_back("food"); - vector val1; - vector val2; - vector val3; - populate_vector(val1, "fudge"); - populate_vector(val2, "son"); - populate_vector(val3, "food"); - values.reserve(3); - values.push_back(&val1); - values.push_back(&val2); - values.push_back(&val3); - - string return_key; - vector return_value; - - /* We need to empty the server before we continue the test */ - bool flush_res= memc.flush(); - if (flush_res == false) - { - std::string error_string; - ASSERT_TRUE(memc.error(error_string)); - Error << error_string; - } - test_true(memc.flush()); - - test_true(memc.mget(keys)); - - test_compare(MEMCACHED_NOTFOUND, - memc.fetch(return_key, return_value)); - - test_true(memc.setAll(keys, values, 50, 9)); - - test_true(memc.mget(keys)); - size_t count= 0; - while (memcached_success(mc_rc= memc.fetch(return_key, return_value))) - { - test_compare(return_key.length(), return_value.size()); - test_memcmp(&return_value[0], return_key.c_str(), return_value.size()); - count++; - } - test_compare(values.size(), count); - - return TEST_SUCCESS; -} - -static test_return_t lp_1010899_TEST(void*) -{ - // Check to see everything is setup internally even when no initial hosts are - // given. - Memcache memc; - - test_false(memc.increment(__func__, 0, NULL)); - - return TEST_SUCCESS; -} - -static test_return_t lp_1010899_with_args_TEST(memcached_st *original) -{ - // Check to see everything is setup internally even when a host is specified - // on creation. - const memcached_instance_st* instance= memcached_server_instance_by_position(original, 0); - Memcache memc(memcached_server_name(instance), memcached_server_port(instance)); - - test_false(memc.increment(__func__, 0, NULL)); - test_true(memc.set(__func__, test_literal_param("12"), 0, 0)); - test_true(memc.increment(__func__, 3, NULL)); - - std::vector ret_val; - test_true(memc.get(__func__, ret_val)); - - test_strcmp(&ret_val[0], "15"); - - return TEST_SUCCESS; -} - -static test_return_t basic_behavior(memcached_st *original) -{ - Memcache memc(original); - test_true(memc.setBehavior(MEMCACHED_BEHAVIOR_VERIFY_KEY, true)); - test_compare(true, memc.getBehavior(MEMCACHED_BEHAVIOR_VERIFY_KEY)); - - return TEST_SUCCESS; -} - -static test_return_t error_test(memcached_st *) -{ - Memcache memc("--server=localhost:178"); - std::vector value; - - test_false(memc.set("key", value, time_t(0), uint32_t(0))); - - test_true(memc.error()); - - return TEST_SUCCESS; -} - -static test_return_t error_std_string_test(memcached_st *) -{ - Memcache memc("--server=localhost:178"); - std::vector value; - - test_false(memc.set("key", value, time_t(0), uint32_t(0))); - - std::string error_message; - test_true(memc.error(error_message)); - test_false(error_message.empty()); - - return TEST_SUCCESS; -} - -static test_return_t error_memcached_return_t_test(memcached_st *) -{ - Memcache memc("--server=localhost:178"); - std::vector value; - - test_false(memc.set("key", value, time_t(0), uint32_t(0))); - - memcached_return_t rc; - test_true(memc.error(rc)); - test_compare(MEMCACHED_CONNECTION_FAILURE, rc); - - return TEST_SUCCESS; -} - -test_st error_tests[] ={ - { "error()", false, reinterpret_cast(error_test) }, - { "error(std::string&)", false, reinterpret_cast(error_std_string_test) }, - { "error(memcached_return_t&)", false, reinterpret_cast(error_memcached_return_t_test) }, - {0, 0, 0} -}; - -test_st tests[] ={ - { "basic", false, - reinterpret_cast(basic_test) }, - { "basic_master_key", false, - reinterpret_cast(basic_master_key_test) }, - { "increment_test", false, - reinterpret_cast(increment_test) }, - { "mget", true, - reinterpret_cast(mget_test) }, - { "basic_behavior", false, - reinterpret_cast(basic_behavior) }, - {0, 0, 0} -}; - -test_st regression_TESTS[] ={ - { "lp:1010899 Memcache()", false, lp_1010899_TEST }, - { "lp:1010899 Memcache(localhost, port)", false, - reinterpret_cast(lp_1010899_with_args_TEST) }, - {0, 0, 0} -}; - -collection_st collection[] ={ - {"block", 0, 0, tests}, - {"error()", 0, 0, error_tests}, - {"regression", 0, 0, regression_TESTS}, - {0, 0, 0, 0} -}; - -#define SERVERS_TO_CREATE 5 - -#define TEST_PORT_BASE MEMCACHED_DEFAULT_PORT +10 -#include "tests/libmemcached_world.h" - -void get_world(libtest::Framework* world) -{ - world->collections(collection); - - world->create((test_callback_create_fn*)world_create); - world->destroy((test_callback_destroy_fn*)world_destroy); - - world->set_runner(new LibmemcachedRunner); -} diff --git a/tests/libmemcached-1.0/setup_and_teardowns.cc b/tests/libmemcached-1.0/setup_and_teardowns.cc deleted file mode 100644 index 9e69c7dd..00000000 --- a/tests/libmemcached-1.0/setup_and_teardowns.cc +++ /dev/null @@ -1,288 +0,0 @@ -/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: - * - * Libmemcached Client and Server - * - * Copyright (C) 2012 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. - * - */ - -#include "mem_config.h" -#include "libtest/test.hpp" - -#include "libmemcachedutil-1.0/util.h" - -#include "tests/print.h" -#include "tests/libmemcached-1.0/setup_and_teardowns.h" - -#include - -using namespace libtest; - -memcached_return_t return_value_based_on_buffering(memcached_st *memc) -{ - if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS)) - { - return MEMCACHED_BUFFERED; - } - - return MEMCACHED_SUCCESS; -} - -/** - @note This should be testing to see if the server really supports the binary protocol. -*/ -test_return_t pre_binary(memcached_st *memc) -{ - test_true(memcached_server_count(memc) > 0); - test_skip(true, libmemcached_util_version_check(memc, 1, 4, 4)); - test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, true)); - - return TEST_SUCCESS; -} - -test_return_t pre_buffer(memcached_st *memc) -{ - test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, true)); - - return TEST_SUCCESS; -} - -test_return_t pre_unix_socket(memcached_st *memc) -{ - struct stat buf; - - memcached_servers_reset(memc); - const char *socket_file= libtest::default_socket(); - test_skip(true, bool(socket_file)); - - test_skip(0, stat(socket_file, &buf)); - - test_compare(MEMCACHED_SUCCESS, - memcached_server_add_unix_socket_with_weight(memc, socket_file, 0)); - - return TEST_SUCCESS; -} - -test_return_t pre_nodelay(memcached_st *memc) -{ - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, 0); - - return TEST_SUCCESS; -} - -test_return_t pre_settimer(memcached_st *memc) -{ - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SND_TIMEOUT, 1000); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_RCV_TIMEOUT, 1000); - - return TEST_SUCCESS; -} - -test_return_t pre_murmur(memcached_st *memc) -{ - test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_MURMUR)); - return TEST_SUCCESS; -} - -test_return_t pre_jenkins(memcached_st *memc) -{ - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_JENKINS); - - return TEST_SKIPPED; -} - - -test_return_t pre_md5(memcached_st *memc) -{ - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_MD5); - - return TEST_SUCCESS; -} - -test_return_t pre_crc(memcached_st *memc) -{ - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_CRC); - - return TEST_SUCCESS; -} - -test_return_t pre_hsieh(memcached_st *memc) -{ - test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_HSIEH)); - return TEST_SUCCESS; -} - -test_return_t pre_hash_fnv1_64(memcached_st *memc) -{ - test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_MURMUR)); - - return TEST_SUCCESS; -} - -test_return_t pre_hash_fnv1a_64(memcached_st *memc) -{ - test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_FNV1A_64)); - - return TEST_SUCCESS; -} - -test_return_t pre_hash_fnv1_32(memcached_st *memc) -{ - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_FNV1_32); - - return TEST_SUCCESS; -} - -test_return_t pre_hash_fnv1a_32(memcached_st *memc) -{ - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_FNV1A_32); - - return TEST_SUCCESS; -} - -test_return_t memcached_servers_reset_SETUP(memcached_st *memc) -{ - memcached_servers_reset(memc); - test_compare(0U, memcached_server_count(memc)); - return TEST_SUCCESS; -} - -test_return_t memcached_servers_reset_CONTINUUM(memcached_st *memc) -{ - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, MEMCACHED_DISTRIBUTION_CONSISTENT); - memcached_servers_reset(memc); - test_zero(memc->ketama.continuum_count); - // If memc->ketama.continuum_count is non-zero at this point, any call to - // memcached_server_add will cause a segfault. - return TEST_SUCCESS; -} - -test_return_t memcached_servers_reset_MEMCACHED_DISTRIBUTION_CONSISTENT_SETUP(memcached_st *memc) -{ - test_compare(TEST_SUCCESS, memcached_servers_reset_SETUP(memc)); - - test_compare(MEMCACHED_SUCCESS, memcached_behavior_set_distribution(memc, MEMCACHED_DISTRIBUTION_CONSISTENT)); - test_compare(memcached_behavior_get_distribution(memc), MEMCACHED_DISTRIBUTION_CONSISTENT); - - return TEST_SUCCESS; -} - -test_return_t memcached_servers_reset_MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED_SETUP(memcached_st *memc) -{ - test_compare(TEST_SUCCESS, memcached_servers_reset_SETUP(memc)); - ASSERT_EQ(0U, memcached_server_count(0)); - - test_compare(MEMCACHED_SUCCESS, memcached_behavior_set_distribution(memc, MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED)); - test_compare(memcached_behavior_get_distribution(memc), MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED); - - return TEST_SUCCESS; -} - -test_return_t pre_behavior_ketama(memcached_st *memc) -{ - test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA, 1)); - - test_compare(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA), uint64_t(1)); - - return TEST_SUCCESS; -} - -test_return_t pre_behavior_ketama_weighted(memcached_st *memc) -{ - test_compare(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED, true), MEMCACHED_SUCCESS); - - test_compare(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED), uint64_t(1)); - - test_compare(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH, MEMCACHED_HASH_MD5), MEMCACHED_SUCCESS); - - test_compare(memcached_hash_t(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH)), MEMCACHED_HASH_MD5); - - return TEST_SUCCESS; -} - -test_return_t pre_replication(memcached_st *memc) -{ - test_skip(TEST_SUCCESS, pre_binary(memc)); - - /* - * Make sure that we store the item on all servers - * (master + replicas == number of servers) - */ - test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, memcached_server_count(memc) - 1)); - test_compare(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS), uint64_t(memcached_server_count(memc) - 1)); - - return TEST_SUCCESS; -} - - -test_return_t pre_replication_noblock(memcached_st *memc) -{ - test_skip(TEST_SUCCESS, pre_replication(memc)); - - return pre_nonblock(memc); -} - -test_return_t pre_nonblock(memcached_st *memc) -{ - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0); - - return TEST_SUCCESS; -} - -test_return_t pre_nonblock_binary(memcached_st *memc) -{ - memcached_st *memc_clone= memcached_clone(NULL, memc); - test_true(memc_clone); - - // The memcached_version needs to be done on a clone, because the server - // will not toggle protocol on an connection. - memcached_version(memc_clone); - - memcached_return_t rc= MEMCACHED_FAILURE; - if (libmemcached_util_version_check(memc_clone, 1, 4, 4)) - { - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0); - test_compare(MEMCACHED_SUCCESS, - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1)); - test_compare(uint64_t(1), memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL)); - } - else - { - memcached_free(memc_clone); - return TEST_SKIPPED; - } - - memcached_free(memc_clone); - - return rc == MEMCACHED_SUCCESS ? TEST_SUCCESS : TEST_SKIPPED; -} diff --git a/tests/libmemcached-1.0/setup_and_teardowns.h b/tests/libmemcached-1.0/setup_and_teardowns.h deleted file mode 100644 index 59b56f67..00000000 --- a/tests/libmemcached-1.0/setup_and_teardowns.h +++ /dev/null @@ -1,67 +0,0 @@ -/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: - * - * Libmemcached Client and Server - * - * Copyright (C) 2012 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 - -memcached_return_t return_value_based_on_buffering(memcached_st*); - -test_return_t pre_behavior_ketama(memcached_st*); -test_return_t pre_behavior_ketama_weighted(memcached_st*); -test_return_t pre_binary(memcached_st*); -test_return_t pre_cork(memcached_st*); -test_return_t pre_cork_and_nonblock(memcached_st*); -test_return_t pre_crc(memcached_st*); -test_return_t pre_hash_fnv1_32(memcached_st*); -test_return_t pre_hash_fnv1_64(memcached_st*); -test_return_t pre_hash_fnv1a_32(memcached_st*); -test_return_t pre_hash_fnv1a_64(memcached_st*); -test_return_t pre_hsieh(memcached_st*); -test_return_t pre_jenkins(memcached_st*); -test_return_t pre_md5(memcached_st*); -test_return_t pre_murmur(memcached_st*); -test_return_t pre_nodelay(memcached_st*); -test_return_t pre_nonblock(memcached_st*); -test_return_t pre_nonblock_binary(memcached_st*); -test_return_t pre_replication(memcached_st*); -test_return_t pre_replication_noblock(memcached_st*); -test_return_t pre_settimer(memcached_st*); -test_return_t pre_unix_socket(memcached_st*); -test_return_t pre_buffer(memcached_st*); -test_return_t memcached_servers_reset_MEMCACHED_DISTRIBUTION_CONSISTENT_SETUP(memcached_st *memc); -test_return_t memcached_servers_reset_MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED_SETUP(memcached_st *memc); -test_return_t memcached_servers_reset_SETUP(memcached_st *memc); -test_return_t memcached_servers_reset_CONTINUUM(memcached_st *memc); diff --git a/tests/libmemcached-1.0/string.cc b/tests/libmemcached-1.0/string.cc deleted file mode 100644 index 2151fa8b..00000000 --- a/tests/libmemcached-1.0/string.cc +++ /dev/null @@ -1,192 +0,0 @@ -/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: - * - * Libmemcached client and server library. - * - * 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. - * - */ - -// We let libmemcached/common.h define config since we are looking at -// library internals. - -#include "mem_config.h" - -#include "libmemcached-1.0/memcached.h" - -#include "libmemcached/string.hpp" -#include "libmemcached/is.h" - -#include "libtest/test.hpp" - -#include "tests/string.h" - -test_return_t string_static_null(void*) -{ - memcached_st *memc= memcached_create(NULL); - memcached_string_st string; - - memcached_string_st *string_ptr= memcached_string_create(memc, &string, 0); - test_true(string.options.is_initialized); - test_true(string_ptr); - - /* The following two better be the same! */ - test_false(memcached_is_allocated(string_ptr)); - test_false(memcached_is_allocated(&string)); - test_true(&string == string_ptr); - - test_true(string.options.is_initialized); - test_true(memcached_is_initialized(&string)); - memcached_string_free(&string); - test_false(memcached_is_initialized(&string)); - - memcached_free(memc); - - return TEST_SUCCESS; -} - -test_return_t string_alloc_null(void*) -{ - memcached_st *memc= memcached_create(NULL); - - memcached_string_st *string= memcached_string_create(memc, NULL, 0); - test_true(string); - test_true(memcached_is_allocated(string)); - test_true(memcached_is_initialized(string)); - memcached_string_free(string); - - memcached_free(memc); - - return TEST_SUCCESS; -} - -test_return_t string_alloc_with_size(void*) -{ - memcached_st *memc= memcached_create(NULL); - memcached_string_st *string= memcached_string_create(memc, NULL, 1024); - test_true(string); - test_true(memcached_is_allocated(string)); - test_true(memcached_is_initialized(string)); - memcached_string_free(string); - - memcached_free(memc); - - return TEST_SUCCESS; -} - -test_return_t string_alloc_with_size_toobig(void*) -{ - memcached_st *memc= memcached_create(NULL); - memcached_string_st *string= memcached_string_create(memc, NULL, SIZE_MAX); - test_zero(string); - memcached_free(memc); - - return TEST_SUCCESS; -} - -test_return_t string_alloc_append(void*) -{ - memcached_st *memc= memcached_create(NULL); - - char buffer[BUFSIZ]; - memcached_string_st *string; - - /* Ring the bell! */ - memset(buffer, 6, BUFSIZ); - - string= memcached_string_create(memc, NULL, 100); - test_true(string); - test_true(memcached_is_allocated(string)); - test_true(memcached_is_initialized(string)); - - for (unsigned int x= 0; x < 1024; x++) - { - memcached_return_t rc; - rc= memcached_string_append(string, buffer, BUFSIZ); - test_true(rc == MEMCACHED_SUCCESS); - } - test_true(memcached_is_allocated(string)); - memcached_string_free(string); - - memcached_free(memc); - - return TEST_SUCCESS; -} - -test_return_t string_alloc_append_toobig(void*) -{ - memcached_st *memc= memcached_create(NULL); - - memcached_return_t rc; - char buffer[BUFSIZ]; - memcached_string_st *string; - - /* Ring the bell! */ - memset(buffer, 6, sizeof(buffer)); - - string= memcached_string_create(memc, NULL, 100); - test_true(string); - test_true(memcached_is_allocated(string)); - test_true(memcached_is_initialized(string)); - - for (unsigned int x= 0; x < 1024; x++) - { - rc= memcached_string_append(string, buffer, BUFSIZ); - test_true(rc == MEMCACHED_SUCCESS); - } - rc= memcached_string_append(string, buffer, SIZE_MAX); - test_true(rc == MEMCACHED_MEMORY_ALLOCATION_FAILURE); - test_true(memcached_is_allocated(string)); - memcached_string_free(string); - - memcached_free(memc); - - return TEST_SUCCESS; -} - -test_return_t string_alloc_append_multiple(void*) -{ - memcached_st *memc= memcached_create(NULL); - - memcached_string_st *error_string= memcached_string_create(memc, NULL, 1024); - memcached_string_append(error_string, test_literal_param("Error occured while parsing: ")); - memcached_string_append(error_string, test_string_make_from_cstr("jog the strlen() method")); - memcached_string_append(error_string, test_literal_param(" (")); - - memcached_string_append(error_string, test_string_make_from_cstr(memcached_strerror(NULL, MEMCACHED_SUCCESS))); - memcached_string_append(error_string, test_literal_param(")")); - - memcached_string_free(error_string); - - memcached_free(memc); - - return TEST_SUCCESS; -} -- 2.30.2