From e036ce66b92557fec998f499ec79c593f4768255 Mon Sep 17 00:00:00 2001 From: Disconnect3d Date: Thu, 22 May 2025 00:58:57 +0200 Subject: [PATCH] qemu-system-tests: fail early if kernel images weren't downloaded (#2991) --- tests/qemu-tests/tests.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/qemu-tests/tests.sh b/tests/qemu-tests/tests.sh index 4d349d8ce..63ac491fb 100755 --- a/tests/qemu-tests/tests.sh +++ b/tests/qemu-tests/tests.sh @@ -11,6 +11,16 @@ CWD=$(dirname -- "$0") IMAGE_DIR="${CWD}/images" VMLINUX_LIST=($(basename -a "${IMAGE_DIR}"/vmlinux*)) +# Ensure we have images directory and directories inside +if [ ! -d "$IMAGE_DIR" ]; then + echo "ERROR: The '$IMAGE_DIR' directory does not exist. Please run ./download_images.sh first" + exit 1 +fi +if [ "${VMLINUX_LIST}" = "vmlinux*" ]; then + echo "ERROR: The '$IMAGE_DIR' directory does not contain any kernel images. Please run ./download_images.sh first" + exit 1 +fi + ptrace_scope=$(cat /proc/sys/kernel/yama/ptrace_scope) if [[ $ptrace_scope -ne 0 && $(id -u) -ne 0 ]]; then cat << EOF