From: Michael Wallner Date: Tue, 27 Oct 2020 14:46:25 +0000 (+0100) Subject: testing: attempt to speedup freebsd build X-Git-Tag: 1.1.0-beta1~157 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=21e20f73898b5f47e6cbd866beb95e95d6bf1215;p=m6w6%2Flibmemcached testing: attempt to speedup freebsd build --- diff --git a/.github/workflows/cmake-build-ci.gen b/.github/workflows/cmake-build-ci.gen index 2c2789bd..a26c8564 100755 --- a/.github/workflows/cmake-build-ci.gen +++ b/.github/workflows/cmake-build-ci.gen @@ -271,8 +271,12 @@ jobs: name: dbg-mac (, , ) runs-on: # env: - CFLAGS: -O0 --coverage + CFLAGS: -O0 --coverage CXXFLAGS: -O0 --coverage + OS_VND: macOS + OS_VER: # + CC_VND: # + CC_VER: # continue-on-error: true steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/cmake-build-ci.yml b/.github/workflows/cmake-build-ci.yml index 4a90f961..4c5681a7 100644 --- a/.github/workflows/cmake-build-ci.yml +++ b/.github/workflows/cmake-build-ci.yml @@ -195,8 +195,12 @@ jobs: name: dbg-mac (macos-10.15, clang, apple) runs-on: macos-10.15 # env: - CFLAGS: -O0 --coverage + CFLAGS: -O0 --coverage CXXFLAGS: -O0 --coverage + OS_VND: macOS + OS_VER: macos-10.15 # + CC_VND: clang # + CC_VER: apple # continue-on-error: true steps: - uses: actions/checkout@v2 diff --git a/test/lib/Cluster.cpp b/test/lib/Cluster.cpp index e32f0fc3..4fcdb47b 100644 --- a/test/lib/Cluster.cpp +++ b/test/lib/Cluster.cpp @@ -112,3 +112,9 @@ void Cluster::wait() { } } } + +bool Cluster::restart() { + stop(); + wait(); + return start(); +} diff --git a/test/lib/Cluster.hpp b/test/lib/Cluster.hpp index 199d2c74..c99e1d37 100644 --- a/test/lib/Cluster.hpp +++ b/test/lib/Cluster.hpp @@ -46,6 +46,7 @@ public: bool isStopped(); bool isListening(); void wait(); + bool restart(); private: size_t count; diff --git a/test/lib/ForkAndExec.cpp b/test/lib/ForkAndExec.cpp index ac30dd02..48a8dc18 100644 --- a/test/lib/ForkAndExec.cpp +++ b/test/lib/ForkAndExec.cpp @@ -107,7 +107,7 @@ void ForkAndExec::closePipe(int &fd) { } void ForkAndExec::pollExecReadyPipe() { -#if __APPLE__ +#if __APPLE__ || __FreeBSD__ char c, n = 50; do { if (0 == read(ready[mode::READ], &c, 1)) { diff --git a/test/lib/MemcachedCluster.cpp b/test/lib/MemcachedCluster.cpp index ca41a904..521ff12c 100644 --- a/test/lib/MemcachedCluster.cpp +++ b/test/lib/MemcachedCluster.cpp @@ -6,13 +6,8 @@ const memcached_st MemcachedCluster::empty_memc{}; void MemcachedCluster::init() { REQUIRE(cluster.start()); - Retry cluster_is_listening([this]() { - return cluster.isListening(); - }); - while (!cluster_is_listening()) { - cluster.stop(); - cluster.wait(); - cluster.start(); + while (!isListening()) { + cluster.restart(); } if (auto br = getenv_else("MEMCACHED_BREAK", "0")) { @@ -151,3 +146,7 @@ void MemcachedCluster::killOneServer() const { const auto &victim = servers[random_num(0UL, servers.size() - 1)]; ::kill(victim.getPid(), SIGKILL); } + +bool MemcachedCluster::isListening() { + return Retry{[this]() {return cluster.isListening();}}(); +} diff --git a/test/lib/MemcachedCluster.hpp b/test/lib/MemcachedCluster.hpp index dcda9ddd..b2a692cd 100644 --- a/test/lib/MemcachedCluster.hpp +++ b/test/lib/MemcachedCluster.hpp @@ -42,6 +42,7 @@ public: void enableBuffering(bool enable = true); void enableReplication(); void flush(); + bool isListening(); static MemcachedCluster mixed(); static MemcachedCluster network(); diff --git a/test/tests/memcached/errors.cpp b/test/tests/memcached/errors.cpp index 75ba019a..4b3b4684 100644 --- a/test/tests/memcached/errors.cpp +++ b/test/tests/memcached/errors.cpp @@ -41,10 +41,7 @@ TEST_CASE("memcached_errors") { REQUIRE_RC(MEMCACHED_SERVER_TEMPORARILY_DISABLED, memcached_set(memc, S("foo"), nullptr, 0, 0, 0)); REQUIRE(test.cluster.start()); - Retry cluster_is_listening{[&cluster = test.cluster] { - return cluster.isListening(); - }}; - REQUIRE(cluster_is_listening()); + REQUIRE(test.isListening()); Retry recovers{[memc]{ return MEMCACHED_SUCCESS == memcached_set(memc, S("foo"), nullptr, 0, 0, 0);