xref: /cloud-hypervisor/scripts/run_integration_tests_windows_aarch64.sh (revision 2b2d00653cf0a31ebc9663875f39ce593f3f9b45)
191fe48d5SPhilipp Schuster#!/usr/bin/env bash
2*2b2d0065SRuslan Mstoi# shellcheck disable=SC2048,SC2086
376c04878SRob Bradfordset -x
476c04878SRob Bradford
5*2b2d0065SRuslan Mstoi# shellcheck source=/dev/null
6*2b2d0065SRuslan Mstoisource "$HOME"/.cargo/env
7*2b2d0065SRuslan Mstoisource "$(dirname "$0")"/test-util.sh
8*2b2d0065SRuslan Mstoisource "$(dirname "$0")"/common-aarch64.sh
927b5f8d7SMuminul Islam
1027b5f8d7SMuminul Islamprocess_common_args "$@"
1176c04878SRob Bradford
12944d0920SAnatol Belski# aarch64 not supported for MSHV
13944d0920SAnatol Belskiif [[ "$hypervisor" = "mshv" ]]; then
14944d0920SAnatol Belski    echo "AArch64 is not supported in Microsoft Hypervisor"
15944d0920SAnatol Belski    exit 1
168739f6ccSMuminul Islamfi
17eea2907dSRob Bradford
18944d0920SAnatol BelskiWIN_IMAGE_BASENAME="windows-11-iot-enterprise-aarch64.raw"
19944d0920SAnatol BelskiWIN_IMAGE_FILE="$WORKLOADS_DIR/$WIN_IMAGE_BASENAME"
20944d0920SAnatol Belski
21944d0920SAnatol Belski# Checkout and build EDK2
22944d0920SAnatol BelskiOVMF_FW="$WORKLOADS_DIR/CLOUDHV_EFI.fd"
23944d0920SAnatol Belskibuild_edk2
24eea2907dSRob Bradford
2529f92440SMuminul Islam# Check if the images are present
26eea2907dSRob Bradfordif [[ ! -f ${WIN_IMAGE_FILE} || ! -f ${OVMF_FW} ]]; then
2729f92440SMuminul Islam    echo "Windows image/firmware not present in the host"
2829f92440SMuminul Islam    exit 1
2929f92440SMuminul Islamfi
3029f92440SMuminul Islam
313b43551dSSebastien Boeuf# Use device mapper to create a snapshot of the Windows image
32*2b2d0065SRuslan Mstoiimg_blk_size=$(du -b -B 512 "${WIN_IMAGE_FILE}" | awk '{print $1;}')
33*2b2d0065SRuslan Mstoiloop_device=$(losetup --find --show --read-only "${WIN_IMAGE_FILE}")
343b43551dSSebastien Boeufdmsetup create windows-base --table "0 $img_blk_size linear $loop_device 0"
353b43551dSSebastien Boeufdmsetup mknodes
363b43551dSSebastien Boeufdmsetup create windows-snapshot-base --table "0 $img_blk_size snapshot-origin /dev/mapper/windows-base"
373b43551dSSebastien Boeufdmsetup mknodes
383b43551dSSebastien Boeuf
39944d0920SAnatol Belskiexport RUST_BACKTRACE=1
40944d0920SAnatol Belski
41*2b2d0065SRuslan Mstoicargo build --all --release --target "$BUILD_TARGET"
4276c04878SRob Bradford
432902a96aSWei Liu# Only run with 1 thread to avoid tests interfering with one another because
442902a96aSWei Liu# Windows has a static IP configured
45*2b2d0065SRuslan Mstoitime cargo test "windows::$test_filter" --target "$BUILD_TARGET" -- ${test_binary_args[*]}
4676c04878SRob BradfordRES=$?
4776c04878SRob Bradford
483b43551dSSebastien Boeufdmsetup remove_all -f
493b43551dSSebastien Boeuflosetup -D
503b43551dSSebastien Boeuf
5176c04878SRob Bradfordexit $RES
52