Skip to content

ui-smoke phase 3: screenshots, writable config mirrors, homing settle#4136

Open
grandixximo wants to merge 3 commits into
LinuxCNC:masterfrom
grandixximo:ui-tests-phase3
Open

ui-smoke phase 3: screenshots, writable config mirrors, homing settle#4136
grandixximo wants to merge 3 commits into
LinuxCNC:masterfrom
grandixximo:ui-tests-phase3

Conversation

@grandixximo
Copy link
Copy Markdown
Contributor

Builds on the merged phase 2 (#4054). This phase makes the ui-smoke runs more diagnosable and adds writable-config handling so the GUIs start cleanly headless.

What's here:

  • Screenshot on failure, confirm on pass: each GUI smoke test captures a screenshot, attached as a CI artifact, so a failure shows the actual on-screen state instead of just a log.
  • gmoccapy against a writable config mirror: gmoccapy writes its preference file next to the config; with the workspace mounted read-only that raises a PermissionError mid-init and pops error dialogs. The test mirrors the sim config to a tmp dir and pre-seeds hide_startup_messsage so the "Important change(s)" modal stays hidden (the same effect as ticking "Don't show this again"). This is the headless-start fix discussed in gmoccapy: modal startup "Important change(s)" dialog blocks headless / non-interactive startup #4072.
  • Settle after homing before requesting AUTO: removes a race where the AUTO-mode request arrived before the motion controller finished homing.

Scope note: the touchy window-fit smoke test is intentionally held back on a separate branch, since it depends on the touchy fitting changes in #4131 which are not merged yet. I will send it as a follow-up once #4131 lands.

…pass

Capture a PNG of the GUI before teardown and upload it as a CI artifact.
On a failure the picture shows the cause (a GUI hung on a blocking modal
leaves no core for crashdump.sh and no Python traceback, only a 60s
timeout). On a clean Phase 2 run it is a confirmation shot (confirm.png)
of the GUI in its post-movement idle state, so a reviewer can eyeball the
final DRO / toolpath. Phase 1 passes stay silent (no program ran).

_lib/screenshot.sh handles two capture paths:

- GTK GUIs (axis, touchy, gmoccapy) render to the X server, grabbed with
  ImageMagick import (falling back to xwd|convert locally). There is no
  window manager under xvfb-run, so a GUI's maximize() is a no-op and it
  renders at its natural size; the Xvfb screen is sized 1920x1080 in
  launch-env.sh so the whole window is captured instead of clipped.
- qtdragon runs the offscreen Qt platform (xcb segfaults qtvcp on Ubuntu
  24.04), which never draws to X, so an X grab is black. Instead the
  qtdragon shim installs a SIGUSR1 handler that grabs its top-level
  window to UI_SMOKE_QT_SHOT; the launcher signals it and collects the
  file.

The grab is a no-op with a logged reason when there is no display, no
grabber, or no GUI to signal, so it can never turn a pass into a fail.
screenshot.png, confirm.png and ui-smoke-qt.png are gitignored;
imagemagick is declared under !nocheck; ci.yml uploads
ui-smoke-screenshots-* on every run.
gmoccapy writes its preference file next to the config (config dir +
<MACHINE>.pref, no PREFERENCE_FILE_PATH in gmoccapy.ini). The workspace
is read-only for the runtime user on CI, so that write raises
PermissionError partway through __init__, before the MDIHistory widget's
_hal_init runs. gmoccapy pops an error dialog and limps on half built:
the interp-idle handler then hits a widget with no .stat and throws a
second dialog. The smoke test still passed (NML drove behind the
dialogs), so the breakage was invisible until the Phase 3 confirm shot
showed it.

Mirror the config to a writable tmp dir (the fix qtdragon already uses)
so the pref write succeeds. With the config writable the first-run
"Important change(s)" modal then appears; it runs a nested gtk loop that
never gets dismissed headless, sitting over the UI and swallowing the
SIGTERM in the quit test. Seed hide_startup_messsage in the mirrored
pref to suppress it, the same as a user ticking "Don't show this again".

gmoccapy smoke and gmoccapy-quit now come up clean.
The driver requested AUTO the instant homing completed per NML stat, but
gmoccapy only enables AUTO once it has processed the all-homed signal in
its own event loop (and re-asserts MANUAL itself on that signal). The
early request was rejected, bounced back to MANUAL with an "It is not
possible to change to Auto Mode" warning that lingered in the confirm
shot; ensure_mode retried and won, so the run still passed. A short
settle after homing lets the GUI catch up, so AUTO is accepted first try.
@grandixximo
Copy link
Copy Markdown
Contributor Author

For now the screenshots of the UI are uploaded, and it is up to the reviewers to check, if wanted we could save in source a screenshot to verify against that nothing changed, but then it will be a bit of a bother when anything is supposed to actually change, and for UI with multiple pages, we may want to verify with more than one screenshot at probably more than one resolution? that could take a while, or we can just call it done here, verify UI works with uploaded screenshot is already pretty good,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant