2021-08-27 22:30:28 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -x
|
|
|
|
|
|
|
|
source $HOME/.cargo/env
|
|
|
|
source $(dirname "$0")/test-util.sh
|
|
|
|
|
|
|
|
WORKLOADS_DIR="$HOME/workloads"
|
|
|
|
mkdir -p "$WORKLOADS_DIR"
|
|
|
|
|
|
|
|
process_common_args "$@"
|
|
|
|
|
2022-01-06 22:36:24 +00:00
|
|
|
# For now these values are default for kvm
|
2022-11-24 13:06:53 +00:00
|
|
|
test_features=""
|
2021-08-27 22:30:28 +00:00
|
|
|
|
2021-09-23 21:56:15 +00:00
|
|
|
if [ "$hypervisor" = "mshv" ] ; then
|
2023-08-04 02:33:09 +00:00
|
|
|
test_features="--features mshv"
|
2021-09-23 21:56:15 +00:00
|
|
|
fi
|
|
|
|
|
2021-08-27 22:30:28 +00:00
|
|
|
cp scripts/sha1sums-x86_64 $WORKLOADS_DIR
|
|
|
|
|
|
|
|
FOCAL_OS_IMAGE_NAME="focal-server-cloudimg-amd64-custom-20210609-0.qcow2"
|
|
|
|
FOCAL_OS_IMAGE_URL="https://cloud-hypervisor.azureedge.net/$FOCAL_OS_IMAGE_NAME"
|
|
|
|
FOCAL_OS_IMAGE="$WORKLOADS_DIR/$FOCAL_OS_IMAGE_NAME"
|
|
|
|
if [ ! -f "$FOCAL_OS_IMAGE" ]; then
|
|
|
|
pushd $WORKLOADS_DIR
|
|
|
|
time wget --quiet $FOCAL_OS_IMAGE_URL || exit 1
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
FOCAL_OS_RAW_IMAGE_NAME="focal-server-cloudimg-amd64-custom-20210609-0.raw"
|
|
|
|
FOCAL_OS_RAW_IMAGE="$WORKLOADS_DIR/$FOCAL_OS_RAW_IMAGE_NAME"
|
|
|
|
if [ ! -f "$FOCAL_OS_RAW_IMAGE" ]; then
|
|
|
|
pushd $WORKLOADS_DIR
|
|
|
|
time qemu-img convert -p -f qcow2 -O raw $FOCAL_OS_IMAGE_NAME $FOCAL_OS_RAW_IMAGE_NAME || exit 1
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
pushd $WORKLOADS_DIR
|
|
|
|
grep focal sha1sums-x86_64 | sha1sum --check
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "sha1sum validation of images failed, remove invalid images to fix the issue."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
|
2022-04-13 18:33:22 +00:00
|
|
|
# Download Cloud Hypervisor binary from its last stable release
|
2023-08-13 00:18:41 +00:00
|
|
|
LAST_RELEASE_VERSION="v34.0"
|
2022-04-13 18:33:22 +00:00
|
|
|
CH_RELEASE_URL="https://github.com/cloud-hypervisor/cloud-hypervisor/releases/download/$LAST_RELEASE_VERSION/cloud-hypervisor-static"
|
|
|
|
CH_RELEASE_NAME="cloud-hypervisor-static"
|
|
|
|
pushd $WORKLOADS_DIR
|
|
|
|
time wget --quiet $CH_RELEASE_URL -O "$CH_RELEASE_NAME" || exit 1
|
|
|
|
chmod +x $CH_RELEASE_NAME
|
|
|
|
popd
|
|
|
|
|
2021-08-27 22:30:28 +00:00
|
|
|
# Build custom kernel based on virtio-pmem and virtio-fs upstream patches
|
|
|
|
VMLINUX_IMAGE="$WORKLOADS_DIR/vmlinux"
|
|
|
|
if [ ! -f "$VMLINUX_IMAGE" ]; then
|
2023-03-09 00:03:45 +00:00
|
|
|
build_custom_linux
|
2021-08-27 22:30:28 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
CFLAGS=""
|
|
|
|
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then
|
|
|
|
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
|
|
|
|
fi
|
|
|
|
|
2023-08-04 02:33:09 +00:00
|
|
|
cargo build --features mshv --all --release --target $BUILD_TARGET
|
2021-08-27 22:30:28 +00:00
|
|
|
|
2021-09-09 04:44:27 +00:00
|
|
|
# Test ovs-dpdk relies on hugepages
|
2023-03-07 06:28:02 +00:00
|
|
|
HUGEPAGESIZE=`grep Hugepagesize /proc/meminfo | awk '{print $2}'`
|
|
|
|
PAGE_NUM=`echo $((12288 * 1024 / $HUGEPAGESIZE))`
|
|
|
|
echo $PAGE_NUM | sudo tee /proc/sys/vm/nr_hugepages
|
2021-09-09 04:44:27 +00:00
|
|
|
sudo chmod a+rwX /dev/hugepages
|
|
|
|
|
|
|
|
export RUST_BACKTRACE=1
|
2022-11-24 13:06:53 +00:00
|
|
|
time cargo test $test_features "live_migration_parallel::$test_filter" -- ${test_binary_args[*]}
|
2021-08-27 22:30:28 +00:00
|
|
|
RES=$?
|
|
|
|
|
2022-08-16 19:03:45 +00:00
|
|
|
# Run some tests in sequence since the result could be affected by other tests
|
|
|
|
# running in parallel.
|
|
|
|
if [ $RES -eq 0 ]; then
|
|
|
|
export RUST_BACKTRACE=1
|
2022-11-24 13:06:53 +00:00
|
|
|
time cargo test $test_features "live_migration_sequential::$test_filter" -- --test-threads=1 ${test_binary_args[*]}
|
2022-08-16 19:03:45 +00:00
|
|
|
RES=$?
|
|
|
|
fi
|
|
|
|
|
2021-08-27 22:30:28 +00:00
|
|
|
exit $RES
|