Skip to content

ci: QEMU 自动引导 + 一键复现;docs: 测试计数修正(148→实测)与 host 测试命令 - #13

Merged
gqf2008 merged 4 commits into
masterfrom
ci/qemu-zero-install
Sep 3, 2026
Merged

ci: QEMU 自动引导 + 一键复现;docs: 测试计数修正(148→实测)与 host 测试命令#13
gqf2008 merged 4 commits into
masterfrom
ci/qemu-zero-install

Conversation

@gqf2008

@gqf2008 gqf2008 commented Sep 3, 2026

Copy link
Copy Markdown
Owner

动机

实测结论(issue #11 的答案)

  • cargo test --lib(默认 features): 80 passed
  • 门禁同款特征组合(--no-default-features --features xtask_executor,xtask_scheduler,timer,fs,net,usb,ble,即 ci/gate.sh 第 1 步): 157 passed(= 源码中 157 处 #[test])
  • 结论:README 的 148 为过时计数,已在本 PR 修正为实测值

改动

文件 内容
ci/get-qemu.sh(新) 自动下载 xPack 静态 QEMU riscv 到 .tools/(免管理员;Windows/macOS/Linux)
ci/gate.sh QEMU 缺失→自动引导;riscv32imac target 缺失→rustup 自动补装;失败给读者通道提示
.devcontainer.json(新) Codespaces 打开即跑(自动补 target + QEMU)
README.md 新增「一键复现(读者零安装)」三通道(A 本机一条命令/B Codespaces/C CI 徽章);计数修正;host 命令显式 --target
.gitignore 忽略 .tools/

Closes #12, refs #11

gqf2008 and others added 2 commits September 3, 2026 07:08
独立代码审查(b216a4d)发现项一次性修补:

- read_blocking 补调用契约文档:仅任务上下文(xworker.current() +
  Task::block(),boot/ISR 调用即踩空指针)+ 单读者契约(EventDevice
  单等待者覆盖语义,并发调用互相覆盖 waiter,先登记者永久丢唤醒)——
  旧 read_byte 方法文档上的两条红线在迁移时只留在了 trait 侧
- Control trait 文档承认占位实现:能力已暴露但命令面未定义时(如 Uart0)
  可对一切 op 报 Unsupported,消除与"未知 op 报 InvalidInput"的字面张力
  (DeviceError::Unsupported 的枚举文档本就覆盖"未实现的 op")
- ble/at.rs 与 ble_gatt.rs 红线注释改写:旧机制(阻塞 read_byte →
  xworker 空指针)已随重构移入 read_blocking;BleIo::read_byte 现为
  非阻塞读,send 空缓冲只走 yield_now+字节预算——boot 下的风险从 UB
  降级为预算耗尽超时,纪律不变(boot 只用 poll());同时消除与 send
  内联注释"任何上下文安全"的自相矛盾
- device::table 补 find_block/find_bus 回归测试(MockBlock/MockBus,
  计数透传+能力不符 None),清单侧五能力查找覆盖 5/5,对齐设计稿 §10
  "防 as_* 漏 override 静默 None"纪律
- 设计稿头部同步:关联模块改列 device.rs/device/table.rs,状态标已实施

验证:host 回归 158/158(+find_block_and_bus_roundtrip);
rustfmt --check 仅作用叶子文件 table.rs 零偏差(不全量 fmt,避免基线漂移);
driver 示例链接构建通过

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
gqf2008 and others added 2 commits September 3, 2026 09:29
- ci/get-qemu.sh: 自动下载 xPack 静态 QEMU 到 .tools/(免管理员,免包管理器)
- ci/gate.sh: QEMU 缺失时自动引导;rustup target riscv32imac 缺失时自动补装
- .devcontainer.json: GitHub Codespaces 打开即跑
- README: 新增「一键复现(读者零安装)」三通道;宿主回归计数 148→实测(默认 80/门禁全特征 157,见 issue #11);host 测试命令显式 --target(见 issue #12)
审查 PR #13 发现:
- F1(高): get-qemu.sh 的 mv 用带平台后缀的 $NAME 匹配解压根目录,但
  xPack 三平台包统一解压到 xpack-qemu-riscv-<ver>(无后缀),[ -d ] 恒为假
  → mv 跳过 → 通道 A(零安装)在 win32/linux/darwin 全部失败。CI 因 apt
  预装 QEMU、本机走系统 QEMU,引导分支零覆盖,故一路绿。改:新增
  SHORT=xpack-qemu-riscv-<ver> 作 mv/清理基准;unzip -q→-qo 并解压前清
  残留,避免重跑交互式覆盖询问。已本机实跑验证:下载→解压→落 .tools/qemu
  →跑通 9.2.4,二次运行幂等早退。
- F2(低): README 门禁计数 157→158(rebase 带上 769cff4 的新增测试
  find_block_and_bus_roundtrip),并注明计数随新增测试浮动、以 gate.sh 实测为准。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gqf2008
gqf2008 force-pushed the ci/qemu-zero-install branch from e123559 to 3afb1f6 Compare September 3, 2026 01:32
@gqf2008
gqf2008 merged commit e2c0199 into master Sep 3, 2026
2 checks passed
@gqf2008
gqf2008 deleted the ci/qemu-zero-install branch September 3, 2026 02:40
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.

docs: README 快速开始 cargo test --lib 在干净环境直接报 E0463(.cargo/config.toml 默认 thumbv7em target)

1 participant