2021-03-16 15:11:00 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -x
|
|
|
|
|
2023-10-31 18:56:05 +00:00
|
|
|
# This set of vfio tests require to be ran on a specific machine with
|
|
|
|
# specific hardware (e.g. the "vfio" bera-metal worker equipped with a
|
|
|
|
# Nvidia Tesla T4 card). So the provisioning of the running machine is
|
|
|
|
# out of the scope of this script, including the custom guest image with
|
|
|
|
# Nvidia drivers installed, and properly configured Nvidia Tesla T4 card.
|
|
|
|
|
2021-03-16 15:11:00 +00:00
|
|
|
source $HOME/.cargo/env
|
|
|
|
source $(dirname "$0")/test-util.sh
|
|
|
|
|
|
|
|
process_common_args "$@"
|
|
|
|
|
2022-08-03 15:28:53 +00:00
|
|
|
WORKLOADS_DIR="$HOME/workloads"
|
2023-06-14 10:58:09 +00:00
|
|
|
|
2023-10-31 18:56:05 +00:00
|
|
|
# Always download the latest "hypervisor-fw"
|
2023-06-14 10:58:09 +00:00
|
|
|
FW_URL=$(curl --silent https://api.github.com/repos/cloud-hypervisor/rust-hypervisor-firmware/releases/latest | grep "browser_download_url" | grep -o 'https://.*[^ "]')
|
2022-08-03 15:28:53 +00:00
|
|
|
pushd $WORKLOADS_DIR
|
2023-10-31 18:56:05 +00:00
|
|
|
time wget --quiet $FW_URL -O hypervisor-fw || exit 1
|
2022-08-03 15:28:53 +00:00
|
|
|
popd
|
|
|
|
|
2021-03-16 15:11:00 +00:00
|
|
|
CFLAGS=""
|
|
|
|
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then
|
2023-10-19 22:08:39 +00:00
|
|
|
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
|
2021-03-16 15:11:00 +00:00
|
|
|
fi
|
|
|
|
|
2023-08-04 02:33:09 +00:00
|
|
|
cargo build --features mshv --all --release --target $BUILD_TARGET
|
2021-03-16 15:11:00 +00:00
|
|
|
|
2022-08-03 15:28:53 +00:00
|
|
|
export RUST_BACKTRACE=1
|
2023-10-31 18:56:05 +00:00
|
|
|
time cargo test "vfio::test_nvidia" -- --test-threads=1 ${test_binary_args[*]}
|
2021-03-16 15:11:00 +00:00
|
|
|
RES=$?
|
|
|
|
|
|
|
|
exit $RES
|