1#!/usr/bin/env bash 2set -x 3 4source $HOME/.cargo/env 5source $(dirname "$0")/test-util.sh 6 7WORKLOADS_DIR="$HOME/workloads" 8mkdir -p "$WORKLOADS_DIR" 9 10process_common_args "$@" 11 12# For now these values are default for kvm 13test_features="" 14 15if [ "$hypervisor" = "mshv" ] ; then 16 test_features="--features mshv" 17fi 18 19cp scripts/sha1sums-x86_64 $WORKLOADS_DIR 20 21FOCAL_OS_IMAGE_NAME="focal-server-cloudimg-amd64-custom-20210609-0.qcow2" 22FOCAL_OS_IMAGE_URL="https://cloud-hypervisor.azureedge.net/$FOCAL_OS_IMAGE_NAME" 23FOCAL_OS_IMAGE="$WORKLOADS_DIR/$FOCAL_OS_IMAGE_NAME" 24if [ ! -f "$FOCAL_OS_IMAGE" ]; then 25 pushd $WORKLOADS_DIR 26 time wget --quiet $FOCAL_OS_IMAGE_URL || exit 1 27 popd 28fi 29 30FOCAL_OS_RAW_IMAGE_NAME="focal-server-cloudimg-amd64-custom-20210609-0.raw" 31FOCAL_OS_RAW_IMAGE="$WORKLOADS_DIR/$FOCAL_OS_RAW_IMAGE_NAME" 32if [ ! -f "$FOCAL_OS_RAW_IMAGE" ]; then 33 pushd $WORKLOADS_DIR 34 time qemu-img convert -p -f qcow2 -O raw $FOCAL_OS_IMAGE_NAME $FOCAL_OS_RAW_IMAGE_NAME || exit 1 35 popd 36fi 37 38pushd $WORKLOADS_DIR 39grep focal sha1sums-x86_64 | sha1sum --check 40if [ $? -ne 0 ]; then 41 echo "sha1sum validation of images failed, remove invalid images to fix the issue." 42 exit 1 43fi 44popd 45 46build_custom_linux 47 48CFLAGS="" 49if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then 50 CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/" 51fi 52 53cargo build --features mshv --all --release --target $BUILD_TARGET 54 55export RUST_BACKTRACE=1 56time cargo test $test_features "rate_limiter::$test_filter" -- --test-threads=1 ${test_binary_args[*]} 57RES=$? 58 59exit $RES 60