scripts: skip downloads when workloads already exist

Add file-existence guards around firmware and OVMF download
calls in integration test scripts that were missing them.
Also guard prepare_linux() in test-util.sh so it returns
early when the kernel binary is already present.

This lets users pre-populate the workloads directory (e.g.
via CH_CUSTOM_KERNEL, CH_CUSTOM_FIRMWARE, CH_CUSTOM_OVMF)
and avoid redundant network fetches or source builds inside
the container.

Updated scripts:
- test-util.sh (prepare_linux early return)
- run_integration_tests_aarch64.sh
- run_integration_tests_vfio.sh
- run_integration_tests_windows_x86_64.sh
- run_integration_tests_windows_aarch64.sh

Assisted-by: GitHub Copilot:Claude-Opus-4.6

Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
Muminul Islam
2026-04-23 15:02:11 -07:00
committed by Rob Bradford
parent 00bee62653
commit c5e90a37e6
5 changed files with 24 additions and 4 deletions

View File

@@ -137,7 +137,9 @@ update_workloads() {
fi
# Download aarch64 ovmf
download_aarch64_ovmf
if [ ! -f "$WORKLOADS_DIR/CLOUDHV_EFI.fd" ]; then
download_aarch64_ovmf
fi
pushd "$WORKLOADS_DIR" || exit

View File

@@ -16,7 +16,9 @@ process_common_args "$@"
WORKLOADS_DIR="$HOME/workloads"
download_hypervisor_fw
if [ ! -f "$WORKLOADS_DIR/hypervisor-fw" ]; then
download_hypervisor_fw
fi
CFLAGS=""
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then

View File

@@ -20,7 +20,9 @@ WIN_IMAGE_FILE="$WORKLOADS_DIR/$WIN_IMAGE_BASENAME"
# Download aarch64 OVMF
OVMF_FW="$WORKLOADS_DIR/CLOUDHV_EFI.fd"
download_aarch64_ovmf
if [ ! -f "$OVMF_FW" ]; then
download_aarch64_ovmf
fi
# Check if the images are present
if [[ ! -f ${WIN_IMAGE_FILE} || ! -f ${OVMF_FW} ]]; then

View File

@@ -16,9 +16,12 @@ fi
WIN_IMAGE_FILE="/root/workloads/windows-server-2025-amd64-1.raw"
WORKLOADS_DIR="/root/workloads"
OVMF_FW="$WORKLOADS_DIR/CLOUDHV.fd"
# Download amd64 ovmf
download_amd64_ovmf
if [ ! -f "$OVMF_FW" ]; then
download_amd64_ovmf
fi
CFLAGS=""
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then

View File

@@ -187,6 +187,17 @@ download_linux() {
}
prepare_linux() {
if [ "$(uname -m)" = "aarch64" ]; then
KERNEL_FILE="$WORKLOADS_DIR/Image-arm64"
else
KERNEL_FILE="$WORKLOADS_DIR/vmlinux-x86_64"
BZIMAGE_FILE="$WORKLOADS_DIR/bzImage-x86_64"
fi
if [[ -f "$KERNEL_FILE" && -f "$BZIMAGE_FILE" ]]; then
echo "Kernel already present at $KERNEL_FILE, skipping"
return
fi
if [ "$build_kernel" = true ]; then
echo "Building kernel from source"
build_custom_linux