jobs:
# new memcached
- ci-new:
- name: ci-dbg (<?=defaults()?>, memcached-1.6)
+ dbg-new:
+ name: dbg-new (<?=defaults()?>)
runs-on: <?=DEF[DEF["os"]]?> #
env:
INSTALL_MEMCACHED:
<?php steps(); ?>
# sanitizer build
- ci-san:
- name: ci-dbg (<?=defaults()?>, sanitizers)
+ dbg-san:
+ name: dbg-san (<?=defaults()?>)
runs-on: <?=DEF[DEF["os"]]?> #
env:
ENABLE_SANITIZERS: "address;undefined"
<?php steps(); ?>
# coverage build
- ci-cov:
- name: ci-dbg (<?=defaults()?>, coverage)
+ dbg-cov:
+ name: dbg-cov (<?=defaults()?>)
runs-on: <?=DEF[DEF["os"]]?> #
env:
CFLAGS: -O0 --coverage
- uses: codecov/codecov-action@v1.0.13
# mac build
- ci-mac:
- name: ci-dbg (<?=DEF["macOS"]?>, <?=DEF[DEF["macOS"]]?>, <?=DEF[DEF[DEF["macOS"]]]["ver"]?>)
+ dbg-mac:
+ name: dbg-mac (<?=DEF["macOS"]?>, <?=DEF[DEF["macOS"]]?>, <?=DEF[DEF[DEF["macOS"]]]["ver"]?>)
runs-on: <?=DEF["macOS"]?> #
continue-on-error: true
steps:
<?php steps(false); ?>
# release builds
- ci-rel:
+ release:
strategy:
fail-fast: false
matrix:
jobs:
# new memcached
- ci-new:
- name: ci-dbg (ubuntu-20.04, gnu, cur, memcached-1.6)
+ dbg-new:
+ name: dbg-new (ubuntu-20.04, gnu, cur)
runs-on: ubuntu-20.04 #
env:
INSTALL_MEMCACHED:
run: cat build/Testing/Temporary/LastTest.log || true
# sanitizer build
- ci-san:
- name: ci-dbg (ubuntu-20.04, gnu, cur, sanitizers)
+ dbg-san:
+ name: dbg-san (ubuntu-20.04, gnu, cur)
runs-on: ubuntu-20.04 #
env:
ENABLE_SANITIZERS: "address;undefined"
run: cat build/Testing/Temporary/LastTest.log || true
# coverage build
- ci-cov:
- name: ci-dbg (ubuntu-20.04, gnu, cur, coverage)
+ dbg-cov:
+ name: dbg-cov (ubuntu-20.04, gnu, cur)
runs-on: ubuntu-20.04 #
env:
CFLAGS: -O0 --coverage
- uses: codecov/codecov-action@v1.0.13
# mac build
- ci-mac:
- name: ci-dbg (macos-10.15, clang, apple)
+ dbg-mac:
+ name: dbg-mac (macos-10.15, clang, apple)
runs-on: macos-10.15 #
continue-on-error: true
steps:
run: cat build/Testing/Temporary/LastTest.log || true
# release builds
- ci-rel:
+ release:
strategy:
fail-fast: false
matrix:
check_header(limits.h)
check_header(netdb.h)
check_header(poll.h)
-check_header(semaphore.h)
check_header(stddef.h)
check_header(stdlib.h)
check_header(strings.h)
ignore:
- "/usr"
+ - "example/"
+ - "test/"
coverage:
status:
default:
url: "https://webhooks.gitter.im/e/a6210fd7fb7b5105b2b0"
threshold: 1%
-
-
include(CMake/Catch.cmake)
+check_header(semaphore.h)
+
check_decl(pipe2 unistd.h)
check_decl(SOCK_NONBLOCK sys/socket.h)
check_decl(SOCK_CLOEXEC sys/socket.h)
#pragma once
+#cmakedefine HAVE_SEMAPHORE_H 1
#cmakedefine HAVE_PIPE2 1
#cmakedefine HAVE_SOCK_NONBLOCK 1
#cmakedefine HAVE_SOCK_CLOEXEC 1
}
stringstream &err() {
- return errors[errors.size()];
+ errors.resize(errors.size()+1);
+ return errors[errors.size()-1];
}
};
while (is_running()) {
memcached_return_t rc;
- timespec block{5, 0};
+ timespec block{0, 1000};
auto *mc = memcached_pool_fetch(ctx->pool, &block, &rc);
+ if (!mc && rc == MEMCACHED_TIMEOUT) {
+ continue;
+ }
if (!mc || memcached_failed(rc)) {
- ctx->err() << "failed to fetch connection from pool: "
- << memcached_strerror(nullptr, rc);
- this_thread::sleep_for(100ms);
+ cerr << "failed to fetch connection from pool: "
+ << memcached_strerror(nullptr, rc)
+ << endl;
+ this_thread::sleep_for(10ms);
+ continue;
}
auto rs = random_ascii_string(12);
rc = memcached_set(mc, rs.c_str(), rs.length(), rs.c_str(), rs.length(), 0, 0);
if (memcached_failed(rc)) {
- ctx->err() << "failed to memcached_set() "
- << memcached_last_error_message(mc);
+ cerr << "failed to memcached_set() "
+ << memcached_last_error_message(mc)
+ << endl;
}
rc = memcached_pool_release(ctx->pool, mc);
if (memcached_failed(rc)) {
- ctx->err() << "failed to release connection to pool: "
- << memcached_strerror(nullptr, rc);
+ cerr << "failed to release connection to pool: "
+ << memcached_strerror(nullptr, rc)
+ << endl;
}
}
REQUIRE_SUCCESS(rc);
REQUIRE(h);
REQUIRE(9999 == memcached_behavior_get(h, MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK));
+ REQUIRE_FALSE(9999 == memcached_behavior_get(h, MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK));
+ REQUIRE_SUCCESS(memcached_pool_release(pool, h));
+ }
+
+ REQUIRE_SUCCESS(memcached_pool_behavior_get(pool, MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK, &val));
+ REQUIRE_FALSE(val == 9999);
+ REQUIRE_SUCCESS(memcached_pool_behavior_set(pool, MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK, 9999));
+ REQUIRE_SUCCESS(memcached_pool_behavior_get(pool, MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK, &val));
+ REQUIRE(val == 9999);
+
+ for (auto &h : hold) {
+ h = memcached_pool_fetch(pool, nullptr, &rc);
+ REQUIRE_SUCCESS(rc);
+ REQUIRE(h);
+ REQUIRE(9999 == memcached_behavior_get(h, MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK));
}
}
if (memcached_success(rc)) {
break;
}
-cerr << "rc == " << memcached_strerror(nullptr, rc);
+
if (memcached_failed(rc)) {
REQUIRE_FALSE(pop_memc);
REQUIRE(rc != MEMCACHED_TIMEOUT); // As long as relative_time is zero, MEMCACHED_TIMEOUT is invalid
REQUIRE(MEMCACHED_SUCCESS == memcached_pool_release(pool, pop_memc));
REQUIRE(memcached_pool_destroy(pool) == *memc);
-#endif __APPLE__
+#endif // __APPLE__
}
#endif // HAVE_SEMAPHORE_H