#!/bin/bash
# -*- shell-script -*-
# qemu-sanity-check
-# Copyright (C) 2013-2023 Red Hat Inc.
+# Copyright (C) 2013-2024 Red Hat Inc.
+# @configure_input@
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Locate kernel if not specified.
if [ -z "$kernel" ]; then
- kernel="$(ls -1dvr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen | head -1)"
+ shopt -s nullglob
+ if [ "$verbose" = "yes" ]; then
+ echo "all kernels:"
+ ls -1dvr /lib/modules/*/vmlinuz /boot/vmlinuz-*.$arch*
+ fi
+ kernel="$(ls -1dvr /lib/modules/*/vmlinuz /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen | head -1)"
if [ -z "$kernel" ]; then
echo "$0: cannot find a Linux kernel in /boot"
echo "Choose a kernel to test using --kernel=/path/to/vmlinuz"
exit 2
fi
+ shopt -u nullglob
fi
if [ ! -r "$kernel" ]; then
echo "$0: kernel $kernel is not readable"
# Locate qemu if not specified.
if [ -z "$qemu" ]; then
+ if [ "$verbose" = "yes" ]; then
+ echo "all qemus:" @QEMU_LIST@
+ fi
for q in @QEMU_LIST@; do
if "$q" --help >/dev/null 2>&1; then
qemu="$q"
cat "$test_output"
fi
+# Check if there was a kernel panic. Note that oops=panic is set
+# which will force a reboot for any oops condition.
+if grep -sq "Kernel panic - not syncing" "$test_output"; then
+ cat "$test_output"
+ echo "$0: error: test $kernel on $qemu: kernel panic seen"
+ rm "$test_output"
+ exit 1
+fi
+
# Verify that userspace was reached.
if ! grep -sq "initrd started up OK" "$test_output"; then
cat "$test_output"