From: Luca Boccassi Date: Sat, 25 Sep 2021 14:40:39 +0000 (+0100) Subject: CI: run unit tests in a network namespace X-Git-Tag: v250-rc1~611^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b036b223a40fac9e53189db05d3798ec11eb475;p=thirdparty%2Fsystemd.git CI: run unit tests in a network namespace It seems some of the tests break network connectivity on the host, as the code coverage upload fails to establish a connection. Run them in a network namespace with 'unshare -n'. --- diff --git a/.github/workflows/unit_tests.sh b/.github/workflows/unit_tests.sh index e85c3210018..f661d45c99b 100755 --- a/.github/workflows/unit_tests.sh +++ b/.github/workflows/unit_tests.sh @@ -6,6 +6,7 @@ ADDITIONAL_DEPS=( clang expect fdisk + iproute2 jekyll libfdisk-dev libfido2-dev @@ -18,6 +19,7 @@ ADDITIONAL_DEPS=( perl python3-libevdev python3-pyparsing + util-linux zstd ) @@ -45,7 +47,8 @@ for phase in "${PHASES[@]}"; do fi meson --werror -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true -Dman=true build ninja -C build -v - meson test -C build --print-errorlogs + # Some of the unsafe tests irreparably break the host's network connectivity, so run them in a namespace + unshare -n bash -c 'ip link set dev lo up; meson test -C build --print-errorlogs' ;; RUN_ASAN_UBSAN|RUN_GCC_ASAN_UBSAN|RUN_CLANG_ASAN_UBSAN) MESON_ARGS=(--optimization=1) @@ -74,7 +77,7 @@ for phase in "${PHASES[@]}"; do # during debugging, wonderful), so let's at least keep a workaround # here to make the builds stable for the time being. (set +x; while :; do echo -ne "\n[WATCHDOG] $(date)\n"; sleep 30; done) & - meson test --timeout-multiplier=3 -C build --print-errorlogs + unshare -n bash -c 'ip link set dev lo up; meson test --timeout-multiplier=3 -C build --print-errorlogs' ;; CLEANUP) info "Cleanup phase"