Skip to content

tools/testramfs: upgrade to use VMs#3478

Merged
rminnich merged 2 commits into
u-root:mainfrom
rminnich:testinitramfs
Jan 8, 2026
Merged

tools/testramfs: upgrade to use VMs#3478
rminnich merged 2 commits into
u-root:mainfrom
rminnich:testinitramfs

Conversation

@rminnich

@rminnich rminnich commented Jan 4, 2026

Copy link
Copy Markdown
Member

The testramfs tool was of limited usefulness, as it only worked on the host architecture

The command now uses the "github.com/u-root/cpu/vm", which provides pre-built kernels and initramfs with cpud built in.

Testramfs has one required argument, which is the directory in which to run u-root; and optional arguments, passed directly to u-root. It currently requires that the output file be in the current working directory; this can change.

testramfs will build the initramfs, using the u-root command; then drop you into an interactive shell in the VM, using one of 3 embedded kernels.

testramfs assumes a reasonable qemu command exists in $PATH. It does not require grqphics.

Tested on OSX so far.

You can now test 3 different architectures, via environment variables. GOARCH=amd64 GOOS=linux ./testramfs ../..
GOARCH=arm64 GOOS=linux ./testramfs ../..
GOARCH=riscv64 GOOS=linux ./testramfs ../..

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR upgrades the testramfs tool from a limited host-architecture-only testing utility to a comprehensive VM-based testing tool that supports multiple architectures (amd64, arm64, riscv64). The tool now leverages pre-built kernels and initramfs from the "github.com/u-root/cpu/vm" package to enable cross-architecture testing.

Key Changes:

  • Replaced namespace-based isolation with full VM-based testing using QEMU
  • Added support for cross-architecture testing via GOOS/GOARCH environment variables
  • Simplified command-line interface to act as a wrapper around the u-root command

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/testramfs/testramfs.go Outdated
Comment thread tools/testramfs/testramfs.go Outdated
Comment thread tools/testramfs/testramfs.go Outdated
Comment thread tools/testramfs/testramfs.go Outdated
Comment thread tools/testramfs/testramfs.go Outdated
@codecov

codecov Bot commented Jan 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.00%. Comparing base (58ed27c) to head (2a6dcd3).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3478      +/-   ##
==========================================
+ Coverage   61.91%   62.00%   +0.08%     
==========================================
  Files         639      639              
  Lines       43148    43148              
==========================================
+ Hits        26717    26752      +35     
+ Misses      16431    16396      -35     
Flag Coverage Δ
.-amd64 90.90% <ø> (ø)
cmds/...-amd64 51.16% <ø> (-0.02%) ⬇️
integration/generic-tests/...-amd64 30.94% <ø> (ø)
integration/generic-tests/...-arm 33.06% <ø> (ø)
integration/generic-tests/...-arm64 30.05% <ø> (-0.08%) ⬇️
integration/gotests/...-amd64 62.61% <ø> (+0.24%) ⬆️
integration/gotests/...-arm 62.92% <ø> (+<0.01%) ⬆️
integration/gotests/...-arm64 63.02% <ø> (ø)
pkg/...-amd64 60.34% <ø> (-0.19%) ⬇️

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

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

@rminnich rminnich force-pushed the testinitramfs branch 3 times, most recently from 0ebbc57 to 0704fef Compare January 5, 2026 00:56
@rminnich rminnich force-pushed the testinitramfs branch 3 times, most recently from f5b1d7c to 5b35431 Compare January 5, 2026 03:21
@rminnich rminnich added the Awaiting reviewer Waiting for a reviewer. label Jan 6, 2026
brho
brho previously approved these changes Jan 7, 2026
Comment thread tools/testramfs/testramfs_test.go
Comment thread tools/testramfs/testramfs.go Outdated
binjip978
binjip978 previously approved these changes Jan 7, 2026
The testramfs tool was of limited usefulness, as it only worked on the host
architecture

The command now uses the "github.com/u-root/cpu/vm", which provides
pre-built kernels and initramfs with cpud built in.

Testramfs has one required argument, which is the directory
in which to run u-root; and optional arguments, passed directly to
u-root. It currently requires that the output file be in the current
working directory; this can change.

testramfs  will build the initramfs, using the u-root command; then
drop you into an interactive shell in the VM, using one of 3 embedded kernels.

testramfs assumes a reasonable qemu command exists in $PATH.
It does not require grqphics.

Tested on OSX so far.

You can now test 3 different architectures, via environment variables.
GOARCH=amd64 GOOS=linux ./testramfs  ../..
GOARCH=arm64 GOOS=linux ./testramfs  ../..
GOARCH=riscv64  GOOS=linux ./testramfs  ../..

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
@rminnich rminnich dismissed stale reviews from binjip978 and brho via 2a6dcd3 January 7, 2026 15:35
@rminnich rminnich merged commit 798b858 into u-root:main Jan 8, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Awaiting reviewer Waiting for a reviewer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants