src/tests: Update standardized qemu testing script
* Adds riscv64 * Improves serial output to virtual console and on-disk logs * Add log check for kernel load Change-Id: If66cd3b9d342953b71d2362de1003d8e7547e6ae
This commit is contained in:
parent
6f2e83ce65
commit
4ae0376c1f
@ -2,9 +2,16 @@
|
||||
#
|
||||
# A quick standard test of Haiku booting under qemu in various configurations
|
||||
#
|
||||
# Example usages:
|
||||
# x86_64 bios
|
||||
# ../src/tests/qemu-boot-test x86_64 bios haiku-nightly-anyboot.iso
|
||||
# x86_64 efi
|
||||
# ../src/tests/qemu-boot-test x86_64 efi haiku-nightly-anyboot.iso
|
||||
# riscv64 opensbi w/u-boot payload
|
||||
# ../src/tests/qemu-boot-test riscv64 kernel:~/Code/firmware/u-boot/riscv64/qemu/u-boot.bin haiku-mmc.image
|
||||
|
||||
if [ $# -lt 3 ]; then
|
||||
echo "Usage: $0 <arch> <bios|efi> <image>"
|
||||
echo "Usage: $0 <arch> <bios|efi|bios:(file)|kernel:(file)> <image>"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
@ -12,10 +19,18 @@ ARCH=$1
|
||||
PLATFORM=$2
|
||||
IMAGE=$3
|
||||
EMULATOR=qemu-system-$ARCH
|
||||
EXTRAS=""
|
||||
EXTRAS="-parallel none"
|
||||
|
||||
function check_logs {
|
||||
FILE=$1
|
||||
echo -n " Haiku kernel loaded: "
|
||||
# First output from kernel on boot
|
||||
if grep -q "Welcome to kernel debugger output" $FILE; then
|
||||
echo "YES"
|
||||
else
|
||||
echo "NO"
|
||||
fi
|
||||
# Checking for a KDL
|
||||
echo -n " Potential KDL Detected: "
|
||||
if grep -q "kdebug>" $FILE; then
|
||||
echo "YES"
|
||||
@ -27,15 +42,24 @@ function check_logs {
|
||||
}
|
||||
|
||||
case "$PLATFORM" in
|
||||
"bios")
|
||||
bios)
|
||||
EXTRAS="$EXTRAS"
|
||||
;;
|
||||
"efi")
|
||||
EXTRAS="$EXTRAS -bios /usr/share/edk2/ovmf/OVMF_CODE.fd"
|
||||
;;
|
||||
;;
|
||||
efi)
|
||||
eval BIOS="${EFI_BIOS}:-/usr/share/edk2/ovmf/OVMF_CODE.fd"
|
||||
EXTRAS="$EXTRAS -bios $QEMU_BIOS"
|
||||
;;
|
||||
bios:*)
|
||||
eval BIOS=$(echo "$PLATFORM" | cut -d":" -f2)
|
||||
EXTRAS="$EXTRAS -bios $BIOS"
|
||||
;;
|
||||
kernel:*)
|
||||
eval BIOS=$(echo "$PLATFORM" | cut -d":" -f2)
|
||||
EXTRAS="$EXTRAS -kernel $BIOS"
|
||||
;;
|
||||
*)
|
||||
EXTRAS="$EXTRAS"
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "We're going to step through the potential boot options for $ARCH under qemu"
|
||||
@ -43,14 +67,16 @@ echo ""
|
||||
echo -n "Press enter to begin..."
|
||||
read
|
||||
|
||||
TEST_SERIALLOG="/tmp/test-$ARCH-serial.mon"
|
||||
EXTRAS="$EXTRAS -chardev vc,id=serial,logfile=$TEST_SERIALLOG,signal=off -serial chardev:serial"
|
||||
> $TEST_SERIALLOG
|
||||
|
||||
case "$ARCH" in
|
||||
"x86" | "x86_64")
|
||||
MEMORY=2048
|
||||
TEST_FILE="/tmp/test-$ARCH.iso"
|
||||
TEST_SERIALLOG="/tmp/test-$ARCH-serial.mon"
|
||||
EXTRAS="$EXTRAS -serial file:$TEST_SERIALLOG"
|
||||
EMULATOR="$EMULATOR --enable-kvm -m $MEMORY $EXTRAS"
|
||||
rm -f $TEST_FILE $TEST_SERIALLOG
|
||||
rm -f $TEST_FILE
|
||||
|
||||
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
||||
echo "+++ Testing $PLATFORM CDROM boot..."
|
||||
@ -73,6 +99,19 @@ case "$ARCH" in
|
||||
check_logs $TEST_SERIALLOG
|
||||
rm -f $TEST_FILE $TEST_SERIALLOG
|
||||
;;
|
||||
"riscv64")
|
||||
MEMORY=2048
|
||||
TEST_FILE="/tmp/test-$ARCH.mmu"
|
||||
EMULATOR="$EMULATOR -m $MEMORY -M virt $EXTRAS"
|
||||
rm -f $TEST_FILE $TEST_SERIALLOG
|
||||
|
||||
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
||||
echo "+++ Testing $PLATFORM boot..."
|
||||
cp $IMAGE $TEST_FILE
|
||||
$EMULATOR -device virtio-gpu -drive file=$TEST_FILE,format=raw,if=virtio
|
||||
check_logs $TEST_SERIALLOG
|
||||
rm -f $TEST_FILE $TEST_SERIALLOG
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown architecture!"
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user