Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
202 commits
Select commit Hold shift + click to select a range
07ad977
feat(cpio): add rust argument parsing library from crosvm
ddiss May 28, 2021
7493fe6
feat(cpio): add newc archive creation utility
ddiss May 19, 2021
82dcf75
fix(cpio): write zeros instead of seek for padding and alignment
ddiss Dec 3, 2021
bffe429
ci(cpio): add TempWorkDir.create_tmp_mknod helper
ddiss Feb 7, 2022
7e3f082
ci(cpio): add test_archive_dev_maj_min
ddiss Feb 10, 2022
58e1c75
fix(cpio): correct dev_t -> rmajor/rminor mapping
ddiss Feb 10, 2022
d9183ea
cpio: move dracut-cpio archiver into parent dir
ddiss Sep 18, 2025
eae9bcc
cpio: fix minor rust compiler warning
ddiss Sep 19, 2025
6a69725
fix(cpio): unit test regression from GNU cpio changes
ddiss Sep 23, 2025
3802045
dracut-cpio: drop namespace for std::io calls
ddiss Sep 23, 2025
4ce1fe0
build: split dracut-cpio into cpio.rs lib and bin
ddiss Sep 23, 2025
f7e4e0d
license: clarify that rust source is different
ddiss Sep 23, 2025
73ddc54
dracut-cpio: use os::unix::fs::MetadataExt in test only
ddiss Sep 23, 2025
a18ade6
third-party: add rust-elf v0.8.0 source
ddiss Sep 24, 2025
ea89d48
rapido-cut: rough draft elf dependency gatherer
ddiss Sep 24, 2025
1431826
fix(cpio): use mutex to avoid multi-threaded failures
ddiss Sep 25, 2025
1de05bc
rapido-cut: add argument parsing
ddiss Sep 24, 2025
8abfea9
rapido-cut: write out cpio archive
ddiss Sep 24, 2025
4bbe6f9
rapido-cut: avoid buffering entire file for ELF parsing
ddiss Sep 26, 2025
dbec97a
rapido-cut: drop unused found list
ddiss Sep 27, 2025
b1a836c
cpio: add archive_path md parameter to avoid stat
ddiss Sep 27, 2025
e8ad113
rapido-cut: pass md to cpio::archive_path
ddiss Sep 27, 2025
63bcb5e
cpio: add archive_file helper
ddiss Sep 29, 2025
20e0128
rapido-cut: call new cpio::archive_file function
ddiss Sep 29, 2025
d6e8457
dracut-cpio: drop file archive support from archive_path
ddiss Oct 6, 2025
4713a33
fix(cpio): archive correct minor number
ddiss Oct 6, 2025
aabbc22
chore(cpio): zero device major/minor numbers
ddiss Oct 8, 2025
99ba249
test(cpio): add test_archive_major_minor
ddiss Oct 8, 2025
38a6dfa
license: switch to (GPL-2.0 OR GPL-3.0)
ddiss Oct 9, 2025
0a3444e
rs/kv-conf: add bash style key=val parser
ddiss Oct 9, 2025
46c8cc6
rapido-init: basic init program
ddiss Oct 9, 2025
f15574f
rapido-init: mount proc, sysfs and set hostname
ddiss Oct 10, 2025
d92592d
rapido-init: working with simple-example and -network
ddiss Oct 10, 2025
6220fbd
don't run init steps if RAPIDO_INIT is set
ddiss Oct 12, 2025
eafbedb
vm: don't quote hostname
ddiss Oct 12, 2025
b4b0ca7
kv-conf: add kv_conf_process_append()
ddiss Oct 19, 2025
c87e0b2
rs/rapido-vm: simple qemu wrapper for booting images
ddiss Oct 19, 2025
b8a961f
rs/rapido-init: set HOSTNAME env for shell
ddiss Oct 19, 2025
76bcd6a
tools/parse_depmod.awk: hacky .ko dependency resolver
ddiss Oct 20, 2025
ad086cb
cpio: drop hardlink tracking
ddiss Oct 20, 2025
5de52be
dracut-cpio: drop most hardlink tests
ddiss Oct 20, 2025
9c87a6d
rs/cpio: split out archive_symlink
ddiss Oct 20, 2025
f633e1c
rs/cpio: clean up archive_trailer API
ddiss Oct 20, 2025
2c8b351
rs/cpio: move props.truncate_existing out of core lib
ddiss Oct 20, 2025
bcf8d27
rs/dracut-cpio: always use '\n' list separator
ddiss Oct 20, 2025
0446147
rs/cpio: move ArchiveProperties under ArchiveState
ddiss Oct 20, 2025
ff89100
rs/rapido-cut: avoid clone for path_stat paths
ddiss Oct 20, 2025
8ec9b86
rs/rapido-cut: clean up PathBuf use
ddiss Oct 20, 2025
b674cba
rs/rapido-cut: archive parent directories for files
ddiss Oct 21, 2025
0295f97
rs/rapido-cut: support --install src→dest parameters
ddiss Oct 22, 2025
1d45146
cpio: accept metadata via new ArchiveMd type
ddiss Oct 27, 2025
b726a39
rs/dracut-cpio: use new ArchiveMd API
ddiss Oct 27, 2025
54ca398
rs/rapido-cut: use new ArchiveMd API
ddiss Oct 27, 2025
9a7cf26
rs/rapido-cut: handle --install src→dest parameters
ddiss Oct 27, 2025
d9f9a68
rs/cpio: move into separate crate
ddiss Oct 28, 2025
9e18bfb
cpio: add archive entry iterator
ddiss Oct 30, 2025
85a9c4e
cpio: don't allow namesize=0
ddiss Oct 30, 2025
ff766f9
cpio: return None when iter hits archive trailer
ddiss Oct 30, 2025
28b1de7
rs/rapido-vm: use cpio ArchiveWalker to parse resource paths
ddiss Oct 30, 2025
e9e6362
gitignore: ignore cargo build target/
ddiss Oct 31, 2025
5a59506
cpio: split out path prefix trim into a helper
ddiss Nov 2, 2025
77f5013
cpio: return outpath bytes from helper and strip '/'
ddiss Nov 2, 2025
d9a4e15
rs/dracut-cpio: rework tests following '/' prefix stripping
ddiss Nov 3, 2025
e67e46b
rs/rapido-vm: avoid traversing full image for rapido-rsc
ddiss Nov 3, 2025
b6e6d1c
rs/rapido-init: reduce debug output
ddiss Nov 3, 2025
e079d1e
vm: install and run rapido-init
ddiss Nov 3, 2025
fa98830
rapdio: call rapido-vm for rapido boot
ddiss Nov 3, 2025
3bd19aa
rs/rapido-vm: add test_proc_version_parse
ddiss Nov 5, 2025
d88202f
rs/rapido-vm: test vm_resource_line_process return
ddiss Nov 5, 2025
b377751
cpio: accept reader for archive_file data
ddiss Nov 7, 2025
5395bdd
cpio: support archiving 0-length files via archive_path
ddiss Nov 7, 2025
471aa86
cpio: set rmajor and rminor for all entries
ddiss Nov 7, 2025
58e64db
cpio: add test_archive_file
ddiss Nov 7, 2025
5219ce0
rs/rapido-vm: fix x86-64 KERNEL_SRC bzImage path
ddiss Nov 7, 2025
8deacf6
rs/rapido-vm: clean up CONFIG -> QemuArgs parsing
ddiss Nov 7, 2025
72ce236
kmod-parser: introduce core kmodcontext structure and initialization
thackara Nov 3, 2025
f17c045
kmod-parser: implement load_hard_dependencies
thackara Nov 3, 2025
d913aa1
kmod-parser: implement load_soft_dependencies
thackara Nov 3, 2025
89d1c24
kmod-parser: implement load_weak_dependencies and load_builtin_modules
thackara Nov 3, 2025
884eded
kmod-parser: implement alias loading and lookup
thackara Nov 10, 2025
e1fdec4
kmod-parser: add main application logic and cli demo
thackara Nov 3, 2025
2e74d82
kmod-parser: add mod.rs to expose modules
thackara Nov 3, 2025
9690964
kmod-parser: integrate: kmod_context with rapido-cut
thackara Nov 3, 2025
7bb2612
kmod-parser: make module root dir mandatory
ddiss Nov 14, 2025
02347fa
kmod-parser: drop unused ModuleStatus::NotFound
ddiss Nov 14, 2025
a91d092
rs/rapido-vm: split out rapido::host_kernel_vers into lib
ddiss Nov 14, 2025
e990913
rs/rapido-cut: use host_kernel_vers helper
ddiss Nov 18, 2025
aacf933
kmod-parser: accept Path for KmodContext::new
ddiss Nov 19, 2025
479d0b8
lib.rs: add conf_src_or_host_kernel_vers
ddiss Nov 19, 2025
06681b8
rs/rapido-cut: filter out builtin kmods from all_deps
ddiss Nov 20, 2025
932b1e0
kmod-parser: store and use relative kmod paths
ddiss Nov 20, 2025
f2447a6
cpio: reword misalignment debug message
ddiss Nov 20, 2025
dfe5d15
kmod-parser: clean up read_lines() syntax
ddiss Nov 20, 2025
8996be7
kmod-parser: drop unnecessary path.exists() checks
ddiss Nov 20, 2025
df35704
rs/rapido-cut: fix KERNEL_INSTALL_MOD_PATH handling
ddiss Nov 20, 2025
35f981f
rs/rapido-cut: reduce kmod indentation
ddiss Nov 20, 2025
005aaff
rs/rapido-cut: stash kmod name ref instead of clone
ddiss Nov 21, 2025
28102c7
rs/rapido-cut: use HashSet for dup filters
ddiss Nov 21, 2025
3536345
kmod-parser: add a couple of TODOs
ddiss Nov 21, 2025
fa3ccf9
rs/rapido-cut: iterate kmods inline, instead of collect()ing
ddiss Nov 21, 2025
c7942e4
rs/rapido-cut: archive kmods inline for reproducibility
ddiss Nov 21, 2025
28fcf3a
rs/rapido-cut: archive kmod parent directories
ddiss Nov 21, 2025
cc492e8
rs/rapido-cut: clean up kmod_dst_root path handling
ddiss Nov 21, 2025
2948214
kmod-parser: include kernel module data files in initrd
thackara Nov 21, 2025
752d14c
rs/rapido-cut: move modules.* archiving out of loop
ddiss Nov 23, 2025
51a5578
rs/rapido-cut: drop modules.* is_file check
ddiss Nov 23, 2025
841c06b
kmod-parser: provide mod name via KmodModule.name()
ddiss Nov 24, 2025
5afc74d
kmod-parser: fail with duplicate dep/builtin modules
ddiss Nov 24, 2025
6b866bb
rs/rapido-cut: split kmods gathering out into a helper fn
ddiss Nov 24, 2025
5109ed6
rs/rapido-cut: split out bins and libs into helper fns
ddiss Nov 24, 2025
661feb5
rs/rapido-cut: --include data directory traversal
ddiss Nov 25, 2025
90565ee
rs/rapido-cut: install rapido-init at /init
ddiss Nov 25, 2025
9e1fb82
rs/rapido-cut: rework data gathering
ddiss Nov 26, 2025
d26411f
rs/rapido-cut: install rapido.conf by default
ddiss Nov 26, 2025
7c40f65
rs/rapido-cut: fix bin/lib symlink handling
ddiss Nov 26, 2025
05023d3
rs/rapido-cut: mock parent_dirs_amd in gather_archive_dirs()
ddiss Nov 26, 2025
9a54481
rapido-cut: install modules under /usr/lib/modules and symlink
ddiss Nov 26, 2025
a19195c
rapido-cut: use a vec for kmods and split out helper
ddiss Nov 27, 2025
67deb53
kmod-parser: add comment and test for replace(-,_) lookup
ddiss Nov 27, 2025
30d7e00
lib.rs: add vm_kmod_deps helper
ddiss Nov 27, 2025
db8d1d6
rapido-init: use new vm_kmod_deps helper
ddiss Nov 27, 2025
bb02c20
rapido-cut: install 9p, virtio_rng and net kmod deps
ddiss Nov 27, 2025
1db9788
rapido-cut: fix gather_archive_data directory recursion
ddiss Nov 28, 2025
ec0ae37
rapido-cut: search /bin, /sbin and systemd paths
ddiss Nov 28, 2025
82d2de8
rapido-cut: new --net param for network conf and dependencies
ddiss Nov 28, 2025
0bae18c
rapido-vm: start /init instead of /rapido-init
ddiss Nov 28, 2025
09c80a8
rapido-cut: add /lib64 -> usr/lib64 symlink
ddiss Nov 28, 2025
d027553
kmod-parser: return a KmodModule reference via find()
ddiss Nov 28, 2025
788ebbb
rapido-cut: add init dependencies
ddiss Nov 28, 2025
32c115b
rapido-cut: add preliminary autorun support
ddiss Nov 28, 2025
e9ce8ef
rapido-cut: use split_whitespace() for param parsing
ddiss Dec 2, 2025
dc5d60a
lib.rs: rename vm_kmod_deps -> conf_kmod_deps and test
ddiss Dec 2, 2025
c8f4f0f
lib.rs: split out conf_parse_from_defaults helper
ddiss Dec 2, 2025
faa707a
rapido-cut: accept --output parameter and consider DRACUT_OUT
ddiss Dec 2, 2025
451b5f1
dracut-cpio: drop unnecessary to_string()
ddiss Dec 2, 2025
e062aee
cut/simple_example: convert to use rapido-cut
ddiss Dec 2, 2025
1281c6d
cut/simple-network: convert to rapido-cut
ddiss Dec 3, 2025
c540432
rapido-cut: switch "archived X" messages to dout
ddiss Dec 3, 2025
9a90973
rapido-init: tweak systemd-networkd-wait-online error msg
ddiss Dec 3, 2025
54bf9bb
kmod-parser: fix formatting with rustfmt
thackara Dec 4, 2025
e1ce1fb
kmod-parser: track hard dependency paths
ddiss Dec 4, 2025
aa86961
kmod-parser: make rel_path a String
ddiss Dec 4, 2025
7038539
kmod-parser: correct Builtin module name reporting logic in main.rs
thackara Dec 4, 2025
1c97fbb
cpio: use Read instead of BufRead trait for ArchiveWalker
ddiss Dec 5, 2025
cab6e07
lsinitramfs: add simple tool for listing cpio contents
ddiss Dec 5, 2025
77f05c2
Cargo: drop authors entries
ddiss Dec 5, 2025
f9dadc9
lib: support RAPIDO_CONF environment variable
ddiss Dec 8, 2025
a0a5ec5
rapido-cut: improve error message if output open fails
ddiss Dec 8, 2025
b7d45ab
cut/simple_example: install cat
ddiss Dec 8, 2025
4d332f8
lib: ignore empty KERNEL_SRC and KERNEL_INSTALL_MOD_PATH
ddiss Dec 8, 2025
124548e
selftest: fix needle for rapido-cut script output
ddiss Dec 8, 2025
16a6e94
cut/simple: drop hardcoded rapido-cut and rapido-vm paths
ddiss Dec 9, 2025
c983f79
kmod-parser: check for normalized name in find()
ddiss Dec 9, 2025
db4c03a
rapido-init: mount tmpfs at /tmp
ddiss Dec 9, 2025
5c2cf4f
rapido-cut: add /bin -> /usr/bin default symlink
ddiss Dec 10, 2025
80ff8a9
cut/fstests_btrfs: convert from dracut to rapido-cut
ddiss Dec 10, 2025
20d73ba
cut/fstests_btrfs: normalize kmod names
ddiss Dec 10, 2025
d4245f9
kv-conf: test for line numbers in errors
ddiss Dec 10, 2025
f366c6e
kv-conf: unwrap Option for error string
ddiss Dec 10, 2025
2b30a6f
kv-conf: run rustfmt
ddiss Dec 10, 2025
36a1d89
rapido-cut: drop "--install src→dst" syntax
ddiss Dec 11, 2025
ef20b6b
lsinitramfs: don't print zero terminators / padding
ddiss Dec 11, 2025
9850b28
kmod-parser: ignore missing modules.weakdep
ddiss Dec 11, 2025
0950203
rapido-init: drop test_rapido_conf
ddiss Dec 11, 2025
33c04dc
rapido-cut: search /lib, /lib64, /bin and /sbin
ddiss Dec 15, 2025
99f4b0b
rapido-cut: rapido-vm: fix dracut based cut scripts
ddiss Dec 15, 2025
a5bcf28
rapido-cut: return Err instead of tracking missing
ddiss Dec 15, 2025
e9b4b63
rapido-cut: use an enum for Gather entries
ddiss Dec 15, 2025
bf0e968
rapido-cut: improve Gather enum use
ddiss Dec 15, 2025
8eefefc
rapido-cut: add and use GatherEnt::NameStatic
ddiss Dec 15, 2025
3094cb3
rapido-cut: drop some unnecessary muts
ddiss Dec 16, 2025
d32cda0
rapido-cut: add --try-install parameter
ddiss Dec 17, 2025
bf3d7e2
rapido-cut: switch NameDst from String to &str
ddiss Dec 17, 2025
1e579bf
rapido-cut: slightly simplify path_stat search
ddiss Dec 17, 2025
d2f8856
rapido-cut: move GatherEnt name lookup into path_stat
ddiss Dec 17, 2025
71b0c03
rapido-cut: add GatherEnt::LibRunPath type
ddiss Dec 17, 2025
5d7da33
rapido-cut: use ELF RUNPATH paths for library lookup
ddiss Dec 18, 2025
dd5152d
rapido-cut: add symlink for /sbin/modprobe
ddiss Dec 18, 2025
64aa63b
rapido-cut: drop /usr/lib64/systemd from LIB_PATHS
ddiss Dec 18, 2025
e1f591c
cut/fstests_btrfs: use --try-install for soft dependencies
ddiss Dec 18, 2025
b830112
cut/simple: move resize to --try-install
ddiss Dec 18, 2025
106ff83
src: support compilation with older rustc 1.85
ddiss Dec 18, 2025
261a7fe
rapido-cut: add /usr/lib/x86_64-linux-gnu to LIB_PATHS
ddiss Dec 18, 2025
dfd006d
github-ci: run rust tests and simple-network
ddiss Dec 18, 2025
4af6eda
github-ci: fix yaml
ddiss Dec 18, 2025
f96bf09
github-ci: chmod 0666 /dev/kvm to allow QEMU to use it
ddiss Dec 18, 2025
9c8f7b6
lsinitramfs: drop unused variable
ddiss Dec 18, 2025
ab6ce0b
lsinitramfs: rename to lscpio
ddiss Dec 18, 2025
d04bbcf
rapido-cut: rename --install-kmod param to --kmods
ddiss Dec 19, 2025
3b72ccd
kv-conf: rework kv_process to return kv tuple
ddiss Dec 19, 2025
0571a2d
kv-conf: avoid some unnecessary trim_start() calls
ddiss Dec 19, 2025
beda28e
kv-conf: fix and test for EOF before closing quote
ddiss Dec 23, 2025
87a61e6
kv-conf: drop io::Result return for kv_var_sub
ddiss Dec 23, 2025
71f0761
kv-conf: drop io::Result return for kv_process
ddiss Dec 23, 2025
d479647
kv-conf: add kv_conf_process_append_separate()
ddiss Dec 23, 2025
ea435f1
rapido-cut: split out parameter handler match fn
ddiss Dec 29, 2025
0daec5a
rapido-cut: add support for manifest files
ddiss Dec 29, 2025
12fcc62
rapido-cut: add unit test for manifest file handling
ddiss Dec 29, 2025
937694f
rapido-cut: use net manifest file instead of --net
ddiss Dec 29, 2025
9c6391c
rapido-cut: prepend /rapido-rsc/ include paths
ddiss Dec 30, 2025
d4392cb
rapido-vm: avoid double parsing rapido-rsc/cpu/X
ddiss Dec 30, 2025
f8943db
lib: drop conf_kmod_deps has_net parameter
ddiss Dec 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,38 @@ name: CI
on:
pull_request:

