Skip to content

test(linux): 修复窗口 smoke 测试的异步时序问题 - #401

Draft
wysaid wants to merge 1 commit into
masterfrom
fix/linux-window-smoke-wm-sync
Draft

wysaid wants to merge 1 commit into
masterfrom
fix/linux-window-smoke-wm-sync

Conversation

@wysaid

@wysaid wysaid commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

问题

Linux window smoke 在真实 Xfwm 桌面上会错误报告 resize event missing。映射和调整大小需要窗口管理器异步处理,单次 processEvents() / XSync() 不能保证最终的 ConfigureNotify 已到达。

裸 Xvfb 还存在测试夹具连接寿命的竞态:屏幕尺寸查询关闭唯一客户端连接后,服务器可能正在 reset,紧接着的窗口创建因此失败。

修改

  • 映射、尺寸变化、输入和关闭事件均使用有明确截止时间的条件等待
  • 保留 80×48、resize 回调、鼠标、键盘、拒绝关闭和接受关闭等严格断言,超时时打印实际尺寸
  • 在测试 setup 前打开观察连接并保持到测试结束,避免测试过程中出现零客户端间隙
  • Linux CI 在裸 Xvfb 与带 Xfwm/独立 D-Bus 的 Xvfb 下分别重复窗口 smoke 20 次,并验证窗口管理器确实就绪且存活

修改范围为测试和 CI,未改动运行库实现。

验证

  • 原始 resize 测试:真实 XFCE、隔离 Xvfb + Xfwm 各 5/5 复现失败
  • 修复后:两种窗口管理环境各连续 20 次通过
  • Xvfb 连接对照:连接寿命修复前 7/100 出现 create failed;旧二进制使用 -noreset 后 0/100;修复后二进制在普通 Xvfb 下 0/100
  • 干净 Release 构建:库及全部 36 个 portable demos 通过
  • 最终本地 CTest:真实 XFCE、裸 Xvfb 均 15/15 通过
  • CI 新增步骤原样运行通过,包括各 20 次裸/托管窗口测试和独立 D-Bus 会话
  • 阴性对照:故意不发 resize 请求,仍在 2 秒后失败并给出尺寸诊断
  • git diff --check、工作流 YAML 与 shell 语法检查通过

本地未启用需要虚拟视频设备的相机测试,原有 CI 相机测试步骤保持不变。

@coderabbitai

coderabbitai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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