]> git.mdlowis.com Git - proto/labwc.git/commitdiff
CI: rewrite smoke test and support LABWC_RUNS env var
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Sat, 16 Mar 2024 17:02:01 +0000 (18:02 +0100)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Sat, 16 Mar 2024 17:42:47 +0000 (18:42 +0100)
.github/workflows/build.yml
scripts/ci/smoke-test.sh

index ce83bb1ad3c3b3207bdc8f5f8e49fff4851ae535..eec6984d02155b48a62ee945c4800a30896e6832 100644 (file)
@@ -196,5 +196,5 @@ jobs:
             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
+            LABWC_RUNS=20 scripts/ci/smoke-test.sh build-gcc-ci
           ' | $TARGET
index 89981af6a0e24582423a79d6e63cdfb7f91a4bc9..e366ceafdf70f14edc2209305915a80daaa1aaf9 100755 (executable)
@@ -1,5 +1,7 @@
 #!/usr/bin/env bash
 
+: ${LABWC_RUNS:=1}
+
 if ! test -x "$1/labwc"; then
        echo "$1/labwc not found"
        exit 1
@@ -14,11 +16,7 @@ args=(
 export XDG_RUNTIME_DIR=$(mktemp -d)
 export WLR_BACKENDS=headless
 
-echo "Starting ${args[@]}"
-output=$("${args[@]}" 2>&1)
-ret=$?
-
-if test $ret -ge 128; then
+gdb_run() {
        # Not using -Db_sanitize=address,undefined
        # because it slows down the usual execution
        # 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
        # anyway.
 
-       echo
-       echo "labwc crashed, restarting under gdb"
-       echo
        gdb --batch                       \
+               --return-child-result     \
                -ex run                   \
                -ex 'bt full'             \
                -ex 'echo \n'             \
@@ -43,9 +39,23 @@ if test $ret -ge 128; then
                -ex 'set listsize 50'     \
                -ex list                  \
                --args "${args[@]}"
-else
-       echo "$output"
-fi
+       return $?
+}
+
+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"
 exit $ret