]> git.mdlowis.com Git - proto/labwc.git/commitdiff
CI: add simple runtime test
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Wed, 13 Mar 2024 14:26:16 +0000 (15:26 +0100)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Wed, 13 Mar 2024 23:42:13 +0000 (00:42 +0100)
.github/workflows/build.yml
scripts/ci/autostart [new file with mode: 0644]
scripts/ci/ci_autostart.sh [new file with mode: 0755]
scripts/ci/smoke-test.sh [new file with mode: 0755]

index 5cdea1873966bc3cafbf9349f049571fb2ea412b..ce83bb1ad3c3b3207bdc8f5f8e49fff4851ae535 100644 (file)
@@ -70,7 +70,8 @@ jobs:
           pacman-key --init
           pacman -Syu --noconfirm
           pacman -S --noconfirm git meson clang wlroots libdrm libinput \
-            wayland-protocols cairo pango libxml2 xorg-xwayland librsvg libdisplay-info
+            wayland-protocols cairo pango libxml2 xorg-xwayland librsvg \
+            libdisplay-info
 
       - name: Install Debian Testing dependencies
         if: matrix.name == 'Debian'
@@ -78,7 +79,7 @@ jobs:
           sed -i '/^Types/ s/deb/& deb-src/' /etc/apt/sources.list.d/debian.sources
           apt-get update
           apt-get upgrade -y
-          apt-get install -y git gcc clang
+          apt-get install -y git gcc clang gdb xwayland
           apt-get build-dep -y labwc
 
       - name: Install FreeBSD dependencies
@@ -104,8 +105,9 @@ jobs:
           xbps-install -Syu
           xbps-install -y git meson gcc clang pkg-config scdoc \
             cairo-devel glib-devel libpng-devel librsvg-devel libxml2-devel \
-            pango-devel wlroots0.17-devel
+            pango-devel wlroots0.17-devel gdb bash xorg-server-xwayland
 
+      # These build are executed on all runners
       - name: Build with gcc
         run: |
           echo '
@@ -152,6 +154,7 @@ jobs:
             meson compile -C build-gcc-release
           ' | $TARGET
 
+      # Runtime tests, these run on Debian and Void only (the later due to libmusl being used)
       - name: Build with clang - release
         run: |
           echo '
@@ -161,3 +164,37 @@ jobs:
               -Dbuildtype=release -Db_ndebug=true --werror
             meson compile -C build-clang-release
           ' | $TARGET
+
+      - name: Build with gcc - runtime test
+        if: matrix.name == 'Debian'
+        run: |
+          echo '
+            cd "$GITHUB_WORKSPACE"
+            export CC=gcc
+            meson setup build-gcc-ci -Dxwayland=enabled -Db_sanitize=undefined --werror
+            meson compile -C build-gcc-ci
+            scripts/ci/smoke-test.sh build-gcc-ci
+          ' | $TARGET
+
+      - name: Build with clang - runtime test
+        if: matrix.name == 'Debian'
+        run: |
+          echo '
+            cd "$GITHUB_WORKSPACE"
+            export CC=clang
+            meson setup build-clang-ci -Dxwayland=enabled -Db_sanitize=undefined --werror
+            meson compile -C build-clang-ci
+            scripts/ci/smoke-test.sh build-clang-ci
+          ' | $TARGET
+
+      # Void-musl doesn't support sanitizer
+      - name: Build with gcc - runtime test w/o sanitizer
+        if: matrix.name == 'Void-musl'
+        run: |
+          echo '
+            cd "$GITHUB_WORKSPACE"
+            export CC=gcc
+            meson setup build-gcc-ci -Dxwayland=enabled --werror
+            meson compile -C build-gcc-ci
+            scripts/ci/smoke-test.sh build-gcc-ci
+          ' | $TARGET
diff --git a/scripts/ci/autostart b/scripts/ci/autostart
new file mode 100644 (file)
index 0000000..1f29a49
--- /dev/null
@@ -0,0 +1 @@
+scripts/ci/ci_autostart.sh
diff --git a/scripts/ci/ci_autostart.sh b/scripts/ci/ci_autostart.sh
new file mode 100755 (executable)
index 0000000..4aa1c7f
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+if test -z "$LABWC_PID"; then
+       echo "LABWC_PID not set" >&2
+       exit 1
+fi
+
+echo "Running with pid $LABWC_PID"
+
+# Could add runtime tests here
+
+echo "killing labwc"
+kill -s TERM $LABWC_PID
diff --git a/scripts/ci/smoke-test.sh b/scripts/ci/smoke-test.sh
new file mode 100755 (executable)
index 0000000..89981af
--- /dev/null
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+
+if ! test -x "$1/labwc"; then
+       echo "$1/labwc not found"
+       exit 1
+fi
+
+args=(
+       "$1/labwc"
+       -C scripts/ci
+       -d
+)
+
+export XDG_RUNTIME_DIR=$(mktemp -d)
+export WLR_BACKENDS=headless
+
+echo "Starting ${args[@]}"
+output=$("${args[@]}" 2>&1)
+ret=$?
+
+if test $ret -ge 128; then
+       # Not using -Db_sanitize=address,undefined
+       # because it slows down the usual execution
+       # way too much and spams pages over pages
+       # of irrelevant memory-still-in-use logs
+       # for external libraries.
+       #
+       # Not using coredumps either because they
+       # are a pain to setup on GH actions and
+       # just running labwc again is a lot faster
+       # anyway.
+
+       echo
+       echo "labwc crashed, restarting under gdb"
+       echo
+       gdb --batch                       \
+               -ex run                   \
+               -ex 'bt full'             \
+               -ex 'echo \n'             \
+               -ex 'echo "Local vars:\n' \
+               -ex 'info locals'         \
+               -ex 'echo \n'             \
+               -ex 'set listsize 50'     \
+               -ex list                  \
+               --args "${args[@]}"
+else
+       echo "$output"
+fi
+
+echo "labwc terminated with return code $ret"
+exit $ret