Commit d0762100 authored by Yossi Gottlieb's avatar Yossi Gottlieb Committed by Oran Agra
Browse files

Fix failed tests on Linux Alpine and add a CI job. (#8532)

* Remove linux/version.h dependency.

This introduces unnecessary dependencies, and generally not a good idea
as the platform we build on may be different than the platform we run
on.

To determine if sync_file_range exists we can simply rely on header file
hints.

* Fix setproctitle() on libmusl.

The previous ifdef checks were a bit too strict for no apparent
reason.

* Fix tests failure on Linux with no backtrace.

* Add alpine daily CI job.

(cherry picked from commit 95ea7454)
parent 40ec7a27
......@@ -189,6 +189,7 @@ jobs:
test-alpine-jemalloc:
runs-on: ubuntu-latest
if: github.repository == 'redis/redis'
container: alpine:latest
steps:
- uses: actions/checkout@v2
......@@ -209,6 +210,7 @@ jobs:
test-alpine-libc-malloc:
runs-on: ubuntu-latest
if: github.repository == 'redis/redis'
container: alpine:latest
steps:
- uses: actions/checkout@v2
......
......@@ -35,7 +35,6 @@
#endif
#ifdef __linux__
#include <linux/version.h>
#include <features.h>
#endif
......@@ -99,19 +98,7 @@
/* Define rdb_fsync_range to sync_file_range() on Linux, otherwise we use
* the plain fsync() call. */
#ifdef __linux__
#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
#if (LINUX_VERSION_CODE >= 0x020611 && __GLIBC_PREREQ(2, 6))
#define HAVE_SYNC_FILE_RANGE 1
#endif
#else
#if (LINUX_VERSION_CODE >= 0x020611)
#define HAVE_SYNC_FILE_RANGE 1
#endif
#endif
#endif
#ifdef HAVE_SYNC_FILE_RANGE
#if (defined(__linux__) && defined(SYNC_FILE_RANGE_WAIT_BEFORE))
#define rdb_fsync_range(fd,off,size) sync_file_range(fd,off,size,SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE)
#else
#define rdb_fsync_range(fd,off,size) fsync(fd)
......@@ -128,7 +115,7 @@
#define ESOCKTNOSUPPORT 0
#endif
#if ((defined __linux && defined(__GLIBC__)) || defined __APPLE__)
#if (defined __linux || defined __APPLE__)
#define USE_SETPROCTITLE
#define INIT_SETPROCTITLE_REPLACEMENT
void spt_init(int argc, char *argv[]);
......
......@@ -58,4 +58,9 @@
#define _LARGEFILE_SOURCE
#define _FILE_OFFSET_BITS 64
#ifdef __linux__
/* features.h uses the defines above to set feature specific defines. */
#include <features.h>
#endif
#endif
......@@ -232,7 +232,7 @@ void spt_init(int argc, char *argv[]) {
if (!(SPT.arg0 = strdup(argv[0])))
goto syerr;
#if __GLIBC__
#if __linux__
if (!(tmp = strdup(program_invocation_name)))
goto syerr;
......
set server_path [tmpdir server.log]
set system_name [string tolower [exec uname -s]]
set system_supported 0
if {$system_name eq {linux} || $system_name eq {darwin}} {
# We only support darwin or Linux with glibc
if {$system_name eq {darwin}} {
set system_supported 1
} elseif {$system_name eq {linux}} {
# Avoid the test on libmusl, which does not support backtrace
set ldd [exec ldd src/redis-server]
if {![string match {*libc.musl*} $ldd]} {
set system_supported 1
}
}
if {$system_supported} {
set server_path [tmpdir server.log]
start_server [list overrides [list dir $server_path]] {
test "Server is able to generate a stack trace on selected systems" {
r config set watchdog-period 200
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment