CI: rewrite smoke test and support LABWC_RUNS env var

This commit is contained in:
Consolatis 2024-03-16 18:02:01 +01:00
parent fc9cf5c931
commit 51cdefa93e
2 changed files with 22 additions and 12 deletions

View file

@ -196,5 +196,5 @@ jobs:
export CC=gcc export CC=gcc
meson setup build-gcc-ci -Dxwayland=enabled --werror meson setup build-gcc-ci -Dxwayland=enabled --werror
meson compile -C build-gcc-ci meson compile -C build-gcc-ci
scripts/ci/smoke-test.sh build-gcc-ci LABWC_RUNS=20 scripts/ci/smoke-test.sh build-gcc-ci
' | $TARGET ' | $TARGET

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
: ${LABWC_RUNS:=1}
if ! test -x "$1/labwc"; then if ! test -x "$1/labwc"; then
echo "$1/labwc not found" echo "$1/labwc not found"
exit 1 exit 1
@ -14,11 +16,7 @@ args=(
export XDG_RUNTIME_DIR=$(mktemp -d) export XDG_RUNTIME_DIR=$(mktemp -d)
export WLR_BACKENDS=headless export WLR_BACKENDS=headless
echo "Starting ${args[@]}" gdb_run() {
output=$("${args[@]}" 2>&1)
ret=$?
if test $ret -ge 128; then
# Not using -Db_sanitize=address,undefined # Not using -Db_sanitize=address,undefined
# because it slows down the usual execution # because it slows down the usual execution
# way too much and spams pages over pages # way too much and spams pages over pages
@ -30,10 +28,8 @@ if test $ret -ge 128; then
# just running labwc again is a lot faster # just running labwc again is a lot faster
# anyway. # anyway.
echo
echo "labwc crashed, restarting under gdb"
echo
gdb --batch \ gdb --batch \
--return-child-result \
-ex run \ -ex run \
-ex 'bt full' \ -ex 'bt full' \
-ex 'echo \n' \ -ex 'echo \n' \
@ -43,9 +39,23 @@ if test $ret -ge 128; then
-ex 'set listsize 50' \ -ex 'set listsize 50' \
-ex list \ -ex list \
--args "${args[@]}" --args "${args[@]}"
else return $?
echo "$output" }
fi
echo "Running with LABWC_RUNS=$LABWC_RUNS"
ret=0
for((i=1; i<=LABWC_RUNS; i++)); do
printf "Starting run %2s\n" $i
output=$(gdb_run 2>&1)
ret=$?
if test $ret -ne 0; then
echo "Crash encountered:"
echo "------------------"
echo "$output"
break
fi
done
echo "labwc terminated with return code $ret" echo "labwc terminated with return code $ret"
exit $ret exit $ret