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