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