ci: don't hang on kernel crashes in qemu

Backport of kernel-patches PR ([0]), done by @thefallentree.

  [0] https://github.com/kernel-patches/vmtest/pull/29

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
This commit is contained in:
Andrii Nakryiko
2021-08-30 11:43:50 -07:00
committed by Andrii Nakryiko
parent 8bdc267e7b
commit c92a5d043e

View File

@@ -459,10 +459,10 @@ if kvm-ok ; then
else else
accel="-cpu qemu64 -machine accel=tcg" accel="-cpu qemu64 -machine accel=tcg"
fi fi
qemu-system-x86_64 -nodefaults -display none -serial mon:stdio \ qemu-system-x86_64 -nodefaults -display none -serial mon:stdio -no-reboot \
${accel} -smp "$(nproc)" -m 4G \ ${accel} -smp "$(nproc)" -m 4G \
-drive file="$IMG",format=raw,index=1,media=disk,if=virtio,cache=none \ -drive file="$IMG",format=raw,index=1,media=disk,if=virtio,cache=none \
-kernel "$vmlinuz" -append "root=/dev/vda rw console=ttyS0,115200$APPEND" -kernel "$vmlinuz" -append "root=/dev/vda rw console=ttyS0,115200 kernel.panic=-1 $APPEND"
sudo mount -o loop "$IMG" "$mnt" sudo mount -o loop "$IMG" "$mnt"
if exitstatus="$(cat "$mnt/exitstatus" 2>/dev/null)"; then if exitstatus="$(cat "$mnt/exitstatus" 2>/dev/null)"; then
printf '\nTests exit status: %s\n' "$exitstatus" >&2 printf '\nTests exit status: %s\n' "$exitstatus" >&2