1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
#!/usr/bin/env bash
: ${LABWC_RUNS:=1}
: ${LABWC_LEAK_TEST:=0}
: ${LABWC_EXPECT_RETURNCODE:=0}
: ${LABWC_VERBOSE:=0}
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
gdb_run() {
# 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.
gdb --batch \
--return-child-result \
-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[@]}"
return $?
}
echo "Running with LABWC_RUNS=$LABWC_RUNS"
if test "$LABWC_LEAK_TEST" != "0"; then
LSAN_OPTIONS=suppressions=scripts/asan_leak_suppressions "${args[@]}"
exit $?
fi
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 $LABWC_EXPECT_RETURNCODE; then
echo "Crash encountered:"
echo "------------------"
echo "$output"
break
elif test $LABWC_VERBOSE -eq 1; then
echo "------------------"
echo "$output"
fi
done
echo "labwc terminated with return code $ret"
if test $ret -eq $LABWC_EXPECT_RETURNCODE; then
exit 0;
else
exit 1;
fi
|