Skip to content

fix(axvm): enable host capabilities in tests - #1791

Merged
ZR233 merged 1 commit into
devfrom
codex/fix-axvm-host-tests
Jul 31, 2026
Merged

fix(axvm): enable host capabilities in tests#1791
ZR233 merged 1 commit into
devfrom
codex/fix-axvm-host-tests

Conversation

@ZR233

@ZR233 ZR233 commented Jul 31, 2026

Copy link
Copy Markdown
Member

问题

当前 dev 上执行 cargo test -p axvm --no-run 时,AxVM 的 host test 依赖图没有启用内核组件已有的 host-test capability。测试二进制因此会链接到 bare-metal 实现,并稳定缺少以下链接符号:

  • STACK_SIZE
  • PAGE_SIZE
  • __PERCPU_TEMPLATE_ALIGN_START
  • __PERCPU_TEMPLATE_ALIGN_END

该修复从 #1775 的提交 b5db5eacb2420f212f4d6525c23e054e54c7664e 中独立提取。

修改

virtualization/axvm/Cargo.toml[dev-dependencies] 中为以下既有 workspace 依赖启用 host-test

  • ax-hal
  • ax-kernel-guard
  • ax-kspin

实现逻辑

这些 crate 已经拥有专门的 host-test capability。通过 Cargo 的 dev-dependency feature unification,AxVM 的 unit/integration test 目标会复用对应的 host 实现,而正常 AxVM 依赖和生产构建不会启用这些 feature。

这避免了在 AxVM 中复制 PAGE_SIZESTACK_SIZE 和 percpu section 的 linker-script 定义,也让测试能力继续由拥有这些边界的 crate 维护。

开放 PR #1716 处理了相同的 AxVM 链接症状及另一个 ax-net 链接问题,但采用为每个 package 新增 linker script 的方案。本 PR 只处理 AxVM,并复用现有 host-test feature;若本 PR 合入,#1716 的 AxVM 部分不再需要,ax-net 部分仍可独立处理。

验证

红灯(未修复的 dev):

$ cargo test -p axvm --no-run
error: undefined symbol: STACK_SIZE
error: undefined symbol: PAGE_SIZE
error: undefined symbol: __PERCPU_TEMPLATE_ALIGN_START
error: undefined symbol: __PERCPU_TEMPLATE_ALIGN_END

绿灯:

$ cargo test -p axvm --no-run
Finished `test` profile

$ cargo test -p axvm
118 unit tests passed
18 architecture contract tests passed
4 error contract tests passed

$ cargo xtask clippy --package axvm
6/6 checks passed

$ cargo fmt --all

本次只修正 host test 的 Cargo feature 解析,不改变 AxVM 运行时、虚拟化 ABI、应用或 QEMU 行为,因此无需新增运行时/QEMU 用例。

@ZR233
ZR233 marked this pull request as ready for review July 31, 2026 01:50

@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 仅在 virtualization/axvm/Cargo.toml 添加 3 个测试专用开发依赖,并为 ax-halax-kernel-guardax-kspin 启用已有的 host-test capability。这样测试目标的 Cargo feature 统一解析会选择 host 实现,修复 AxVM 测试链接阶段缺少 PAGE_SIZESTACK_SIZE 与 percpu 边界符号的问题;正常运行时依赖和虚拟化 ABI 不受影响。

实现与仓库中其他 crate 的 [dev-dependencies] host-test 用法一致。ax-kspin/host-test 也会继续传递 ax-kernel-guard/host-test;显式列出三个直接依赖可确保 AxVM 的测试目标覆盖其直接依赖边界。未发现 [patch.crates-io] 覆盖或 Cargo.lock 变更。

验证:本地执行 cargo fmt --all --checkgit diff --check 均通过;已核验当前提交 82261f2b080b0430e6b2ed0e03d66e8d5cee5529。组织 CI 针对该头提交的 81 个 check run 为 success=38、skipped=40、cancelled=3、failure=0,格式检查成功;跳过项属于路径/互斥矩阵,取消项为 stale-run,未见由本改动造成的失败。CI 已覆盖 PR 声明的 cargo test -p axvmcargo xtask clippy --package axvm 路径,因此未重复执行完整本地测试。

既有 review、行内评论与 PR 讨论均为空。已检查开放草稿 PR #1716:其 AxVM 部分处理相同链接症状但使用额外 linker script,且还包含独立的 ax-net 修复;本 PR 复用现有 capability,属于可独立合入的更小范围方案,不构成合入依赖。

feature-development.md 不适用:该变更未新增用户可见或公共能力,仅调整测试依赖 feature;Starry syscall 准则亦不适用。没有新增应用、QEMU 场景或运行时语义,故不存在相应运行时测试缺口。所有审核待办已完成,未发现阻塞问题。

Powered by gpt-5.6-terra

@ZR233
ZR233 merged commit 7f632d6 into dev Jul 31, 2026
78 of 81 checks passed
@ZR233
ZR233 deleted the codex/fix-axvm-host-tests branch July 31, 2026 04:02
This was referenced Jul 31, 2026
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