# "cargo" default package results in v1.75, which doesn't support v4 lock files
# "cargo test uses lib and bins only, as doc test breaks for some reason
# chmod vmlinuz-`uname -r` as it's 0600 by default
# chmod /dev/kvm to allow non-root QEMU to use it
jobs:
test:
runs-on: ubuntu-latest
container:
image: registry.opensuse.org/home/mkoutny/containers/opensuse_containers_tumbleweed_containers/rapido-ci:latest
env:
KERNEL_INSTALL_MOD_PATH: /usr/
options: -w /test
volumes:
- ${{ github.workspace }}:/test

steps:
- uses: actions/checkout@v4

- name: Run selftest
- name: install rust
run: |
KERNEL_RELEASE=$(cat /usr/src/linux-obj/x86_64/default/include/config/kernel.release) /test/selftest/selftest.sh

sudo apt-get update -y
sudo apt-get install -y --no-install-recommends --no-install-suggests cargo-1.85 rustc qemu-system-x86
- name: cargo test
run: |
cargo-1.85 test --offline --lib --bins
pushd src/cpio
cargo-1.85 test --offline --lib --bins
popd
pushd src/kv-conf/
cargo-1.85 test --offline --lib --bins
popd
- name: build and setup rapido net
run: |
cargo-1.85 build --offline --release
cp -r net-conf.example/ net-conf
touch rapido.conf
sudo EDITOR=cat ./rapido setup-network -o $USER -b rapido-br -a "192.168.155.10/24"
sudo chmod 0644 /boot/vmlinuz-*
sudo chmod 0666 /dev/kvm
- name: boot VM test
run: |
./rapido cut -B -x "ping -c3 192.168.155.10 && echo test passed; exit" simple-network
./target/release/lscpio initrds/myinitrd
./rapido boot
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ initrds/myinitrd
*~
*.pid
initrds/
target/
3 changes: 3 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Note: Rust source code (src/, excluding src/third_party) is GPL-2.0 OR
GPL-3.0 licensed (your choice). See per-file license headers.

