Skip to content

add test using github.com/u-root/cpu{vm,client}#3452

Merged
rminnich merged 4 commits into
u-root:mainfrom
rminnich:integration-cpu
Sep 15, 2025
Merged

add test using github.com/u-root/cpu{vm,client}#3452
rminnich merged 4 commits into
u-root:mainfrom
rminnich:integration-cpu

Conversation

@rminnich
Copy link
Copy Markdown
Member

This is a simple test, which needs no shell,
demonstrating how to use github.com/u-root/cpu vm and client packages.

The vm package has four Linux kernel/initramfs pairs embedded in it, for amd64, arm, arm64, and riscv64; Plan 9 is planned.

The test uses vm.Uroot to build a complete u-root image and merge it into the provided initramfs.

The vm package will start the VM (see the test) with cpud running.

The test then uses the client package to run commands in the guest, without needing a shell script.

The cpu client returns 0 or non-zero status, for command success of failure.

Note that, also, files can be read or written from outside the vm, with no special effort. This is shown in the first part of the tests, via dd.

@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.35%. Comparing base (6ca9f75) to head (48b9851).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3452   +/-   ##
=======================================
  Coverage   59.35%   59.35%           
=======================================
  Files         637      637           
  Lines       54120    54120           
=======================================
  Hits        32122    32122           
  Misses      21998    21998           
Flag Coverage Δ
.-amd64 88.88% <ø> (ø)
cmds/...-amd64 49.13% <ø> (+<0.01%) ⬆️
integration/generic-tests/...-amd64 30.12% <ø> (ø)
integration/generic-tests/...-arm 31.98% <ø> (ø)
integration/generic-tests/...-arm64 29.36% <ø> (+0.08%) ⬆️
integration/gotests/...-amd64 59.86% <ø> (+<0.01%) ⬆️
integration/gotests/...-arm 60.50% <ø> (+0.01%) ⬆️
integration/gotests/...-arm64 60.73% <ø> (+0.09%) ⬆️
pkg/...-amd64 57.66% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
everything 64.25% <ø> (+<0.01%) ⬆️
cmds/exp 31.08% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rminnich rminnich added the Awaiting reviewer Waiting for a reviewer. label Sep 11, 2025
@rminnich rminnich force-pushed the integration-cpu branch 2 times, most recently from 377b318 to 3a0d9ac Compare September 11, 2025 20:35
AjanZhong
AjanZhong previously approved these changes Sep 12, 2025
Comment thread integration/generic-tests-cpu/io_linux_test.go Outdated
This is a simple test, which needs no shell,
demonstrating how to use github.com/u-root/cpu vm and client packages.

The vm package has four Linux kernel/initramfs pairs embedded in it,
for amd64, arm, arm64, and riscv64; Plan 9 is planned.

The test uses vm.Uroot to build a complete u-root image and merge
it into the provided initramfs.

The vm package will start the VM (see the test) with cpud running.

The test then uses the client package to run commands in the guest,
without needing a shell script.

The cpu client returns 0 or non-zero status, for command success of failure.

Note that, also, files can be read or written from outside the vm, with no
special effort. This is shown in the first part of the tests, via dd.

Signed-off-by: Ronald G Minnich <rminnich@gmail.com>
Seems this will not build right now for the released tinygo.

Until your tinygo is at 1.24, do not try to build it.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
This test kexecs the kernel, then connects to it again via cpu to verify the kexec succeeded.

No shell needed in the guest, and the kernel/initramfs need not be copied in;
they are accessed via 9p, as in cpu.

Signed-off-by: Ronald G Minnich <rminnich@gmail.com>
@rminnich
Copy link
Copy Markdown
Member Author

now includes a kexec test

@rminnich rminnich added the automerge Applying this label auto-merges the PR when ready label Sep 13, 2025
@rminnich rminnich merged commit 19a9a92 into u-root:main Sep 15, 2025
36 of 37 checks passed
@rminnich rminnich deleted the integration-cpu branch September 17, 2025 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Applying this label auto-merges the PR when ready Awaiting reviewer Waiting for a reviewer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants