WIP: UI smoke tests for axis, touchy, gmoccapy, qtdragon#3999
WIP: UI smoke tests for axis, touchy, gmoccapy, qtdragon#3999grandixximo wants to merge 2 commits into
Conversation
If you manage to create consistent screenshots and want to go to pedantic mode:
Probably over complicated and I don't know how deterministic LinuxCNC is but this way, bugs like this #3979 can be easily avoided. Testing manually, these kind of bugs are just often overlooked. |
Three review-driven changes:
1. Fix self-kill regression: pkill -KILL -f "\\bqtdragon\\b" matched
the launch.sh process whose argv contained the path
.../qtdragon_metric.ini, sending SIGKILL to the test itself
(exit 137 across all 4 tests). Use pkill -KILL -x against an
exact daemon name list (linuxcncsvr, milltask, halui, rtapi_app),
not the GUI program names; the GUIs are children of the linuxcnc
script and get reaped via SIGTERM to its process group.
2. Dedupe cleanup. Both pre-launch and post-shutdown blocks repeated
the daemon list and shared-memory key list; extract them to
_lib/cleanup-runtime.sh which is called from launch.sh and from
the heredoc fallback. Single source of truth.
3. Drop the pre-driver `sleep 8` and the python module preflight
inside launch.sh. drive.py polls echo_serial_number for task
readiness so a wall-clock wait is unnecessary. With GUI runtime
deps now declared in debian/control under !nocheck, the python
preflight has nothing to do; missing deps will fail the test
loudly which is what reviewers asked for ("if it skips gracefully
we don't know whether the code is sane"). The skip predicate
only skips on xvfb-run absence (rare local dev environment).
Refs LinuxCNC#3756, PR LinuxCNC#3999
The reference-screenshot diff approach is a good Phase 3 idea, will track it on #3756. For Phase 1 (this PR) I'm staying with NML state assertions only since they're deterministic; rendering will need the screen-stabilization tricks you mentioned. |
|
Round 2 pushed; CI now passes 282/282 with all 4 ui-smoke tests running. Changes in this round:
|
filechooser.reload() called os.listdir(self.dir) with no error handling, which crashes touchy at startup when the hardcoded $HOME/linuxcnc/nc_files path does not exist (e.g. a fresh install, a CI runner with a clean $HOME, or a sysadmin who keeps NGC programs elsewhere). The traceback aborted the whole GUI before any window appeared. Catch OSError, log the path that could not be read, and continue with an empty file list. Touchy still starts; the user can browse to programs through the regular file menu and the quick-pick list populates as soon as files appear. Surfaced by ui-smoke testing (#3999) on a clean GitHub Actions $HOME. Closes #4005.
|
@BsAtHome this is review ready, after the review, merge this and make another PR for phase 2? or just continue here, and merge after all is done? |
|
@BsAtHome did you force rerun the CI? I got an email it failed, but looking here it did not? Was it Ubuntu's servers? Edit: Never Mind, it failed again, some sudo issues, will check... |
|
Also,...have you run |
|
CI keeps failing... did you rebase? |
Yes, I did. I saw the fail on eatmydata adduser and was guessing a transient failure (those we've seen many of). As a "member" I can restart runs. |
|
I did rebase, also squashed and fixed a few thing, including your review points, shellcheck on my scripts returns clean. |
|
will see if #4017 passes |
Adds a minimal harness under tests/ui-smoke/ that launches each GUI
against its sim config under xvfb-run and verifies it reaches the
'task ready' NML state without crashing. Auto-discovered by
scripts/runtests via per-GUI test.sh + checkresult + skip files.
Layout:
_lib/launch.sh - spawns linuxcnc -r under xvfb, runs driver,
handles clean shutdown (group-SIGTERM with
60s wait, escalate to SIGKILL + shm cleanup)
_lib/drive.py - polls linuxcnc.stat() until task ready,
prints UI_SMOKE_OK / UI_SMOKE_FAIL
_lib/checkresult.sh - grep for UI_SMOKE_OK / absence of FAIL
_lib/skip-if-missing.sh - skip when xvfb-run absent (dev env)
_lib/cleanup-runtime.sh - pre/post belt-and-braces daemon + shm
cleanup; SHM key list mirrors
scripts/runtests:157 (full 6-key set)
_lib/run-gui.sh - dispatcher taking a relpath under
configs/sim/, exec'd by per-GUI test.sh
axis|touchy|gmoccapy|qtdragon/test.sh - one-line wrappers
Force software OpenGL via LIBGL_ALWAYS_SOFTWARE + Qt RHI/QSG/QtQuick
software backends; CI runners have no GPU and Qt GL paths segfault
on headless display.
Skip vs fail policy (BsAtHome / hdiethelm review): only xvfb-run
absence skips; missing Python/typelib deps fail loudly so review
catches them. Required deps are gated under !nocheck in
debian/control.top.in (separate commit).
Adds the Python, Qt, GTK and typelib runtime deps needed for the ui-smoke harness under tests/ui-smoke/ to actually exercise each GUI's import path on CI. All gated with <!nocheck> so users building with DEB_BUILD_OPTIONS=nocheck aren't penalised with the extra packages. Includes pyqt5 (+ qsci/qtsvg/qtopengl/qtwebengine/qtpy/dev-tools), python3-dbus.mainloop.pyqt5, python3-cairo, python3-gi(+cairo), gir1.2-gtk-3.0, gir1.2-gtksource-4, python3-numpy, python3-configobj, xvfb and x11-xserver-utils.
|
I just checked a few past CI failures. |
That was why I merged your PR today (AP usually does the merging). Your improvements fixed the issue, improved speed and structure (very considerably) and replaced another PR that would have generated a conflict with yours. How many birds were
And it is getting worse by the day. |
|
Yes, I hit the not available adduser also in my PR but already fixed it. Just tag me if you have an unexplained CI failure and I can quickly investigate. No I know a bit how github works. For example this:
You can follow it live here: |
Draft, opening for CI feedback. Refs #3756.
Summary
Phase 1 of the GUI test work tracked in #3756. Each test launches a GUI under
xvfb-runagainst an existingconfigs/sim/<gui>/*.ini, drives Estop reset / machine on / home all via NML, asserts the interpreter reaches IDLE, then shuts down cleanly. Verifies the GUI starts and accepts basic commands without crashing.Coverage
Mechanics
tests/ui-smoke/_lib/launch.sh:xvfb-runwrapper,setsidso the linuxcnc process group can be signalled cleanly, falls back toaxis-remote --quitthen SIGTERM with grace then SIGKILL. Skips with exit 77 ifxvfb-runis unavailable (matchestests/tooleditandtests/pyvcp).tests/ui-smoke/_lib/drive.py: NML driver. Tolerant of sim configs that come up already inSTATE_ONvia auto-estop-release HAL wiring. Falls back to per-joint serial homing if noHOME_SEQUENCEis configured.tests/ui-smoke/_lib/checkresult.sh: pass whenUI_SMOKE_OKprinted and no crash markers in captured logs.Cleanup discipline
.gitignorecovers all runtime artifacts (linuxcnc.{out,err,pid},ui-smoke.{out,err},result,stderr)Deps
xvfbis already declared indebian/controlwith the<!nocheck>profile soapt-get build-depinstalls it on the existing CI without a workflow change. Coordinated with @hdiethelm in #3984: this PR adds no system deps; if his lands first, no rebase needed here.Out of scope (deferred)
linuxcnc.command.program_open+auto(RUN), verify final position vialinuxcnc.stat.position. Per-GUI cross-checks viaxdotoolor AT-SPI where useful.Test plan
scripts/runtests tests/ui-smoke, no shmem leaks