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

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