From 9f262c9ea92d4869715ca6f534c80075a8310ac1 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 28 Sep 2020 17:26:50 +0200 Subject: [PATCH] testing: fix osx * move from testing/ to test/; CTest generates a Testing/ directory which creates ambiguities on case insensitive file systems * check for pipe2(), SOCK_CLOEXEC and SOCK_NONBLOCK * test for the O_CLOEXEC pipe already being closed by traing to read() it (see pipe(2)) --- CMakeLists.txt | 2 +- {testing => test}/CMake/Catch.cmake | 0 {testing => test}/CMake/CatchAddTests.cmake | 0 {testing => test}/CMakeLists.txt | 4 +++ {testing => test}/conf.h.in | 4 +++ {testing => test}/fixtures/hashes.hpp | 0 {testing => test}/lib/Cluster.cpp | 0 {testing => test}/lib/Cluster.hpp | 0 {testing => test}/lib/Connection.cpp | 22 ++++++++++++-- {testing => test}/lib/Connection.hpp | 2 +- {testing => test}/lib/ForkAndExec.cpp | 30 +++++++++++++++++++ {testing => test}/lib/ForkAndExec.hpp | 0 {testing => test}/lib/MemcachedCluster.cpp | 0 {testing => test}/lib/MemcachedCluster.hpp | 0 {testing => test}/lib/Retry.cpp | 0 {testing => test}/lib/Retry.hpp | 0 {testing => test}/lib/ReturnMatcher.cpp | 0 {testing => test}/lib/ReturnMatcher.hpp | 2 +- {testing => test}/lib/Server.cpp | 0 {testing => test}/lib/Server.hpp | 1 + {testing => test}/lib/Shell.cpp | 0 {testing => test}/lib/Shell.hpp | 2 +- {testing => test}/lib/catch.hpp | 0 .../lib/catch_reporter_teamcity.hpp | 0 {testing => test}/lib/common.cpp | 0 {testing => test}/lib/common.hpp | 6 ++-- {testing => test}/lib/random.cpp | 4 +-- {testing => test}/lib/random.hpp | 0 {testing => test}/main.cpp | 0 {testing => test}/tests/bin/memcat.cpp | 10 +++---- {testing => test}/tests/bin/memcp.cpp | 10 +++---- {testing => test}/tests/bin/memdump.cpp | 10 +++---- {testing => test}/tests/bin/memerror.cpp | 10 +++---- {testing => test}/tests/bin/memexist.cpp | 10 +++---- {testing => test}/tests/bin/memflush.cpp | 10 +++---- {testing => test}/tests/hashkit/basic.cpp | 4 +-- {testing => test}/tests/lib.cpp | 10 +++---- {testing => test}/tests/memcached/append.cpp | 4 +-- {testing => test}/tests/memcached/basic.cpp | 2 +- .../tests/memcached/callbacks.cpp | 4 +-- {testing => test}/tests/memcached/cas.cpp | 4 +-- {testing => test}/tests/memcached/dump.cpp | 4 +-- .../tests/memcached/encoding_key.cpp | 4 +-- {testing => test}/tests/memcached/exist.cpp | 4 +-- .../tests/memcached/generate_hash.cpp | 4 +-- .../tests/memcached/haldenbrand.cpp | 4 +-- {testing => test}/tests/memcached/inc_dec.cpp | 4 +-- {testing => test}/tests/memcached/ketama.cpp | 4 +-- .../tests/memcached/ketama_test_cases.h | 0 .../tests/memcached/ketama_test_cases_spy.h | 0 {testing => test}/tests/memcached/noreply.cpp | 4 +-- {testing => test}/tests/memcached/prepend.cpp | 4 +-- .../memcached/regression/binary_block_add.cpp | 4 +-- .../tests/memcached/regression/lp434484.cpp | 4 +-- .../tests/memcached/regression/lp434843.cpp | 6 ++-- .../tests/memcached/regression/lp442914.cpp | 4 +-- .../tests/memcached/regression/lp447342.cpp | 6 ++-- .../tests/memcached/regression/lp490486.cpp | 6 ++-- .../tests/memcached/regression/lp996813.cpp | 4 +-- {testing => test}/tests/memcached/sasl.cpp | 6 ++-- {testing => test}/tests/memcached/servers.cpp | 4 +-- {testing => test}/tests/memcached/simple.cpp | 4 +-- {testing => test}/tests/memcached/util.cpp | 4 +-- 63 files changed, 156 insertions(+), 99 deletions(-) rename {testing => test}/CMake/Catch.cmake (100%) rename {testing => test}/CMake/CatchAddTests.cmake (100%) rename {testing => test}/CMakeLists.txt (90%) rename {testing => test}/conf.h.in (60%) rename {testing => test}/fixtures/hashes.hpp (100%) rename {testing => test}/lib/Cluster.cpp (100%) rename {testing => test}/lib/Cluster.hpp (100%) rename {testing => test}/lib/Connection.cpp (85%) rename {testing => test}/lib/Connection.hpp (95%) rename {testing => test}/lib/ForkAndExec.cpp (75%) rename {testing => test}/lib/ForkAndExec.hpp (100%) rename {testing => test}/lib/MemcachedCluster.cpp (100%) rename {testing => test}/lib/MemcachedCluster.hpp (100%) rename {testing => test}/lib/Retry.cpp (100%) rename {testing => test}/lib/Retry.hpp (100%) rename {testing => test}/lib/ReturnMatcher.cpp (100%) rename {testing => test}/lib/ReturnMatcher.hpp (96%) rename {testing => test}/lib/Server.cpp (100%) rename {testing => test}/lib/Server.hpp (98%) rename {testing => test}/lib/Shell.cpp (100%) rename {testing => test}/lib/Shell.hpp (90%) rename {testing => test}/lib/catch.hpp (100%) rename {testing => test}/lib/catch_reporter_teamcity.hpp (100%) rename {testing => test}/lib/common.cpp (100%) rename {testing => test}/lib/common.hpp (96%) rename {testing => test}/lib/random.cpp (94%) rename {testing => test}/lib/random.hpp (100%) rename {testing => test}/main.cpp (100%) rename {testing => test}/tests/bin/memcat.cpp (89%) rename {testing => test}/tests/bin/memcp.cpp (91%) rename {testing => test}/tests/bin/memdump.cpp (91%) rename {testing => test}/tests/bin/memerror.cpp (85%) rename {testing => test}/tests/bin/memexist.cpp (89%) rename {testing => test}/tests/bin/memflush.cpp (91%) rename {testing => test}/tests/hashkit/basic.cpp (96%) rename {testing => test}/tests/lib.cpp (83%) rename {testing => test}/tests/memcached/append.cpp (95%) rename {testing => test}/tests/memcached/basic.cpp (96%) rename {testing => test}/tests/memcached/callbacks.cpp (98%) rename {testing => test}/tests/memcached/cas.cpp (94%) rename {testing => test}/tests/memcached/dump.cpp (93%) rename {testing => test}/tests/memcached/encoding_key.cpp (97%) rename {testing => test}/tests/memcached/exist.cpp (94%) rename {testing => test}/tests/memcached/generate_hash.cpp (95%) rename {testing => test}/tests/memcached/haldenbrand.cpp (97%) rename {testing => test}/tests/memcached/inc_dec.cpp (98%) rename {testing => test}/tests/memcached/ketama.cpp (99%) rename {testing => test}/tests/memcached/ketama_test_cases.h (100%) rename {testing => test}/tests/memcached/ketama_test_cases_spy.h (100%) rename {testing => test}/tests/memcached/noreply.cpp (96%) rename {testing => test}/tests/memcached/prepend.cpp (91%) rename {testing => test}/tests/memcached/regression/binary_block_add.cpp (87%) rename {testing => test}/tests/memcached/regression/lp434484.cpp (81%) rename {testing => test}/tests/memcached/regression/lp434843.cpp (91%) rename {testing => test}/tests/memcached/regression/lp442914.cpp (94%) rename {testing => test}/tests/memcached/regression/lp447342.cpp (95%) rename {testing => test}/tests/memcached/regression/lp490486.cpp (92%) rename {testing => test}/tests/memcached/regression/lp996813.cpp (94%) rename {testing => test}/tests/memcached/sasl.cpp (89%) rename {testing => test}/tests/memcached/servers.cpp (98%) rename {testing => test}/tests/memcached/simple.cpp (96%) rename {testing => test}/tests/memcached/util.cpp (97%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b76f688..83bdaa01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ if(NOT BUILD_DOCSONLY) add_subdirectory(include) add_subdirectory(src) add_subdirectory(support) - add_subdirectory(testing) + add_subdirectory(test) # keep last configure_file(src/mem_config.h.in ${AUTOHEADER_FILE} @ONLY) diff --git a/testing/CMake/Catch.cmake b/test/CMake/Catch.cmake similarity index 100% rename from testing/CMake/Catch.cmake rename to test/CMake/Catch.cmake diff --git a/testing/CMake/CatchAddTests.cmake b/test/CMake/CatchAddTests.cmake similarity index 100% rename from testing/CMake/CatchAddTests.cmake rename to test/CMake/CatchAddTests.cmake diff --git a/testing/CMakeLists.txt b/test/CMakeLists.txt similarity index 90% rename from testing/CMakeLists.txt rename to test/CMakeLists.txt index acb63695..dbc7aecb 100644 --- a/testing/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,6 +4,10 @@ endif() include(CMake/Catch.cmake) +check_decl(pipe2 unistd.h) +check_decl(SOCK_NONBLOCK sys/socket.h) +check_decl(SOCK_CLOEXEC sys/socket.h) + file(GLOB_RECURSE TESTING_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) set(TESTING_ROOT ${CMAKE_CURRENT_BINARY_DIR}) set_source_files_properties(main.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) diff --git a/testing/conf.h.in b/test/conf.h.in similarity index 60% rename from testing/conf.h.in rename to test/conf.h.in index 1059872a..91843964 100644 --- a/testing/conf.h.in +++ b/test/conf.h.in @@ -1,4 +1,8 @@ #pragma once +#cmakedefine HAVE_PIPE2 1 +#cmakedefine HAVE_SOCK_NONBLOCK 1 +#cmakedefine HAVE_SOCK_CLOEXEC 1 + #cmakedefine TESTING_ROOT "@TESTING_ROOT@" #cmakedefine MEMCACHED_BINARY getenv_else("MEMCACHED_BINARY", "@MEMCACHED_BINARY@") diff --git a/testing/fixtures/hashes.hpp b/test/fixtures/hashes.hpp similarity index 100% rename from testing/fixtures/hashes.hpp rename to test/fixtures/hashes.hpp diff --git a/testing/lib/Cluster.cpp b/test/lib/Cluster.cpp similarity index 100% rename from testing/lib/Cluster.cpp rename to test/lib/Cluster.cpp diff --git a/testing/lib/Cluster.hpp b/test/lib/Cluster.hpp similarity index 100% rename from testing/lib/Cluster.hpp rename to test/lib/Cluster.hpp diff --git a/testing/lib/Connection.cpp b/test/lib/Connection.cpp similarity index 85% rename from testing/lib/Connection.cpp rename to test/lib/Connection.cpp index 72c3b50e..05440723 100644 --- a/testing/lib/Connection.cpp +++ b/test/lib/Connection.cpp @@ -2,8 +2,26 @@ #include #include +#include #include +static inline int socket_ex(int af, int so, int pf, int fl) { +#if HAVE_SOCK_NONBLOCK && HAVE_SOCK_CLOEXEC + return socket(af, so | fl, pf); +#else +# define SOCK_NONBLOCK O_NONBLOCK +# define SOCK_CLOEXEC O_CLOEXEC + auto sock = socket(af, so, pf); + if (0 <= sock) { + if (0 > fcntl(sock, F_SETFL, fl | fcntl(sock, F_GETFL))) { + close(sock); + sock = -1; + } + } + return sock; +#endif +} + Connection::Connection(socket_or_port_t socket_or_port) { if (holds_alternative(socket_or_port)) { const auto path = get(socket_or_port); @@ -15,7 +33,7 @@ Connection::Connection(socket_or_port_t socket_or_port) { throw invalid_argument(error({"socket(): path too long '", path, "'"})); } - if (0 > (sock = socket(AF_UNIX, SOCK_STREAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0))) { + if (0 > (sock = socket_ex(AF_UNIX, SOCK_STREAM, 0, SOCK_NONBLOCK|SOCK_CLOEXEC))) { throw runtime_error(error({"socket(): ", strerror(errno)})); } @@ -26,7 +44,7 @@ Connection::Connection(socket_or_port_t socket_or_port) { size = UNIX; } else { - if (0 > (sock = socket(AF_INET6, SOCK_STREAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0))) { + if (0 > (sock = socket_ex(AF_INET6, SOCK_STREAM, 0, SOCK_NONBLOCK|SOCK_CLOEXEC))) { throw runtime_error(error({"socket(): ", strerror(errno)})); } diff --git a/testing/lib/Connection.hpp b/test/lib/Connection.hpp similarity index 95% rename from testing/lib/Connection.hpp rename to test/lib/Connection.hpp index 6a50a4f1..8571759e 100644 --- a/testing/lib/Connection.hpp +++ b/test/lib/Connection.hpp @@ -30,7 +30,7 @@ public: private: int sock{-1}, last_err{-1}; - sockaddr_storage addr{0, {0}, 0}; + sockaddr_storage addr{}; enum sockaddr_size { NONE = 0, UNIX = sizeof(sockaddr_un), diff --git a/testing/lib/ForkAndExec.cpp b/test/lib/ForkAndExec.cpp similarity index 75% rename from testing/lib/ForkAndExec.cpp rename to test/lib/ForkAndExec.cpp index 5274dba9..e182c7c4 100644 --- a/testing/lib/ForkAndExec.cpp +++ b/test/lib/ForkAndExec.cpp @@ -7,6 +7,26 @@ #include #include +#if !HAVE_PIPE2 +static inline int setfl(int fd, int newflags) { + auto oldflags = fcntl(fd, F_GETFL); + return fcntl(fd, F_SETFL, oldflags | newflags); +} +static inline int pipe2(int pipefd[2], int flags) { + int rc; + + rc = pipe(pipefd); + if (0 > rc) { + return rc; + } + rc = setfl(pipefd[0], flags); + if (0 > rc) { + return rc; + } + return setfl(pipefd[1], flags); +} +#endif + ForkAndExec::ForkAndExec(const char *binary_, char **argv_) : ready{-1, -1} , pipes{-1, -1} @@ -88,8 +108,18 @@ void ForkAndExec::closePipe(int &fd) { } void ForkAndExec::pollExecReadyPipe() { +#if __APPLE__ + char c, n = 50; + do { + if (0 == read(ready[mode::READ], &c, 1)) { + return; + } + this_thread::sleep_for(100ms); + } while (errno == EAGAIN && n--); +#else pollfd fd{ready[mode::READ], 0, 0}; if (1 > poll(&fd, 1, 5000)) { cerr << "exec() timed out" << endl; } +#endif } diff --git a/testing/lib/ForkAndExec.hpp b/test/lib/ForkAndExec.hpp similarity index 100% rename from testing/lib/ForkAndExec.hpp rename to test/lib/ForkAndExec.hpp diff --git a/testing/lib/MemcachedCluster.cpp b/test/lib/MemcachedCluster.cpp similarity index 100% rename from testing/lib/MemcachedCluster.cpp rename to test/lib/MemcachedCluster.cpp diff --git a/testing/lib/MemcachedCluster.hpp b/test/lib/MemcachedCluster.hpp similarity index 100% rename from testing/lib/MemcachedCluster.hpp rename to test/lib/MemcachedCluster.hpp diff --git a/testing/lib/Retry.cpp b/test/lib/Retry.cpp similarity index 100% rename from testing/lib/Retry.cpp rename to test/lib/Retry.cpp diff --git a/testing/lib/Retry.hpp b/test/lib/Retry.hpp similarity index 100% rename from testing/lib/Retry.hpp rename to test/lib/Retry.hpp diff --git a/testing/lib/ReturnMatcher.cpp b/test/lib/ReturnMatcher.cpp similarity index 100% rename from testing/lib/ReturnMatcher.cpp rename to test/lib/ReturnMatcher.cpp diff --git a/testing/lib/ReturnMatcher.hpp b/test/lib/ReturnMatcher.hpp similarity index 96% rename from testing/lib/ReturnMatcher.hpp rename to test/lib/ReturnMatcher.hpp index 286bc670..81c2d481 100644 --- a/testing/lib/ReturnMatcher.hpp +++ b/test/lib/ReturnMatcher.hpp @@ -1,6 +1,6 @@ #pragma once -#include "testing/lib/common.hpp" +#include "test/lib/common.hpp" class ReturnMatcher : public Catch::MatcherBase { public: diff --git a/testing/lib/Server.cpp b/test/lib/Server.cpp similarity index 100% rename from testing/lib/Server.cpp rename to test/lib/Server.cpp diff --git a/testing/lib/Server.hpp b/test/lib/Server.hpp similarity index 98% rename from testing/lib/Server.hpp rename to test/lib/Server.hpp index ac05eb13..44fd5e99 100644 --- a/testing/lib/Server.hpp +++ b/test/lib/Server.hpp @@ -3,6 +3,7 @@ #include "common.hpp" #include +#include class Server { public: diff --git a/testing/lib/Shell.cpp b/test/lib/Shell.cpp similarity index 100% rename from testing/lib/Shell.cpp rename to test/lib/Shell.cpp diff --git a/testing/lib/Shell.hpp b/test/lib/Shell.hpp similarity index 90% rename from testing/lib/Shell.hpp rename to test/lib/Shell.hpp index 03b60d72..d61f8ceb 100644 --- a/testing/lib/Shell.hpp +++ b/test/lib/Shell.hpp @@ -1,6 +1,6 @@ #pragma once -#include "testing/lib/common.hpp" +#include "test/lib/common.hpp" class Shell { public: diff --git a/testing/lib/catch.hpp b/test/lib/catch.hpp similarity index 100% rename from testing/lib/catch.hpp rename to test/lib/catch.hpp diff --git a/testing/lib/catch_reporter_teamcity.hpp b/test/lib/catch_reporter_teamcity.hpp similarity index 100% rename from testing/lib/catch_reporter_teamcity.hpp rename to test/lib/catch_reporter_teamcity.hpp diff --git a/testing/lib/common.cpp b/test/lib/common.cpp similarity index 100% rename from testing/lib/common.cpp rename to test/lib/common.cpp diff --git a/testing/lib/common.hpp b/test/lib/common.hpp similarity index 96% rename from testing/lib/common.hpp rename to test/lib/common.hpp index ee177003..0deb247b 100644 --- a/testing/lib/common.hpp +++ b/test/lib/common.hpp @@ -11,9 +11,9 @@ #include #include -#include "testing/conf.h" -#include "testing/lib/catch.hpp" -#include "testing/lib/random.hpp" +#include "test/conf.h" +#include "test/lib/catch.hpp" +#include "test/lib/random.hpp" #include "libmemcached/memcached.h" diff --git a/testing/lib/random.cpp b/test/lib/random.cpp similarity index 94% rename from testing/lib/random.cpp rename to test/lib/random.cpp index dbb30703..3681fcc8 100644 --- a/testing/lib/random.cpp +++ b/test/lib/random.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/random.hpp" -#include "testing/lib/Connection.hpp" +#include "test/lib/random.hpp" +#include "test/lib/Connection.hpp" #include // getpid() diff --git a/testing/lib/random.hpp b/test/lib/random.hpp similarity index 100% rename from testing/lib/random.hpp rename to test/lib/random.hpp diff --git a/testing/main.cpp b/test/main.cpp similarity index 100% rename from testing/main.cpp rename to test/main.cpp diff --git a/testing/tests/bin/memcat.cpp b/test/tests/bin/memcat.cpp similarity index 89% rename from testing/tests/bin/memcat.cpp rename to test/tests/bin/memcat.cpp index ab394eda..dfc5ddb9 100644 --- a/testing/tests/bin/memcat.cpp +++ b/test/tests/bin/memcat.cpp @@ -1,8 +1,8 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/Shell.hpp" -#include "testing/lib/Server.hpp" -#include "testing/lib/Retry.hpp" -#include "testing/lib/ReturnMatcher.hpp" +#include "test/lib/common.hpp" +#include "test/lib/Shell.hpp" +#include "test/lib/Server.hpp" +#include "test/lib/Retry.hpp" +#include "test/lib/ReturnMatcher.hpp" using Catch::Matchers::Contains; diff --git a/testing/tests/bin/memcp.cpp b/test/tests/bin/memcp.cpp similarity index 91% rename from testing/tests/bin/memcp.cpp rename to test/tests/bin/memcp.cpp index 2c715817..bbf796a6 100644 --- a/testing/tests/bin/memcp.cpp +++ b/test/tests/bin/memcp.cpp @@ -1,8 +1,8 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/Shell.hpp" -#include "testing/lib/Server.hpp" -#include "testing/lib/Retry.hpp" -#include "testing/lib/ReturnMatcher.hpp" +#include "test/lib/common.hpp" +#include "test/lib/Shell.hpp" +#include "test/lib/Server.hpp" +#include "test/lib/Retry.hpp" +#include "test/lib/ReturnMatcher.hpp" using Catch::Matchers::Contains; diff --git a/testing/tests/bin/memdump.cpp b/test/tests/bin/memdump.cpp similarity index 91% rename from testing/tests/bin/memdump.cpp rename to test/tests/bin/memdump.cpp index 0fa084d7..8e4d4537 100644 --- a/testing/tests/bin/memdump.cpp +++ b/test/tests/bin/memdump.cpp @@ -1,8 +1,8 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/Shell.hpp" -#include "testing/lib/Server.hpp" -#include "testing/lib/Retry.hpp" -#include "testing/lib/ReturnMatcher.hpp" +#include "test/lib/common.hpp" +#include "test/lib/Shell.hpp" +#include "test/lib/Server.hpp" +#include "test/lib/Retry.hpp" +#include "test/lib/ReturnMatcher.hpp" using Catch::Matchers::Contains; diff --git a/testing/tests/bin/memerror.cpp b/test/tests/bin/memerror.cpp similarity index 85% rename from testing/tests/bin/memerror.cpp rename to test/tests/bin/memerror.cpp index 690babe6..64637894 100644 --- a/testing/tests/bin/memerror.cpp +++ b/test/tests/bin/memerror.cpp @@ -1,8 +1,8 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/Shell.hpp" -#include "testing/lib/Server.hpp" -#include "testing/lib/Retry.hpp" -#include "testing/lib/ReturnMatcher.hpp" +#include "test/lib/common.hpp" +#include "test/lib/Shell.hpp" +#include "test/lib/Server.hpp" +#include "test/lib/Retry.hpp" +#include "test/lib/ReturnMatcher.hpp" using Catch::Matchers::Contains; diff --git a/testing/tests/bin/memexist.cpp b/test/tests/bin/memexist.cpp similarity index 89% rename from testing/tests/bin/memexist.cpp rename to test/tests/bin/memexist.cpp index 5be420bb..36d69c4f 100644 --- a/testing/tests/bin/memexist.cpp +++ b/test/tests/bin/memexist.cpp @@ -1,8 +1,8 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/Shell.hpp" -#include "testing/lib/Server.hpp" -#include "testing/lib/Retry.hpp" -#include "testing/lib/ReturnMatcher.hpp" +#include "test/lib/common.hpp" +#include "test/lib/Shell.hpp" +#include "test/lib/Server.hpp" +#include "test/lib/Retry.hpp" +#include "test/lib/ReturnMatcher.hpp" using Catch::Matchers::Contains; diff --git a/testing/tests/bin/memflush.cpp b/test/tests/bin/memflush.cpp similarity index 91% rename from testing/tests/bin/memflush.cpp rename to test/tests/bin/memflush.cpp index 7c2cc8c2..27083c24 100644 --- a/testing/tests/bin/memflush.cpp +++ b/test/tests/bin/memflush.cpp @@ -1,8 +1,8 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/Shell.hpp" -#include "testing/lib/Server.hpp" -#include "testing/lib/Retry.hpp" -#include "testing/lib/ReturnMatcher.hpp" +#include "test/lib/common.hpp" +#include "test/lib/Shell.hpp" +#include "test/lib/Server.hpp" +#include "test/lib/Retry.hpp" +#include "test/lib/ReturnMatcher.hpp" using Catch::Matchers::Contains; diff --git a/testing/tests/hashkit/basic.cpp b/test/tests/hashkit/basic.cpp similarity index 96% rename from testing/tests/hashkit/basic.cpp rename to test/tests/hashkit/basic.cpp index 9dcec525..3ba0fb68 100644 --- a/testing/tests/hashkit/basic.cpp +++ b/test/tests/hashkit/basic.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/fixtures/hashes.hpp" +#include "test/lib/common.hpp" +#include "test/fixtures/hashes.hpp" #include "libhashkit-1.0/hashkit.hpp" diff --git a/testing/tests/lib.cpp b/test/tests/lib.cpp similarity index 83% rename from testing/tests/lib.cpp rename to test/tests/lib.cpp index 6dd7269f..aac8f436 100644 --- a/testing/tests/lib.cpp +++ b/test/tests/lib.cpp @@ -1,10 +1,10 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/Cluster.hpp" -#include "testing/lib/Retry.hpp" -#include "testing/lib/Server.hpp" +#include "test/lib/common.hpp" +#include "test/lib/Cluster.hpp" +#include "test/lib/Retry.hpp" +#include "test/lib/Server.hpp" TEST_CASE("lib/Server") { - Server server{MEMCACHED_BINARY}; + Server server{MEMCACHED_BINARY, {Server::arg_t{"-v"}}}; SECTION("starts and listens") { diff --git a/testing/tests/memcached/append.cpp b/test/tests/memcached/append.cpp similarity index 95% rename from testing/tests/memcached/append.cpp rename to test/tests/memcached/append.cpp index c9051040..2b2449fd 100644 --- a/testing/tests/memcached/append.cpp +++ b/test/tests/memcached/append.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" DECLARE_STREQUAL; diff --git a/testing/tests/memcached/basic.cpp b/test/tests/memcached/basic.cpp similarity index 96% rename from testing/tests/memcached/basic.cpp rename to test/tests/memcached/basic.cpp index 3e538768..705a3d09 100644 --- a/testing/tests/memcached/basic.cpp +++ b/test/tests/memcached/basic.cpp @@ -1,4 +1,4 @@ -#include "testing/lib/common.hpp" +#include "test/lib/common.hpp" #include "libmemcached/is.h" diff --git a/testing/tests/memcached/callbacks.cpp b/test/tests/memcached/callbacks.cpp similarity index 98% rename from testing/tests/memcached/callbacks.cpp rename to test/tests/memcached/callbacks.cpp index a3728402..476842ff 100644 --- a/testing/tests/memcached/callbacks.cpp +++ b/test/tests/memcached/callbacks.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" static memcached_return_t delete_trigger(memcached_st *, const char *, size_t) { return MEMCACHED_SUCCESS; diff --git a/testing/tests/memcached/cas.cpp b/test/tests/memcached/cas.cpp similarity index 94% rename from testing/tests/memcached/cas.cpp rename to test/tests/memcached/cas.cpp index 4b2b9d29..7ac72ae1 100644 --- a/testing/tests/memcached/cas.cpp +++ b/test/tests/memcached/cas.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" TEST_CASE("memcached_cas") { pair tests[] = { diff --git a/testing/tests/memcached/dump.cpp b/test/tests/memcached/dump.cpp similarity index 93% rename from testing/tests/memcached/dump.cpp rename to test/tests/memcached/dump.cpp index 5112ae79..bb516ae9 100644 --- a/testing/tests/memcached/dump.cpp +++ b/test/tests/memcached/dump.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" memcached_return_t dump_cb(const memcached_st *, const char *, size_t, void *ctx) { auto *c = reinterpret_cast(ctx); diff --git a/testing/tests/memcached/encoding_key.cpp b/test/tests/memcached/encoding_key.cpp similarity index 97% rename from testing/tests/memcached/encoding_key.cpp rename to test/tests/memcached/encoding_key.cpp index 6edb04da..7dd091f3 100644 --- a/testing/tests/memcached/encoding_key.cpp +++ b/test/tests/memcached/encoding_key.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" #define TEST_KEY S("test") #define INITIAL_VAL S("initial") diff --git a/testing/tests/memcached/exist.cpp b/test/tests/memcached/exist.cpp similarity index 94% rename from testing/tests/memcached/exist.cpp rename to test/tests/memcached/exist.cpp index 9d0add59..7c89d7d0 100644 --- a/testing/tests/memcached/exist.cpp +++ b/test/tests/memcached/exist.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" TEST_CASE("memcached_exist") { pair tests[]{ diff --git a/testing/tests/memcached/generate_hash.cpp b/test/tests/memcached/generate_hash.cpp similarity index 95% rename from testing/tests/memcached/generate_hash.cpp rename to test/tests/memcached/generate_hash.cpp index 06a7800e..bbb637c1 100644 --- a/testing/tests/memcached/generate_hash.cpp +++ b/test/tests/memcached/generate_hash.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/fixtures/hashes.hpp" +#include "test/lib/common.hpp" +#include "test/fixtures/hashes.hpp" static constexpr const uint32_t md5_hosts[] = {4U, 1U, 0U, 1U, 4U, 2U, 0U, 3U, 0U, 0U, 3U, 1U, 0U, 0U, 1U, 3U, 0U, 0U, 0U, 3U, 1U, 0U, 4U, 4U, 3U}; static constexpr const uint32_t crc_hosts[] = {2U, 4U, 1U, 0U, 2U, 4U, 4U, 4U, 1U, 2U, 3U, 4U, 3U, 4U, 1U, 3U, 3U, 2U, 0U, 0U, 0U, 1U, 2U, 4U, 0U}; diff --git a/testing/tests/memcached/haldenbrand.cpp b/test/tests/memcached/haldenbrand.cpp similarity index 97% rename from testing/tests/memcached/haldenbrand.cpp rename to test/tests/memcached/haldenbrand.cpp index a640da68..c8b6ae6b 100644 --- a/testing/tests/memcached/haldenbrand.cpp +++ b/test/tests/memcached/haldenbrand.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" /* Test case provided by Cal Haldenbrand */ diff --git a/testing/tests/memcached/inc_dec.cpp b/test/tests/memcached/inc_dec.cpp similarity index 98% rename from testing/tests/memcached/inc_dec.cpp rename to test/tests/memcached/inc_dec.cpp index c007b16e..00f7435e 100644 --- a/testing/tests/memcached/inc_dec.cpp +++ b/test/tests/memcached/inc_dec.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" TEST_CASE("memcached_inc_dec") { pair tests[] = { diff --git a/testing/tests/memcached/ketama.cpp b/test/tests/memcached/ketama.cpp similarity index 99% rename from testing/tests/memcached/ketama.cpp rename to test/tests/memcached/ketama.cpp index 919c01bc..82f2c8c5 100644 --- a/testing/tests/memcached/ketama.cpp +++ b/test/tests/memcached/ketama.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" #include "ketama_test_cases.h" diff --git a/testing/tests/memcached/ketama_test_cases.h b/test/tests/memcached/ketama_test_cases.h similarity index 100% rename from testing/tests/memcached/ketama_test_cases.h rename to test/tests/memcached/ketama_test_cases.h diff --git a/testing/tests/memcached/ketama_test_cases_spy.h b/test/tests/memcached/ketama_test_cases_spy.h similarity index 100% rename from testing/tests/memcached/ketama_test_cases_spy.h rename to test/tests/memcached/ketama_test_cases_spy.h diff --git a/testing/tests/memcached/noreply.cpp b/test/tests/memcached/noreply.cpp similarity index 96% rename from testing/tests/memcached/noreply.cpp rename to test/tests/memcached/noreply.cpp index c17147bd..a68fcfd0 100644 --- a/testing/tests/memcached/noreply.cpp +++ b/test/tests/memcached/noreply.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" enum action_t {ADD, REPLACE, SET, APPEND, PREPEND}; inline action_t operator ++ (action_t &a) { diff --git a/testing/tests/memcached/prepend.cpp b/test/tests/memcached/prepend.cpp similarity index 91% rename from testing/tests/memcached/prepend.cpp rename to test/tests/memcached/prepend.cpp index 5e898b0a..533cd3be 100644 --- a/testing/tests/memcached/prepend.cpp +++ b/test/tests/memcached/prepend.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" TEST_CASE("memcached_prepend") { pair tests[] = { diff --git a/testing/tests/memcached/regression/binary_block_add.cpp b/test/tests/memcached/regression/binary_block_add.cpp similarity index 87% rename from testing/tests/memcached/regression/binary_block_add.cpp rename to test/tests/memcached/regression/binary_block_add.cpp index 376c7dfd..f976201a 100644 --- a/testing/tests/memcached/regression/binary_block_add.cpp +++ b/test/tests/memcached/regression/binary_block_add.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" TEST_CASE("memcached_regression_binary_block_add") { auto test = MemcachedCluster::network(); diff --git a/testing/tests/memcached/regression/lp434484.cpp b/test/tests/memcached/regression/lp434484.cpp similarity index 81% rename from testing/tests/memcached/regression/lp434484.cpp rename to test/tests/memcached/regression/lp434484.cpp index ce904129..48fd8405 100644 --- a/testing/tests/memcached/regression/lp434484.cpp +++ b/test/tests/memcached/regression/lp434484.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" TEST_CASE("memcached_regression_lp434484") { MemcachedCluster test; diff --git a/testing/tests/memcached/regression/lp434843.cpp b/test/tests/memcached/regression/lp434843.cpp similarity index 91% rename from testing/tests/memcached/regression/lp434843.cpp rename to test/tests/memcached/regression/lp434843.cpp index 1c1e95c1..dc839d53 100644 --- a/testing/tests/memcached/regression/lp434843.cpp +++ b/test/tests/memcached/regression/lp434843.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" static memcached_return_t callback_counter(const memcached_st *, memcached_result_st *, void *context) { auto *counter= reinterpret_cast(context); @@ -28,7 +28,7 @@ TEST_CASE("memcached_regression_lp434843") { array len; for (auto i = 0; i < NUM_KEYS; ++i) { - str[i] = random_ascii_string(36); + str[i] = random_ascii_string(12) + to_string(i); chr[i] = str[i].data(); len[i] = str[i].length(); } diff --git a/testing/tests/memcached/regression/lp442914.cpp b/test/tests/memcached/regression/lp442914.cpp similarity index 94% rename from testing/tests/memcached/regression/lp442914.cpp rename to test/tests/memcached/regression/lp442914.cpp index e833f318..a71449bc 100644 --- a/testing/tests/memcached/regression/lp442914.cpp +++ b/test/tests/memcached/regression/lp442914.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" #include diff --git a/testing/tests/memcached/regression/lp447342.cpp b/test/tests/memcached/regression/lp447342.cpp similarity index 95% rename from testing/tests/memcached/regression/lp447342.cpp rename to test/tests/memcached/regression/lp447342.cpp index 1ff33fe7..9e6c078d 100644 --- a/testing/tests/memcached/regression/lp447342.cpp +++ b/test/tests/memcached/regression/lp447342.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" #include "libmemcached/instance.hpp" @@ -23,7 +23,7 @@ TEST_CASE("memcached_regression_lp447342") { array len; for (auto i = 0U; i < NUM_KEYS; ++i) { - str[i] = random_ascii_string(random_num(24, 32)); + str[i] = random_ascii_string(random_num(12, 16)) + to_string(i); chr[i] = str[i].data(); len[i] = str[i].length(); REQUIRE_SUCCESS(memcached_set(memc, chr[i], len[i], chr[i], len[i], 0, 0)); diff --git a/testing/tests/memcached/regression/lp490486.cpp b/test/tests/memcached/regression/lp490486.cpp similarity index 92% rename from testing/tests/memcached/regression/lp490486.cpp rename to test/tests/memcached/regression/lp490486.cpp index cc7dd9aa..1731d2d0 100644 --- a/testing/tests/memcached/regression/lp490486.cpp +++ b/test/tests/memcached/regression/lp490486.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" #define NUM_KEYS 20480U @@ -27,7 +27,7 @@ TEST_CASE("memcached_regression_lp490486") { for (auto i = 0U; i < NUM_KEYS; ++i) { char blob[1024]; - str[i] = random_ascii_string(36); + str[i] = random_ascii_string(12) + to_string(i); chr[i] = str[i].data(); len[i] = str[i].length(); diff --git a/testing/tests/memcached/regression/lp996813.cpp b/test/tests/memcached/regression/lp996813.cpp similarity index 94% rename from testing/tests/memcached/regression/lp996813.cpp rename to test/tests/memcached/regression/lp996813.cpp index 540cb046..5a4b47da 100644 --- a/testing/tests/memcached/regression/lp996813.cpp +++ b/test/tests/memcached/regression/lp996813.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" TEST_CASE("memcached_regression_lp996813") { MemcachedPtr memc_ptr; diff --git a/testing/tests/memcached/sasl.cpp b/test/tests/memcached/sasl.cpp similarity index 89% rename from testing/tests/memcached/sasl.cpp rename to test/tests/memcached/sasl.cpp index cb5dbc9d..318a8f93 100644 --- a/testing/tests/memcached/sasl.cpp +++ b/test/tests/memcached/sasl.cpp @@ -1,6 +1,6 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/Shell.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/Shell.hpp" +#include "test/lib/MemcachedCluster.hpp" TEST_CASE("memcached_sasl") { #if !LIBMEMCACHED_WITH_SASL_SUPPORT diff --git a/testing/tests/memcached/servers.cpp b/test/tests/memcached/servers.cpp similarity index 98% rename from testing/tests/memcached/servers.cpp rename to test/tests/memcached/servers.cpp index 6beda33e..27a8aeaf 100644 --- a/testing/tests/memcached/servers.cpp +++ b/test/tests/memcached/servers.cpp @@ -1,6 +1,6 @@ -#include "testing/lib/common.hpp" +#include "test/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/MemcachedCluster.hpp" static memcached_return_t server_display_function(const memcached_st *, const memcached_instance_st * server, diff --git a/testing/tests/memcached/simple.cpp b/test/tests/memcached/simple.cpp similarity index 96% rename from testing/tests/memcached/simple.cpp rename to test/tests/memcached/simple.cpp index 28273d37..779084b6 100644 --- a/testing/tests/memcached/simple.cpp +++ b/test/tests/memcached/simple.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" TEST_CASE("memcached_simple") { pair tests[] = { diff --git a/testing/tests/memcached/util.cpp b/test/tests/memcached/util.cpp similarity index 97% rename from testing/tests/memcached/util.cpp rename to test/tests/memcached/util.cpp index 1ea61186..9612b1d0 100644 --- a/testing/tests/memcached/util.cpp +++ b/test/tests/memcached/util.cpp @@ -1,5 +1,5 @@ -#include "testing/lib/common.hpp" -#include "testing/lib/MemcachedCluster.hpp" +#include "test/lib/common.hpp" +#include "test/lib/MemcachedCluster.hpp" #include "libmemcached/instance.hpp" #include "libmemcachedutil/common.h" -- 2.30.2