CI: add simple runtime test

This commit is contained in:
Consolatis 2024-03-13 15:26:16 +01:00
parent cdac800692
commit 53fc8d5e39
4 changed files with 105 additions and 3 deletions

View 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

1
scripts/ci/autostart Normal file
View file

@ -0,0 +1 @@
scripts/ci/ci_autostart.sh

13
scripts/ci/ci_autostart.sh Executable file
View file

@ -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

51
scripts/ci/smoke-test.sh Executable file
View file

@ -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