smoke-test.tcl: Add smoke test

Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
This commit is contained in:
2026-03-24 10:31:38 +08:00
parent f36b476390
commit 205dca7a45
3 changed files with 66 additions and 1 deletions

View File

@@ -19,6 +19,8 @@ jobs:
run: docker build -t buildenv .
- name: Build
run: docker run --rm -v "$(pwd):$(pwd)" -w "$(pwd)" buildenv ./build.sh
- name: Smoke test
run: docker run --rm -v "$(pwd):$(pwd)" -w "$(pwd)" buildenv ./smoke-test.tcl
- name: Upload
uses: actions/upload-artifact@v7
with:

View File

@@ -1,2 +1,2 @@
FROM fedora
RUN dnf install -y cpio dnf5 kmod
RUN dnf install -y cpio dnf5 kmod expect qemu-system-riscv

63
smoke-test.tcl Executable file
View File

@@ -0,0 +1,63 @@
#!/usr/bin/env expect
exec sh -c "exec cat out/openruyi-base.* out/openruyi-linux-modules-* > initramfs.img"
proc abort {} {
send_error "Timeout!"
exit 1
}
set timeout 30
spawn sh -c {
exec qemu-system-riscv64 \
-nographic \
-M virt -m 4G -cpu rva23s64 \
-device virtio-gpu-pci \
-kernel out/openruyi-linux-core-* \
-initrd initramfs.img
}
expect {
timeout abort
"Run /init as init process"
}
expect {
timeout abort
"Welcome to openRuyi"
}
expect {
timeout abort
"virtio-gpu-pci" {
sleep 1
send "\n"
}
}
expect {
timeout abort
"# " { send "\n" }
}
expect {
timeout abort
"# " { send "lsmod\n" }
}
expect {
timeout abort
"virtio_gpu"
}
expect {
timeout abort
"# " { send "poweroff\n" }
}
expect {
timeout abort
"Power down"
}
interact