----------------------------------------------------------------------

GNU LESSER GENERAL PUBLIC LICENSE
Expand Down
29 changes: 29 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "rapido"
description = "Quickly test Linux kernel changes"
# The following license covers the src directory, excluding third_party.
# SPDX-License-Identifier headers are attached to individual source files.
license = "(GPL-2.0 OR GPL-3.0)"
version = "0.1.0"
edition = "2018"
default-run = "rapido-cut"

# non-lib source for binaries is carried under src/bin/

[dependencies]
# internal
kv-conf = { path = "src/kv-conf" }
cpio = { path = "src/cpio" }

# minimal command line parameter passing
crosvm = { path = "src/third_party/crosvm" }
# Parse ELF to determine library dependencies. "std" provides file seek API.
elf = { default-features = false, features = ["std"], path = "src/third_party/rust-elf" }
# please avoid adding any more external dependencies
42 changes: 21 additions & 21 deletions cut/fstests_btrfs.sh
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
#!/bin/bash
# SPDX-License-Identifier: (LGPL-2.1 OR LGPL-3.0)
# Copyright (C) SUSE LLC 2018-2022, all rights reserved.
# Copyright (C) SUSE S.A. 2018-2025, all rights reserved.

RAPIDO_DIR="$(realpath -e ${0%/*})/.."
. "${RAPIDO_DIR}/runtime.vars"

