From: Michael Wallner Date: Mon, 14 Sep 2020 12:44:49 +0000 (+0200) Subject: testing: fix test case names for CTest X-Git-Tag: 1.1.0-beta1~236^2~70 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=8b0874e6ee4f0c7d4d6caf9bf13190cda0a415b5;p=awesomized%2Flibmemcached testing: fix test case names for CTest --- diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt index 9f2239a7..146e6231 100644 --- a/testing/CMakeLists.txt +++ b/testing/CMakeLists.txt @@ -4,5 +4,39 @@ set(TESTING_ROOT ${CMAKE_CURRENT_BINARY_DIR}) configure_file(conf.h.in conf.h @ONLY) add_executable(catch_main ${TESTING_SRC}) set_target_properties(catch_main PROPERTIES CXX_STANDARD 17) -target_link_libraries(catch_main libhashkit libmemcached libmemcachedutil) +target_include_directories(catch_main PRIVATE + ${CMAKE_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_BINARY_DIR}/src) +target_link_libraries(catch_main PRIVATE libhashkit libmemcached libmemcachedutil) add_dependencies(catch_main ${CLIENTS}) + +add_test("lib/Server" catch_main "lib/Server") +add_test("lib/Cluster" catch_main "lib/Cluster") + +add_test("hashkit" catch_main "hashkit") + +add_test("memcached_append" catch_main "memcached_append") +add_test("memcached_basic" catch_main "memcached_basic") +add_test("memcached_callbacks" catch_main "memcached_callbacks") +add_test("memcached_cas" catch_main "memcached_cas") +add_test("memcached_dump" catch_main "memcached_dump") +add_test("memcached_encoding_key" catch_main "memcached_encoding_key") +add_test("memcached_exist" catch_main "memcached_exist") +add_test("memcached_generate_hash" catch_main "memcached_generate_hash") +add_test("memcached_haldenbrand_nblock_tcp_ndelay" catch_main "memcached_haldenbrand_nblock_tcp_ndelay") +add_test("memcached_inc_dec" catch_main "memcached_inc_dec") +add_test("memcached_ketama_compat" catch_main "memcached_ketama_compat") +add_test("memcached_noreply" catch_main "memcached_noreply") +add_test("memcached_prepend" catch_main "memcached_prepend") +add_test("memcached_regression_binary_block_add" catch_main "memcached_regression_binary_block_add") +add_test("memcached_servers" catch_main "memcached_servers") +add_test("memcached_simple" catch_main "memcached_simple") +add_test("memcached_util" catch_main "memcached_util") + +add_test("memcat" catch_main "memcat") +add_test("memcp" catch_main "memcp") +add_test("memdump" catch_main "memdump") +add_test("memerror" catch_main "memerror") +add_test("memexist" catch_main "memexist") diff --git a/testing/tests/bin/memdump.cpp b/testing/tests/bin/memdump.cpp index fe302335..6b636bca 100644 --- a/testing/tests/bin/memdump.cpp +++ b/testing/tests/bin/memdump.cpp @@ -44,6 +44,8 @@ TEST_CASE("memdump") { REQUIRE_SUCCESS(memcached_set(*memc, S("key1"), S("val1"), 0, 0)); REQUIRE_SUCCESS(memcached_set(*memc, S("key2"), S("val2"), 0, 0)); + this_thread::sleep_for(500ms); + string output; REQUIRE(sh.run(comm, output)); REQUIRE_THAT(output, Contains("key1") && Contains("key2")); diff --git a/testing/tests/memcached/append.cpp b/testing/tests/memcached/append.cpp index 96244dfe..c9051040 100644 --- a/testing/tests/memcached/append.cpp +++ b/testing/tests/memcached/append.cpp @@ -3,7 +3,7 @@ DECLARE_STREQUAL; -TEST_CASE("memcached append") { +TEST_CASE("memcached_append") { pair tests[] = { {"bin_mixed", MemcachedCluster::mixed()}, {"mixed", MemcachedCluster::mixed()} diff --git a/testing/tests/memcached/basic.cpp b/testing/tests/memcached/basic.cpp index 687ee9e1..3e538768 100644 --- a/testing/tests/memcached/basic.cpp +++ b/testing/tests/memcached/basic.cpp @@ -2,7 +2,7 @@ #include "libmemcached/is.h" -TEST_CASE("memcached basic") { +TEST_CASE("memcached_basic") { SECTION("library") { REQUIRE(string(LIBMEMCACHED_VERSION_STRING) == memcached_lib_version()); } diff --git a/testing/tests/memcached/callbacks.cpp b/testing/tests/memcached/callbacks.cpp index cfa1f4f6..a3728402 100644 --- a/testing/tests/memcached/callbacks.cpp +++ b/testing/tests/memcached/callbacks.cpp @@ -17,7 +17,7 @@ static memcached_return_t cleanup_callback(memcached_st *) { return MEMCACHED_SUCCESS; } -TEST_CASE("memcached callbacks") { +TEST_CASE("memcached_callbacks") { auto test{MemcachedCluster::mixed()}; auto memc = &test.memc; memcached_return_t rc; diff --git a/testing/tests/memcached/cas.cpp b/testing/tests/memcached/cas.cpp index 7335878e..4b2b9d29 100644 --- a/testing/tests/memcached/cas.cpp +++ b/testing/tests/memcached/cas.cpp @@ -1,7 +1,7 @@ #include "testing/lib/common.hpp" #include "testing/lib/MemcachedCluster.hpp" -TEST_CASE("memcached cas") { +TEST_CASE("memcached_cas") { pair tests[] = { {"network", MemcachedCluster::network()}, {"socket", MemcachedCluster::socket()} diff --git a/testing/tests/memcached/dump.cpp b/testing/tests/memcached/dump.cpp index 9956b22e..5112ae79 100644 --- a/testing/tests/memcached/dump.cpp +++ b/testing/tests/memcached/dump.cpp @@ -7,7 +7,7 @@ memcached_return_t dump_cb(const memcached_st *, const char *, size_t, void *ctx return MEMCACHED_SUCCESS; } -TEST_CASE("memcached dump") { +TEST_CASE("memcached_dump") { pair tests[]{ {"mixed", MemcachedCluster::mixed()}, {"network", MemcachedCluster::network()}, diff --git a/testing/tests/memcached/encoding_key.cpp b/testing/tests/memcached/encoding_key.cpp index c4616ce4..6edb04da 100644 --- a/testing/tests/memcached/encoding_key.cpp +++ b/testing/tests/memcached/encoding_key.cpp @@ -19,7 +19,7 @@ static inline void check(memcached_st *enc, memcached_st *raw, const char *val, REQUIRE_FALSE(memcmp(val, *enc_value, enc_length)); } -TEST_CASE("memcached encoding_key") { +TEST_CASE("memcached_encoding_key") { pair tests[]{ {"network", MemcachedCluster::network()}, {"socket", MemcachedCluster::socket()} diff --git a/testing/tests/memcached/exist.cpp b/testing/tests/memcached/exist.cpp index a0eeede4..9d0add59 100644 --- a/testing/tests/memcached/exist.cpp +++ b/testing/tests/memcached/exist.cpp @@ -1,7 +1,7 @@ #include "testing/lib/common.hpp" #include "testing/lib/MemcachedCluster.hpp" -TEST_CASE("memcached exist") { +TEST_CASE("memcached_exist") { pair tests[]{ {"bin_mixed", MemcachedCluster::mixed()}, {"network", MemcachedCluster::network()}, diff --git a/testing/tests/memcached/generate_hash.cpp b/testing/tests/memcached/generate_hash.cpp index 30e02e12..06a7800e 100644 --- a/testing/tests/memcached/generate_hash.cpp +++ b/testing/tests/memcached/generate_hash.cpp @@ -5,7 +5,7 @@ static constexpr const uint32_t md5_hosts[] = {4U, 1U, 0U, 1U, 4U, 2U, 0U, 3U, 0 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}; static constexpr const uint32_t *hosts[] = {nullptr, md5_hosts, crc_hosts}; -TEST_CASE("memcached generate_hash") { +TEST_CASE("memcached_generate_hash") { MemcachedPtr memc(memcached(S("--server=localhost:1 --server=localhost:2 --server=localhost:3 --server=localhost:4 --server=localhost5 --DISTRIBUTION=modula"))); REQUIRE(*memc); diff --git a/testing/tests/memcached/haldenbrand.cpp b/testing/tests/memcached/haldenbrand.cpp index 8dedcdf1..a640da68 100644 --- a/testing/tests/memcached/haldenbrand.cpp +++ b/testing/tests/memcached/haldenbrand.cpp @@ -8,7 +8,7 @@ #include -TEST_CASE("memcached haldenbrand nblock_tcp_ndelay") { +TEST_CASE("memcached_haldenbrand_nblock_tcp_ndelay") { pair tests[] = { {"network", MemcachedCluster::network()}, }; diff --git a/testing/tests/memcached/inc_dec.cpp b/testing/tests/memcached/inc_dec.cpp index dff068b6..c007b16e 100644 --- a/testing/tests/memcached/inc_dec.cpp +++ b/testing/tests/memcached/inc_dec.cpp @@ -1,7 +1,7 @@ #include "testing/lib/common.hpp" #include "testing/lib/MemcachedCluster.hpp" -TEST_CASE("memcached inc_dec") { +TEST_CASE("memcached_inc_dec") { pair tests[] = { {"mixed", MemcachedCluster::mixed()}, }; diff --git a/testing/tests/memcached/ketama.cpp b/testing/tests/memcached/ketama.cpp index 2a5a9693..919c01bc 100644 --- a/testing/tests/memcached/ketama.cpp +++ b/testing/tests/memcached/ketama.cpp @@ -8,7 +8,7 @@ DECLARE_STREQUAL; -TEST_CASE("memcached ketama_compat") { +TEST_CASE("memcached_ketama_compat") { auto test = MemcachedCluster::network(); auto memc = &test.memc; diff --git a/testing/tests/memcached/noreply.cpp b/testing/tests/memcached/noreply.cpp index ec324587..c17147bd 100644 --- a/testing/tests/memcached/noreply.cpp +++ b/testing/tests/memcached/noreply.cpp @@ -8,7 +8,7 @@ inline action_t operator ++ (action_t &a) { constexpr static const int keys = 5000; -TEST_CASE("memcached noreply") { +TEST_CASE("memcached_noreply") { auto test{MemcachedCluster::mixed()}; auto memc = &test.memc; diff --git a/testing/tests/memcached/prepend.cpp b/testing/tests/memcached/prepend.cpp index 323cd752..5e898b0a 100644 --- a/testing/tests/memcached/prepend.cpp +++ b/testing/tests/memcached/prepend.cpp @@ -1,7 +1,7 @@ #include "testing/lib/common.hpp" #include "testing/lib/MemcachedCluster.hpp" -TEST_CASE("memcached prepend") { +TEST_CASE("memcached_prepend") { pair tests[] = { {"network", MemcachedCluster::network()}, {"socket", MemcachedCluster::socket()} diff --git a/testing/tests/memcached/regression/binary_block_add.cpp b/testing/tests/memcached/regression/binary_block_add.cpp index 6c99223a..376c7dfd 100644 --- a/testing/tests/memcached/regression/binary_block_add.cpp +++ b/testing/tests/memcached/regression/binary_block_add.cpp @@ -1,7 +1,7 @@ #include "testing/lib/common.hpp" #include "testing/lib/MemcachedCluster.hpp" -TEST_CASE("memcached regression binary_block_add") { +TEST_CASE("memcached_regression_binary_block_add") { auto test = MemcachedCluster::network(); auto memc = &test.memc; auto blob = random_ascii_string(1024); diff --git a/testing/tests/memcached/servers.cpp b/testing/tests/memcached/servers.cpp index 1c3d699c..6beda33e 100644 --- a/testing/tests/memcached/servers.cpp +++ b/testing/tests/memcached/servers.cpp @@ -14,7 +14,7 @@ static memcached_return_t server_display_function(const memcached_st *, return MEMCACHED_SUCCESS; } -TEST_CASE("memcached servers") { +TEST_CASE("memcached_servers") { SECTION("memcached_servers_parse") { SECTION("does not leak memory") { memcached_server_st *s = memcached_servers_parse("1.2.3.4:1234"); diff --git a/testing/tests/memcached/simple.cpp b/testing/tests/memcached/simple.cpp index 7d6f9af4..28273d37 100644 --- a/testing/tests/memcached/simple.cpp +++ b/testing/tests/memcached/simple.cpp @@ -1,7 +1,7 @@ #include "testing/lib/common.hpp" #include "testing/lib/MemcachedCluster.hpp" -TEST_CASE("memcached simple") { +TEST_CASE("memcached_simple") { pair tests[] = { {"network", MemcachedCluster::network()}, {"socket", MemcachedCluster::socket()} diff --git a/testing/tests/memcached/util.cpp b/testing/tests/memcached/util.cpp index 11f2a460..1ea61186 100644 --- a/testing/tests/memcached/util.cpp +++ b/testing/tests/memcached/util.cpp @@ -12,7 +12,7 @@ static memcached_return_t ping_callback(const memcached_st *, const memcached_in return MEMCACHED_SUCCESS; } -TEST_CASE("memcached util") { +TEST_CASE("memcached_util") { SECTION("version_check") { auto test = MemcachedCluster::mixed(); auto memc = &test.memc; @@ -63,4 +63,14 @@ TEST_CASE("memcached util") { REQUIRE_SUCCESS(memcached_server_cursor(memc, fptr, nullptr, 1)); } + + SECTION("flush") { + auto test = MemcachedCluster::network(); + + for (auto &server : test.cluster.getServers()) { + memcached_return_t rc; + REQUIRE(libmemcached_util_flush("localhost", get(server.getSocketOrPort()), &rc)); + REQUIRE_SUCCESS(rc); + } + } }