test-bpf: skip test when run inside containers
authorMichael Biebl <biebl@debian.org>
Sun, 19 May 2019 18:57:07 +0000 (20:57 +0200)
committerMichael Biebl <biebl@debian.org>
Fri, 29 Jan 2021 14:16:06 +0000 (14:16 +0000)
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

(cherry picked from commit 98a3c188a1511caae422b2c891f3cc016824eb81)

Gbp-Pq: Name test-bpf-skip-test-when-run-inside-containers.patch

src/test/test-bpf.c

index cd8d68f215b2074b702784da880e231dab5c9a8a..eb1d8d713e69771579a89d1a81c232b6e0a268e3 100644 (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);