From 98a3c188a1511caae422b2c891f3cc016824eb81 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Sun, 19 May 2019 20:57:07 +0200 Subject: [PATCH 1/2] test-bpf: skip test when run inside containers The test reliably fails inside LXC and Docker when run on a new enough kernel. It's unclear whether this is a kernel, LXC/Docker or systemd issue and apparently there is no real interest to get this fixed, so let's skip this test. As this also covers Travis CI, there is no need for this additional check anymore. See https://github.com/systemd/systemd/issues/9666 --- src/test/test-bpf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/test-bpf.c b/src/test/test-bpf.c index b09e8c714c..f4d0c731f1 100644 --- a/src/test/test-bpf.c +++ b/src/test/test-bpf.c @@ -14,6 +14,7 @@ #include "test-helper.h" #include "tests.h" #include "unit.h" +#include "virt.h" /* We use the same limit here that PID 1 bumps RLIMIT_MEMLOCK to if it can */ #define CAN_MEMLOCK_SIZE (64U*1024U*1024U) @@ -56,8 +57,8 @@ int main(int argc, char *argv[]) { test_setup_logging(LOG_DEBUG); - if (is_run_on_travis_ci()) - return log_tests_skipped("test-bpf fails on Travis CI: https://github.com/systemd/systemd/issues/9666"); + if (detect_container()) + return log_tests_skipped("test-bpf fails inside LXC and Docker containers: https://github.com/systemd/systemd/issues/9666"); assert_se(getrlimit(RLIMIT_MEMLOCK, &rl) >= 0); rl.rlim_cur = rl.rlim_max = MAX3(rl.rlim_cur, rl.rlim_max, CAN_MEMLOCK_SIZE); From 75acb946cc97f3434714391ccd4fc0674e05ab0f Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sun, 19 May 2019 23:26:35 +0200 Subject: [PATCH 2/2] travis: set the `container` env variable explicitly As we build a custom Docker image, we need to ensure that systemd correctly detects it's running in a container. One can simply do this directly in a Dockerfile (ENV container docker) or when starting the container (-e container=docker). For the sake of readability, let's pick the latter approach here. --- travis-ci/managers/debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis-ci/managers/debian.sh b/travis-ci/managers/debian.sh index 72ffcee439..43cbea20f4 100755 --- a/travis-ci/managers/debian.sh +++ b/travis-ci/managers/debian.sh @@ -32,7 +32,7 @@ for phase in "${PHASES[@]}"; do info "Using Debian $DEBIAN_RELEASE" printf "FROM debian:$DEBIAN_RELEASE\nRUN bash -c 'apt-get -y update && apt-get install -y systemd'\n" | docker build -t debian-with-systemd/latest - info "Starting container $CONT_NAME" - $DOCKER_RUN -v $REPO_ROOT:/build:rw \ + $DOCKER_RUN -v $REPO_ROOT:/build:rw -e container=docker \ -w /build --privileged=true --name $CONT_NAME \ -dit --net=host debian-with-systemd/latest /bin/systemd $DOCKER_EXEC bash -c "echo deb-src http://deb.debian.org/debian $DEBIAN_RELEASE main >>/etc/apt/sources.list"