CI: run sanitizers as root
authorKirill Isakov <bootctl@gmail.com>
Thu, 2 Jun 2022 06:30:48 +0000 (12:30 +0600)
committerKirill Isakov <bootctl@gmail.com>
Fri, 3 Jun 2022 06:56:18 +0000 (12:56 +0600)
The most interesting tests that actually exercise network
require root access for setup.

.ci/deps.sh
.ci/sanitizers/run.sh
.ci/test/run.sh
.github/workflows/test.yml

index e297fb1..17b49bb 100755 (executable)
@@ -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
index 3144275..8bf409f 100755 (executable)
@@ -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.
index 89a5d37..952fffd 100644 (file)
@@ -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
 
index 6490f2a..a8776a3 100644 (file)
@@ -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