From f391a37a35b8c32dcb32458637a85495fd807235 Mon Sep 17 00:00:00 2001 From: Muminul Islam Date: Sun, 19 Oct 2025 13:38:00 -0700 Subject: [PATCH] scripts: add common image download code to utility script X64_64 image download steps is being used for both regular and CVM guest. Keeping the steps withing a function in the test-util.sh Signed-off-by: Muminul Islam --- scripts/run_integration_tests_x86_64.sh | 34 +---------------------- scripts/test-util.sh | 37 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/scripts/run_integration_tests_x86_64.sh b/scripts/run_integration_tests_x86_64.sh index 31d3965c2..225914050 100755 --- a/scripts/run_integration_tests_x86_64.sh +++ b/scripts/run_integration_tests_x86_64.sh @@ -28,39 +28,7 @@ if [ ! -f "$WORKLOADS_DIR/CLOUDHV.fd" ]; then download_ovmf fi -FOCAL_OS_IMAGE_NAME="focal-server-cloudimg-amd64-custom-20210609-0.qcow2" -FOCAL_OS_IMAGE_URL="https://ch-images.azureedge.net/$FOCAL_OS_IMAGE_NAME" -FOCAL_OS_IMAGE="$WORKLOADS_DIR/$FOCAL_OS_IMAGE_NAME" -if [ ! -f "$FOCAL_OS_IMAGE" ]; then - pushd "$WORKLOADS_DIR" || exit - time wget --quiet $FOCAL_OS_IMAGE_URL || exit 1 - popd || exit -fi - -FOCAL_OS_RAW_IMAGE_NAME="focal-server-cloudimg-amd64-custom-20210609-0.raw" -FOCAL_OS_RAW_IMAGE="$WORKLOADS_DIR/$FOCAL_OS_RAW_IMAGE_NAME" -if [ ! -f "$FOCAL_OS_RAW_IMAGE" ]; then - pushd "$WORKLOADS_DIR" || exit - time qemu-img convert -p -f qcow2 -O raw $FOCAL_OS_IMAGE_NAME $FOCAL_OS_RAW_IMAGE_NAME || exit 1 - popd || exit -fi - -JAMMY_OS_IMAGE_NAME="jammy-server-cloudimg-amd64-custom-20241017-0.qcow2" -JAMMY_OS_IMAGE_URL="https://ch-images.azureedge.net/$JAMMY_OS_IMAGE_NAME" -JAMMY_OS_IMAGE="$WORKLOADS_DIR/$JAMMY_OS_IMAGE_NAME" -if [ ! -f "$JAMMY_OS_IMAGE" ]; then - pushd "$WORKLOADS_DIR" || exit - time wget --quiet $JAMMY_OS_IMAGE_URL || exit 1 - popd || exit -fi - -JAMMY_OS_RAW_IMAGE_NAME="jammy-server-cloudimg-amd64-custom-20241017-0.raw" -JAMMY_OS_RAW_IMAGE="$WORKLOADS_DIR/$JAMMY_OS_RAW_IMAGE_NAME" -if [ ! -f "$JAMMY_OS_RAW_IMAGE" ]; then - pushd "$WORKLOADS_DIR" || exit - time qemu-img convert -p -f qcow2 -O raw $JAMMY_OS_IMAGE_NAME $JAMMY_OS_RAW_IMAGE_NAME || exit 1 - popd || exit -fi +download_x86_guest_images JAMMY_OS_QCOW_ZLIB_FILE_IMAGE_NAME="jammy-server-cloudimg-amd64-custom-20241017-0-zlib.qcow2" JAMMY_OS_QCOW_ZLIB_FILE_IMAGE="$WORKLOADS_DIR/$JAMMY_OS_QCOW_ZLIB_FILE_IMAGE_NAME" diff --git a/scripts/test-util.sh b/scripts/test-util.sh index 5c49dcae6..035084eef 100644 --- a/scripts/test-util.sh +++ b/scripts/test-util.sh @@ -301,3 +301,40 @@ copy_to_image() { mount_and_exec "$IMG" "$MOUNT_DIR" /bin/bash -c "$COPY_COMMAND" return $? } + +# Download x86 guest images (Focal and Jammy) +download_x86_guest_images() { + FOCAL_OS_IMAGE_NAME="focal-server-cloudimg-amd64-custom-20210609-0.qcow2" + FOCAL_OS_IMAGE_URL="https://ch-images.azureedge.net/$FOCAL_OS_IMAGE_NAME" + FOCAL_OS_IMAGE="$WORKLOADS_DIR/$FOCAL_OS_IMAGE_NAME" + if [ ! -f "$FOCAL_OS_IMAGE" ]; then + pushd "$WORKLOADS_DIR" || exit + time wget --quiet $FOCAL_OS_IMAGE_URL || exit 1 + popd || exit + fi + + FOCAL_OS_RAW_IMAGE_NAME="focal-server-cloudimg-amd64-custom-20210609-0.raw" + FOCAL_OS_RAW_IMAGE="$WORKLOADS_DIR/$FOCAL_OS_RAW_IMAGE_NAME" + if [ ! -f "$FOCAL_OS_RAW_IMAGE" ]; then + pushd "$WORKLOADS_DIR" || exit + time qemu-img convert -p -f qcow2 -O raw $FOCAL_OS_IMAGE_NAME $FOCAL_OS_RAW_IMAGE_NAME || exit 1 + popd || exit + fi + + JAMMY_OS_IMAGE_NAME="jammy-server-cloudimg-amd64-custom-20241017-0.qcow2" + JAMMY_OS_IMAGE_URL="https://ch-images.azureedge.net/$JAMMY_OS_IMAGE_NAME" + JAMMY_OS_IMAGE="$WORKLOADS_DIR/$JAMMY_OS_IMAGE_NAME" + if [ ! -f "$JAMMY_OS_IMAGE" ]; then + pushd "$WORKLOADS_DIR" || exit + time wget --quiet $JAMMY_OS_IMAGE_URL || exit 1 + popd || exit + fi + + JAMMY_OS_RAW_IMAGE_NAME="jammy-server-cloudimg-amd64-custom-20241017-0.raw" + JAMMY_OS_RAW_IMAGE="$WORKLOADS_DIR/$JAMMY_OS_RAW_IMAGE_NAME" + if [ ! -f "$JAMMY_OS_RAW_IMAGE" ]; then + pushd "$WORKLOADS_DIR" || exit + time qemu-img convert -p -f qcow2 -O raw $JAMMY_OS_IMAGE_NAME $JAMMY_OS_RAW_IMAGE_NAME || exit 1 + popd || exit + fi +}