From 38a4eb4ebc730d805fcab9d64fe988be42a99122 Mon Sep 17 00:00:00 2001 From: Kirill Isakov Date: Thu, 2 Jun 2022 12:30:48 +0600 Subject: [PATCH] CI: run sanitizers as root The most interesting tests that actually exercise network require root access for setup. --- .ci/deps.sh | 3 ++- .ci/sanitizers/run.sh | 2 +- .ci/test/run.sh | 4 +++- .github/workflows/test.yml | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.ci/deps.sh b/.ci/deps.sh index e297fb13..17b49bbc 100755 --- a/.ci/deps.sh +++ b/.ci/deps.sh @@ -44,6 +44,7 @@ deps_linux_debian_linux() { libminiupnpc-dev:"$HOST" \ libvdeplug-dev:"$HOST" \ libcmocka-dev:"$HOST" \ + libsystemd-dev:"$HOST" \ "$@" if [ -n "$HOST" ]; then @@ -99,7 +100,7 @@ deps_linux_rhel() { yum install -y \ git binutils make ninja-build pkgconf gcc sudo texinfo-tex systemd perl-IPC-Cmd \ - lzo-devel zlib-devel lz4-devel ncurses-devel readline-devel libgcrypt-devel "$@" + lzo-devel zlib-devel lz4-devel ncurses-devel readline-devel libgcrypt-devel systemd-devel "$@" if [ -z "$SKIP_MESON" ]; then yum install -y meson diff --git a/.ci/sanitizers/run.sh b/.ci/sanitizers/run.sh index 3144275a..8bf409f3 100755 --- a/.ci/sanitizers/run.sh +++ b/.ci/sanitizers/run.sh @@ -33,7 +33,7 @@ export CC='clang-12' export CPPFLAGS='-DDEBUG' export CFLAGS="-O0 -g -fsanitize=$SANITIZER -fno-omit-frame-pointer -fno-common -fsanitize-blacklist=$dir/ignore.txt $flags" -bash .ci/test/run.sh "$@" +sudo bash .ci/test/run.sh "$@" # Check that the sanitizer has not created any log files. # If it has, fail the job to notify the developer. diff --git a/.ci/test/run.sh b/.ci/test/run.sh index 89a5d370..952fffd7 100644 --- a/.ci/test/run.sh +++ b/.ci/test/run.sh @@ -24,7 +24,9 @@ run_tests() { sudo pkill -KILL -x "$name" || true done - sudo chown -R "${USER:-$(whoami)}" . || true + if [ "$(id -u)" != 0 ]; then + sudo chown -R "${USER:-$(whoami)}" . || true + fi mkdir -p sanitizer /tmp/logs diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6490f2ac..a8776a36 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -164,7 +164,7 @@ jobs: - name: Install deps run: | - sudo sh .ci/deps.sh + sudo sh .ci/deps.sh iputils-arping sudo pip3 install --upgrade cryptography - name: Run tests with OpenSSL 3 -- 2.20.1