Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add KVM tests with uhyve, qemu and firecracker #895

Merged
merged 4 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
80 changes: 80 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,83 @@ jobs:
sleep 5
curl http://127.0.0.1:9975/help
sleep 1

run-x86_64-kvm:
name: Run Hermit for Rust (x86_64 + kvm)
runs-on: [self-hosted]
steps:
- name: Install QEMU, NASM
run: |
sudo apt-get update
sudo apt-get install qemu-system-x86 nasm
- name: Checkout hermit-rs
uses: actions/checkout@v4
with:
repository: hermitcore/hermit-rs
submodules: true
- name: Remove hermit-kernel submodule
run: git rm -r kernel
- name: Checkout hermit-kernel
uses: actions/checkout@v4
with:
path: kernel
- uses: mkroening/rust-toolchain-toml@main
- uses: Swatinem/rust-cache@v2
- name: Build dev profile
run: cargo build -Zbuild-std=std,panic_abort --package rusty_demo --target x86_64-unknown-hermit
- name: Download loader (x86_64)
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
repo: hermitcore/rusty-loader
file: rusty-loader-x86_64
- name: Install uhyve
run: cargo +stable install --locked uhyve
- name: Check KVM availability
shell: bash
run: |
lscpu
kvm-ok
- name: Test debug version (Uhyve)
run: uhyve --verbose -c 1 target/x86_64-unknown-hermit/debug/rusty_demo
env:
RUST_LOG: debug
- name: Test debug profile (Qemu)
run: |
qemu-system-x86_64 -display none -smp 1 -m 128M -serial stdio \
-enable-kvm -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \
-kernel rusty-loader-x86_64 \
-initrd target/x86_64-unknown-hermit/debug/rusty_demo
- name: Build release profile
run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package rusty_demo --release
- name: Test release version (Uhyve)
run: uhyve --verbose -c 1 target/x86_64-unknown-hermit/release/rusty_demo
env:
RUST_LOG: debug
- name: Test release profile (Qemu)
run: |
qemu-system-x86_64 -display none -smp 1 -m 128M -serial stdio \
-enable-kvm -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \
-kernel rusty-loader-x86_64 \
-initrd target/x86_64-unknown-hermit/release/rusty_demo
- name: Download loader (x86_64-fc)
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
repo: hermitcore/rusty-loader
file: rusty-loader-x86_64-fc
- name: Download firecracker
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
repo: firecracker-microvm/firecracker
version: tags/v1.4.1
file: firecracker-v1.4.1-x86_64.tgz
target: 'firecracker-x86_64.tgz'
- name: Install firecracker
run: |
tar xzvf firecracker-x86_64.tgz --one-top-level=fc --strip-components 1
- name: Build minimal profile (debug)
run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --no-default-features --package hello_world
- name: Test debug profile (Firecracker)
run: |
./fc/firecracker-v1.4.1-x86_64 --no-api --config-file ./kernel/fc-config.json &
sleep 1
kill -KILL $(pidof firecracker-v1.4.1-x86_64)
13 changes: 13 additions & 0 deletions fc-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"boot-source": {
"kernel_image_path": "./rusty-loader-x86_64-fc",
"initrd_path": "target/x86_64-unknown-hermit/debug/hello_world",
"boot_args": ""
},
"drives": [],
"machine-config": {
"vcpu_count": 1,
"mem_size_mib": 256,
"smt": false
}
}