2023-12-15 20:33:46 +00:00
|
|
|
#!/usr/bin/env bash
|
2024-01-29 15:38:44 +00:00
|
|
|
# shellcheck disable=SC2048,SC2086
|
2020-10-08 14:11:18 +00:00
|
|
|
set -x
|
|
|
|
|
2024-01-29 15:38:44 +00:00
|
|
|
# shellcheck source=/dev/null
|
|
|
|
source "$HOME"/.cargo/env
|
|
|
|
source "$(dirname "$0")"/test-util.sh
|
|
|
|
source "$(dirname "$0")"/common-aarch64.sh
|
2020-11-18 00:37:27 +00:00
|
|
|
|
|
|
|
process_common_args "$@"
|
2020-10-08 14:11:18 +00:00
|
|
|
|
2022-08-03 21:52:53 +00:00
|
|
|
# aarch64 not supported for MSHV
|
|
|
|
if [[ "$hypervisor" = "mshv" ]]; then
|
|
|
|
echo "AArch64 is not supported in Microsoft Hypervisor"
|
|
|
|
exit 1
|
2021-12-06 17:45:17 +00:00
|
|
|
fi
|
|
|
|
|
2022-08-03 21:52:53 +00:00
|
|
|
WIN_IMAGE_BASENAME="windows-11-iot-enterprise-aarch64.raw"
|
|
|
|
WIN_IMAGE_FILE="$WORKLOADS_DIR/$WIN_IMAGE_BASENAME"
|
|
|
|
|
|
|
|
# Checkout and build EDK2
|
|
|
|
OVMF_FW="$WORKLOADS_DIR/CLOUDHV_EFI.fd"
|
|
|
|
build_edk2
|
|
|
|
|
2021-02-18 18:55:11 +00:00
|
|
|
# Check if the images are present
|
2021-12-06 17:45:17 +00:00
|
|
|
if [[ ! -f ${WIN_IMAGE_FILE} || ! -f ${OVMF_FW} ]]; then
|
2021-02-18 18:55:11 +00:00
|
|
|
echo "Windows image/firmware not present in the host"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-01-12 10:03:28 +00:00
|
|
|
# Use device mapper to create a snapshot of the Windows image
|
2024-01-29 15:38:44 +00:00
|
|
|
img_blk_size=$(du -b -B 512 "${WIN_IMAGE_FILE}" | awk '{print $1;}')
|
|
|
|
loop_device=$(losetup --find --show --read-only "${WIN_IMAGE_FILE}")
|
2021-01-12 10:03:28 +00:00
|
|
|
dmsetup create windows-base --table "0 $img_blk_size linear $loop_device 0"
|
|
|
|
dmsetup mknodes
|
|
|
|
dmsetup create windows-snapshot-base --table "0 $img_blk_size snapshot-origin /dev/mapper/windows-base"
|
|
|
|
dmsetup mknodes
|
|
|
|
|
2022-08-03 21:52:53 +00:00
|
|
|
export RUST_BACKTRACE=1
|
|
|
|
|
2024-01-29 15:38:44 +00:00
|
|
|
cargo build --all --release --target "$BUILD_TARGET"
|
2020-10-08 14:11:18 +00:00
|
|
|
|
2020-10-21 22:31:01 +00:00
|
|
|
# Only run with 1 thread to avoid tests interfering with one another because
|
|
|
|
# Windows has a static IP configured
|
2024-01-29 15:38:44 +00:00
|
|
|
time cargo test "windows::$test_filter" --target "$BUILD_TARGET" -- ${test_binary_args[*]}
|
2020-10-08 14:11:18 +00:00
|
|
|
RES=$?
|
|
|
|
|
2021-01-12 10:03:28 +00:00
|
|
|
dmsetup remove_all -f
|
|
|
|
losetup -D
|
|
|
|
|
2020-10-08 14:11:18 +00:00
|
|
|
exit $RES
|