Skip to content

test(starry): add Tcl/Tk GUI carpet (offscreen via Xvfb) - #1890

Open
Lfan-ke wants to merge 1 commit into
rcore-os:devfrom
Lfan-ke:apps-starry-cpu-tcltk-gui-test
Open

test(starry): add Tcl/Tk GUI carpet (offscreen via Xvfb)#1890
Lfan-ke wants to merge 1 commit into
rcore-os:devfrom
Lfan-ke:apps-starry-cpu-tcltk-gui-test

Conversation

@Lfan-ke

@Lfan-ke Lfan-ke commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

问题

GUI 框架矩阵里 Qt(#1873)与 egui(#1876)已覆盖,Tcl/Tk 尚缺。StarryOS 上没有 Tk GUI 的完备性测试。

改动

新增 apps/starry/cpu-tcltk-gui-test carpet:用 Xvfb(纯用户态虚拟帧缓冲 X server,无 GPU、无物理显示、渲染进 RAM)离屏跑 Tk,对像素/几何/交互做硬断言,固定 EXPECTED 三门(fail==0 && total==EXPECTED && pass==EXPECTED),确定性 seed 0x233。

  • gui_render(38):canvas 图元几何(rectangle/oval/line/polygon/arc/text 的 coords/bbox/find/move 闭式)+ Tk photo 逐像素闭式(fillRect 内部/边缘/背景精确计数、copy 合成)。
  • gui_layout(36):pack/grid/place 几何算术(winfo width/height/x/y/reqwidth)。
  • gui_interact(25)event generate <ButtonPress-1>/<KeyPress>/<space>/<Right> 注入真实事件驱动 widget 状态变化 + disabled 负控。
  • gui_realassets(10):font measure/metrics 精确值。

共 109 断言,每 cell mutation 验证(篡改一条断言→真 FAIL)。

On-target 定界

Tk 需要 X display。本 carpet 用 Xvfb 在 target 自带 headless 显示后端,不依赖内核 framebuffer / display bring-up:run_all.sh 起 Xvfb :99 跑 wish。只要 Alpine xvfb 包能起,整套即在 target headless 跑通;若某 arch 上 Xvfb 起不来(X server syscall 缺口,正是 #392 显示 bring-up 范畴),run_all.sh 打印 GATE BLOCKED (display gated on #392) 并诚实 fail,不退化成 host-only 假 pass。

验证

宿主实跑(Xvfb + Tk 8.6):GUI_RENDER 38 / GUI_LAYOUT 36 / GUI_INTERACT 25 / GUI_REALASSETS 10TEST PASSED

Closes the last GUI framework in the matrix (Qt + egui already covered). Renders
Tk widgets/canvas headless via Xvfb (userspace virtual framebuffer X server, no
GPU / no kernel framebuffer) and asserts exact pixels + geometry + interaction.

- gui_render (38): canvas primitive geometry (coords/bbox/find/move closed form)
  + Tk photo per-pixel closed form (fillRect interior/edge/background exact count,
  copy compositing).
- gui_layout (36): pack/grid/place geometry arithmetic (winfo width/height/x/y).
- gui_interact (25): event generate <ButtonPress-1>/<KeyPress>/<space>/<Right>
  drives real widget state changes + disabled negative control.
- gui_realassets (10): font measure/metrics exact values.
109 assertions, three-gate, deterministic (seed 0x233), mutation-tested.

On-target: Xvfb provides the display headless without kernel display bring-up; if
Xvfb cannot start on an arch, run_all.sh prints GATE BLOCKED (display gated on
rcore-os#392) and fails honestly rather than a host-only pass.

Host: GUI_RENDER 38, GUI_LAYOUT 36, GUI_INTERACT 25, GUI_REALASSETS 10, TEST PASSED.
Signed-off-by: Leo Cheng <chengkelfan@qq.com>

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本 PR 新增 apps/starry/cpu-tcltk-gui-test:通过 Tcl/Tk + Xvfb 在四个架构的 Starry QEMU rootfs 上执行图形、布局、交互和字体断言。它是新增的用户可见 app 工作流,适用 book/guideline/feature-development.md;按该准则属于局部但有运行时/跨架构风险的功能。目录放置在 apps/starry 符合 operator-facing app 与 test-suit 分层,未改 syscall/ABI,因此 Starry syscall 准则不适用。

存在 1 个阻塞问题:prebuild 的 APK 安装结果没有进入最终 guest overlay,导致文档所述 QEMU 流程无法启动 Tcl/Tk/Xvfb。请先修复并在当前 head 上完成至少一个文档化 QEMU app 运行(修复涉及的架构也应覆盖);宿主机运行只能证明 Tcl 脚本本身,不能代替 guest 运行时闭包验证。

验证:review_pr_helper.py test 通过(7 tests);bash -n prebuild.shsh -n run_all.sh、Python 编译/黄金值检查及 ShellCheck warning 阈值通过;安装 Tcl/Tk/Xvfb 后,在宿主机按 runner 约定运行得到 GUI_RENDER OK 38GUI_LAYOUT OK 36GUI_INTERACT OK 25GUI_REALASSETS OK 10TEST PASSED。未执行当前 head 的 QEMU app:静态追踪 prepare_qemu_app_rootfs 只注入 overlay,已足以证明 guest 缺失运行时。

组织 rcore-os/tgoskits 的该 head CI 已完成(71 个 checks:success=36、skipped=35、failure=0);跳过项是 host/container 矩阵项,现有 PR CI 未运行此新增 Starry app workflow,因而不能覆盖此问题。此前没有 review、inline comment 或 PR discussion,故无待处理的旧线程。

重复/重叠分析:base 中未找到 Tcl/Tk 或 cpu-tcltk app;以 cpu-tcltkTcl/Tk 搜索的开放 PR 仅命中本 PR,未发现重复或冲突实现。修复后应保持 app 运行时依赖的完整注入并验证真实 guest 输出。

Powered by gpt-5.6-terra

[[ -f "$bin/$c.tcl" ]] && echo "$c" >> "$bin/expected_cells"; done
echo "prebuild: expected_cells for $arch = $(tr '\n' ' ' < "$bin/expected_cells")"
mkdir -p "$overlay_dir/opt"
cp -a "$staging_root$INSTALL_DIR" "$overlay_dir/opt/"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

阻塞:这里仅把 /opt/cpu-tcltk-gui-test 和启动脚本放入 overlay,但 apk_provision 安装到 staging_rootwishXvfb、动态库、字体和 fontconfig 数据没有复制到 overlay。app runner 随后只注入 STARRY_OVERLAY_DIR,因此 guest 上 run_all.sh 必然在查找 wish(即使通过该步,后续也查找 Xvfb)时失败,README 所述的 on-target QEMU 流程无法运行。请按现有 app prebuild 模式把 apk 安装的完整运行时闭包复制/注入到对应 overlay 路径,并在当前 head 上执行文档中的 QEMU 命令验证。

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