From 29f924405acb4704a984d8b51d99ed3a2ad83bc2 Mon Sep 17 00:00:00 2001 From: Muminul Islam Date: Thu, 18 Feb 2021 10:55:11 -0800 Subject: [PATCH] scripts: Check if windows image is in the host Currently script does not exit early if the image/firmware not present in the host. We should not progress further if the images are not pre downloaded. Signed-off-by: Muminul Islam --- scripts/run_integration_tests_windows.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/run_integration_tests_windows.sh b/scripts/run_integration_tests_windows.sh index ae03e89f3..f9c8daa38 100755 --- a/scripts/run_integration_tests_windows.sh +++ b/scripts/run_integration_tests_windows.sh @@ -10,6 +10,7 @@ features_build="" features_test="--features integration_tests" WIN_IMAGE_FILE="/root/workloads/windows-server-2019.raw" +OVMF_FW_FILE="/root/workloads/OVMF.fd" BUILD_TARGET="$(uname -m)-unknown-linux-${CH_LIBC}" CFLAGS="" TARGET_CC="" @@ -18,6 +19,12 @@ TARGET_CC="musl-gcc" CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/" fi +# Check if the images are present +if [[ ! -f ${WIN_IMAGE_FILE} || ! -f ${OVMF_FW_FILE} ]]; then + echo "Windows image/firmware not present in the host" + exit 1 +fi + # Use device mapper to create a snapshot of the Windows image img_blk_size=$(du -b -B 512 ${WIN_IMAGE_FILE} | awk '{print $1;}') loop_device=$(losetup --find --show --read-only ${WIN_IMAGE_FILE})