1#!/usr/bin/env bash 2set -x 3 4source $HOME/.cargo/env 5source $(dirname "$0")/test-util.sh 6source $(dirname "$0")/common-aarch64.sh 7 8process_common_args "$@" 9 10# aarch64 not supported for MSHV 11if [[ "$hypervisor" = "mshv" ]]; then 12 echo "AArch64 is not supported in Microsoft Hypervisor" 13 exit 1 14fi 15 16WIN_IMAGE_BASENAME="windows-11-iot-enterprise-aarch64.raw" 17WIN_IMAGE_FILE="$WORKLOADS_DIR/$WIN_IMAGE_BASENAME" 18 19# Checkout and build EDK2 20OVMF_FW="$WORKLOADS_DIR/CLOUDHV_EFI.fd" 21build_edk2 22 23# Check if the images are present 24if [[ ! -f ${WIN_IMAGE_FILE} || ! -f ${OVMF_FW} ]]; then 25 echo "Windows image/firmware not present in the host" 26 exit 1 27fi 28 29# Use device mapper to create a snapshot of the Windows image 30img_blk_size=$(du -b -B 512 ${WIN_IMAGE_FILE} | awk '{print $1;}') 31loop_device=$(losetup --find --show --read-only ${WIN_IMAGE_FILE}) 32dmsetup create windows-base --table "0 $img_blk_size linear $loop_device 0" 33dmsetup mknodes 34dmsetup create windows-snapshot-base --table "0 $img_blk_size snapshot-origin /dev/mapper/windows-base" 35dmsetup mknodes 36 37export RUST_BACKTRACE=1 38 39cargo build --all --release --target $BUILD_TARGET 40 41# Only run with 1 thread to avoid tests interfering with one another because 42# Windows has a static IP configured 43time cargo test "windows::$test_filter" --target $BUILD_TARGET -- ${test_binary_args[*]} 44RES=$? 45 46dmsetup remove_all -f 47losetup -D 48 49exit $RES 50