Skip to content

Commit 81c3d89

Browse files
authored
Merge pull request #4054 from grandixximo/ui-tests-phase2
test: ui-smoke phase 2, g-code execution and endpoint check
2 parents 106519f + a9ff6a4 commit 81c3d89

23 files changed

Lines changed: 763 additions & 47 deletions

File tree

debian/control.top.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Build-Depends:
5757
python3-dbus <!nocheck>,
5858
python3-dbus.mainloop.pyqt5 <!nocheck>,
5959
python3-qtpy <!nocheck>,
60+
python3-zmq <!nocheck>,
6061
python3-cairo <!nocheck>,
6162
python3-gi <!nocheck>,
6263
python3-gi-cairo <!nocheck>,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# Shared result check for UI smoke quit-path tests.
3+
#
4+
# Pass if the quit launcher printed UI_SMOKE_QUIT_OK (the GUI exited on
5+
# its own SIGTERM within the grace) and did not print UI_SMOKE_QUIT_FAIL.
6+
set -u
7+
8+
if [ $# -lt 1 ]; then
9+
echo "FAIL: checkresult-quit requires the result-log path as argument" >&2
10+
exit 1
11+
fi
12+
13+
LOG="$1"
14+
15+
if grep -q '^UI_SMOKE_QUIT_FAIL' "$LOG"; then
16+
echo "FAIL: $(grep -m1 '^UI_SMOKE_QUIT_FAIL' "$LOG")" >&2
17+
exit 1
18+
fi
19+
20+
if ! grep -q '^UI_SMOKE_QUIT_OK' "$LOG"; then
21+
echo "FAIL: GUI did not report a clean SIGTERM exit (no UI_SMOKE_QUIT_OK)" >&2
22+
exit 1
23+
fi
24+
25+
exit 0

tests/ui-smoke/_lib/crashdump.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# Native crash capture for the UI smoke launchers. A GUI segfault is the
3+
# failure these tests most need to explain, and it lands in C/C++ (Qt,
4+
# dbus, GL) where PYTHONFAULTHANDLER stops at the event-loop frame. Arm a
5+
# core dump before launch; after the run, if the GUI left a core, print a
6+
# native backtrace into the log so CI shows the faulting frame directly.
7+
# Source with LIB_DIR set; runs only on the failure path, so green runs
8+
# pay nothing.
9+
10+
crashdump_arm() {
11+
CORE_DIR="$(mktemp -d -t ui-smoke-cores.XXXXXX)"
12+
export CORE_DIR
13+
ulimit -c unlimited 2>/dev/null || true
14+
# core_pattern is global and needs root; best-effort (CI has sudo).
15+
# If it does not take, crashdump_report still finds a cwd "core".
16+
sudo sysctl -w "kernel.core_pattern=$CORE_DIR/core.%e.%p" >/dev/null 2>&1 || true
17+
}
18+
19+
crashdump_report() {
20+
[ -n "${CORE_DIR:-}" ] || return 0
21+
local core
22+
# shellcheck disable=SC2012 # mktemp dir, no odd filenames
23+
core=$(ls -t "$CORE_DIR"/core* ./core* /tmp/core* 2>/dev/null | head -1)
24+
if [ -n "$core" ]; then
25+
echo "=== crash: native backtrace ($core) ==="
26+
# gdb is not on the CI runner by default; pull it in to read the core.
27+
command -v gdb >/dev/null 2>&1 || sudo apt-get install -y -q gdb >/dev/null 2>&1 || true
28+
if command -v gdb >/dev/null 2>&1; then
29+
# "bt" first: gdb auto-selects the faulting thread on a SIGSEGV
30+
# core. "thread apply all bt" after gives the rest.
31+
gdb -batch -nx \
32+
-ex "bt" \
33+
-ex "echo \n=== all threads ===\n" \
34+
-ex "thread apply all bt" \
35+
"$(command -v python3)" "$core" 2>&1 | head -400
36+
else
37+
echo "(gdb unavailable; core left at $core)"
38+
fi
39+
fi
40+
rm -rf "$CORE_DIR"
41+
}

0 commit comments

Comments
 (0)