_rt_require_dracut_args "$RAPIDO_DIR/autorun/lib/fstests.sh" \
"$RAPIDO_DIR/autorun/fstests_btrfs.sh" "$@"
_rt_require_fstests
req_inst=()
# rapido-cut doesn't support globbing, so do it here.
req_inst=(${FSTESTS_SRC}/ltp/* ${FSTESTS_SRC}/src/* \
${FSTESTS_SRC}/src/log-writes/* ${FSTESTS_SRC}/src/aio-dio-regress/*)
_rt_require_btrfs_progs req_inst
_rt_require_pam_mods req_inst "pam_rootok.so" "pam_limits.so"
_rt_human_size_in_b "${FSTESTS_ZRAM_SIZE:-1G}" zram_bytes \
|| _fail "failed to calculate memory resources"
# need enough memory for five zram devices
_rt_mem_resources_set "$((3072 + (zram_bytes * 5 / 1048576)))M"
mem_rsc="$((3072 + (zram_bytes * 5 / 1048576)))M"

"$DRACUT" --install "tail blockdev ps rmdir resize dd vim grep find df sha256sum \
PATH="target/release:${PATH}"
rapido-cut \
--autorun "autorun/lib/fstests.sh autorun/fstests_btrfs.sh $*" \
--include "dracut.conf.d/.empty /rapido-rsc/mem/${mem_rsc}" \
--install "ls cat mkdir cp mv rm ln sed readlink sleep \
umount findmnt dmesg uname \
tail blockdev ps rmdir resize dd grep find df sha256sum \
strace mkfs mkfs.ext4 e2fsck tune2fs shuf free ip su \
which perl awk bc touch cut chmod true false unlink \
mktemp getfattr setfattr chacl attr killall hexdump sync \
id sort uniq date expr tac diff head dirname seq \
basename tee egrep yes mkswap timeout realpath blkdiscard \
fstrim fio logger dmsetup chattr lsattr cmp stat \
dbench /usr/share/dbench/client.txt hostname getconf md5sum \
fstrim logger dmsetup chattr lsattr cmp stat \
hostname getconf md5sum \
od wc getfacl setfacl tr xargs sysctl link truncate quota \
repquota setquota quotacheck quotaon pvremove vgremove \
xfs_mkfile xfs_db xfs_io wipefs filefrag losetup \
chgrp du fgrep pgrep tar rev kill duperemove \
fsverity keyctl openssl /etc/ssl/openssl.cnf \
swapon swapoff xfs_freeze fsck ${req_inst[*]} \
${FSTESTS_SRC}/ltp/* ${FSTESTS_SRC}/src/* \
${FSTESTS_SRC}/src/log-writes/* \
${FSTESTS_SRC}/src/aio-dio-regress/*" \
--include "$FSTESTS_SRC" "$FSTESTS_SRC" \
--add-drivers "zram lzo lzo-rle dm-snapshot dm-flakey btrfs raid6_pq \
loop scsi_debug dm-log-writes xxhash_generic ext4 \
virtio_blk" \
--modules "base" \
"${DRACUT_RAPIDO_ARGS[@]}" \
"$DRACUT_OUT" || _fail "dracut failed"
chgrp du fgrep pgrep tar rev kill \
swapon swapoff xfs_freeze fsck ${req_inst[*]}" \
--try-install "resize dbench /usr/share/dbench/client.txt duperemove \
fsverity keyctl openssl /etc/ssl/openssl.cnf nano fio" \
--include "$FSTESTS_SRC $FSTESTS_SRC" \
--kmods "zram lzo lzo_rle dm_snapshot dm_flakey btrfs raid6_pq \
loop scsi_debug dm_log_writes xxhash_generic ext4 virtio_blk"
60 changes: 29 additions & 31 deletions cut/simple_example.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
#!/bin/bash
# SPDX-License-Identifier: (LGPL-2.1 OR LGPL-3.0)
# Copyright (C) SUSE LLC 2018-2021, all rights reserved.

RAPIDO_DIR="$(realpath -e ${0%/*})/.."
. "${RAPIDO_DIR}/runtime.vars"
# Copyright (C) SUSE S.A. 2018-2025, all rights reserved.

# The job of Rapido cut scripts is to generate a VM image. This is done using
# Dracut with a number of parameters...

# Call _rt_require_dracut_args() providing script paths that will be included
# and run on VM boot. It exports variables used in the dracut invocation below.
_rt_require_dracut_args "$RAPIDO_DIR/autorun/simple_example.sh" "$@"

# _rt_require_networking() flags that VMs using this image should have a network
# adapter. Binaries and configuration required for networking are appended to
# DRACUT_RAPIDO_ARGS.
#_rt_require_networking
# rapido-cut with a number of parameters...

# VMs are booted with 2 vCPUs and 512M RAM by default. These defaults can be
# changed, e.g. 1 vCPU + 1G RAM could be specified via:
#_rt_cpu_resources_set 1
#_rt_mem_resources_set 1G
# --autorun specifies script paths that will be installed and run (in order) on
# VM boot.

# --install provides a list of binaries that should be included in the VM image.
# Dracut will resolve shared object dependencies and add them automatically.

# --include copies a specific file or directory to the given image destination.

# --add-drivers provides a list of kernel modules, which will be obtained from
# the rapido.conf KERNEL_INSTALL_MOD_PATH

# --modules provides a list of *Dracut* modules. See Dracut documentation for
# details
"$DRACUT" \
--install "resize ps rmdir dd mkfs.xfs" \
--add-drivers "zram lzo lzo-rle" \
--modules "base" \
"${DRACUT_RAPIDO_ARGS[@]}" \
"$DRACUT_OUT" || _fail "dracut failed"
# --include copies a specific file or directory-tree to the given image
# destination. --try-install is similar but won't abort if missing.

# --kmods provides a list of kernel modules, which will be obtained from
# the rapido.conf KERNEL_INSTALL_MOD_PATH directory, or host kernel modules
# directory if unset.
PATH="target/release:${PATH}"
rapido-cut \
--autorun "autorun/simple_example.sh $*" \
--install "ls cat sleep ps rmdir dd mkfs.xfs" \
--try-install "resize" \
--kmods "zram lzo lzo_rle"

# rapido-cut writes the initramfs image to the rapido.conf DRACUT_OUT specified
# path, or an explicit path provided via --output parameter.

# rapido-vm boots images with 2 vCPUs and 512M RAM by default. These
# defaults can be changed, e.g. 1 vCPU + 1G RAM could be specified via:
#--include "dracut.conf.d/.empty /rapido-rsc/cpu/1"
#--include "dracut.conf.d/.empty /rapido-rsc/mem/1G"

# rapido VMs are not networked by default. To add networking configuration
# (see rapido.conf NET_CONF) and systemd-network dependencies to the image,
# a manifest/net.fest file is provided as a convenience. It can be used via:
#--manifest net.fest
23 changes: 9 additions & 14 deletions cut/simple_network.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
#!/bin/bash
# SPDX-License-Identifier: (LGPL-2.1 OR LGPL-3.0)
# Copyright (C) SUSE LLC 2022, all rights reserved.
# Copyright (C) SUSE S.A. 2022-2025, all rights reserved.

RAPIDO_DIR="$(realpath -e ${0%/*})/.."
. "${RAPIDO_DIR}/runtime.vars"

_rt_require_dracut_args "$RAPIDO_DIR/autorun/simple_network.sh" "$@"
_rt_require_networking
_rt_cpu_resources_set "1"
_rt_mem_resources_set "512M"

"$DRACUT" \
--install "resize ps nc hostname" \
--modules "base" \
"${DRACUT_RAPIDO_ARGS[@]}" \
"$DRACUT_OUT" || _fail "dracut failed"
PATH="target/release:${PATH}"
rapido-cut \
--autorun "autorun/simple_network.sh $*" \
--install "ps nc hostname cat ls" \
--try-install "resize" \
--manifest net.fest \
--include "dracut.conf.d/.empty /rapido-rsc/cpu/1" \
--include "dracut.conf.d/.empty /rapido-rsc/mem/512M"
12 changes: 12 additions & 0 deletions manifest/net.fest
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
install="udevadm systemd-udevd systemd-networkd systemd-networkd-wait-online ip
ping"

# the /rapido-rsc/net destination path is special in that it tells
# rapido-vm to also assign tap devices to the VM
include="${VM_NET_CONF} /rapido-rsc/net"

# rapido-init includes logic to bring up network.
# we could split it out and do something like:
#autorun="rapido-init-network"

kmods="virtio_net af_packet"
7 changes: 4 additions & 3 deletions rapido
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ rapido_setup_network()
# vm is an alias for boot
rapido_vm()
{
${RAPIDO_DIR}/vm.sh
rapido_boot
}

short_help["boot"]="Boot previously prepared test"
rapido_boot()
{
${RAPIDO_DIR}/vm.sh
PATH="target/release:${PATH}"
rapido-vm
}

cut_usage()
Expand Down Expand Up @@ -98,7 +99,7 @@ rapido_cut()
local cut_status=$?
[ $cut_status -ne 0 ] && exit $cut_status
[ -n "$boot_img" ] || exit 0
"${RAPIDO_DIR}/vm.sh"
rapido_boot
}

short_help["list"]="List testcases"
Expand Down
9 changes: 5 additions & 4 deletions runtime.vars
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,12 @@ _rt_require_dracut_args() {
# destination filename.
local init_src=$1 init_dst kver kmods=()

# Specify core init scripts responsible for starting autorun.
# The Dracut "cmdline" hook is executed prior to root parameter parsing.
# Specify core init responsible for starting autorun.
local env_src="$RAPIDO_DIR/vm_autorun.env"
local rinit_src="$RAPIDO_DIR/autorun/00-rapido-init.sh"
local rinit_dst="/lib/dracut/hooks/cmdline/00-rapido-init.sh"
local rinit_src="$RAPIDO_DIR/target/release/rapido-init"
[[ -f $rinit_src ]] \
|| _fail "$rinit_src missing. Build via: cargo build --release"
local rinit_dst="/rdinit"
local conf_src="$RAPIDO_CONF"
[[ -f $RAPIDO_CONF ]] || conf_src="${RAPIDO_DIR}/dracut.conf.d/.empty"
DRACUT_RAPIDO_ARGS+=(--include "$conf_src" /rapido.conf \
Expand Down
12 changes: 1 addition & 11 deletions selftest/test/002
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,7 @@ set timeout 60
spawn ./rapido cut -B simple-example
expect {
timeout {exit 1}
"*** Creating initramfs image file"
}
expect {
timeout {exit 1}
eof
}
# confirm that image was written at DRACUT_OUT path
spawn lsinitrd $::env(RAPIDO_SELFTEST_TMPDIR)/myinitrd
expect {
timeout {exit 1}
"Version: dracut"
"myinitrd written"
}
expect {
timeout {exit 1}
Expand Down
Loading