Merge pull request #12617 from mbiebl/skip-test-bpf-containers

test-bpf: skip test when run inside containers
This commit is contained in:
Evgeny Vereshchagin 2019-05-29 23:11:01 +03:00 committed by GitHub
commit 0813a5efb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -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);

View file

@ -35,7 +35,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"