2023-12-15 20:33:46 +00:00
|
|
|
#!/usr/bin/env bash
|
2024-01-29 15:38:44 +00:00
|
|
|
# shellcheck disable=SC2048,SC2086
|
2021-08-27 22:30:28 +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
|
2021-08-27 22:30:28 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2024-01-26 15:30:32 +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
|
|
|
|
|
2024-01-29 15:38:44 +00:00
|
|
|
cp scripts/sha1sums-x86_64 "$WORKLOADS_DIR"
|
2021-08-27 22:30:28 +00:00
|
|
|
|
|
|
|
FOCAL_OS_IMAGE_NAME="focal-server-cloudimg-amd64-custom-20210609-0.qcow2"
|
2024-02-28 09:51:10 +00:00
|
|
|
FOCAL_OS_IMAGE_URL="https://ch-images.azureedge.net/$FOCAL_OS_IMAGE_NAME"
|
2021-08-27 22:30:28 +00:00
|
|
|
FOCAL_OS_IMAGE="$WORKLOADS_DIR/$FOCAL_OS_IMAGE_NAME"
|
|
|
|
if [ ! -f "$FOCAL_OS_IMAGE" ]; then
|
2024-01-29 15:38:44 +00:00
|
|
|
pushd "$WORKLOADS_DIR" || exit
|
2021-08-27 22:30:28 +00:00
|
|
|
time wget --quiet $FOCAL_OS_IMAGE_URL || exit 1
|
2024-01-29 15:38:44 +00:00
|
|
|
popd || exit
|
2021-08-27 22:30:28 +00:00
|
|
|
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
|
2024-01-29 15:38:44 +00:00
|
|
|
pushd "$WORKLOADS_DIR" || exit
|
2021-08-27 22:30:28 +00:00
|
|
|
time qemu-img convert -p -f qcow2 -O raw $FOCAL_OS_IMAGE_NAME $FOCAL_OS_RAW_IMAGE_NAME || exit 1
|
2024-01-29 15:38:44 +00:00
|
|
|
popd || exit
|
2021-08-27 22:30:28 +00:00
|
|
|
fi
|
|
|
|
|
2024-01-29 15:38:44 +00:00
|
|
|
pushd "$WORKLOADS_DIR" || exit
|
|
|
|
if ! grep focal sha1sums-x86_64 | sha1sum --check; then
|
2021-08-27 22:30:28 +00:00
|
|
|
echo "sha1sum validation of images failed, remove invalid images to fix the issue."
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-01-29 15:38:44 +00:00
|
|
|
popd || exit
|
2021-08-27 22:30:28 +00:00
|
|
|
|
2022-04-13 18:33:22 +00:00
|
|
|
# Download Cloud Hypervisor binary from its last stable release
|
2024-05-03 19:46:52 +00:00
|
|
|
LAST_RELEASE_VERSION="v39.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"
|
2024-01-29 15:38:44 +00:00
|
|
|
pushd "$WORKLOADS_DIR" || exit
|
2022-04-13 18:33:22 +00:00
|
|
|
time wget --quiet $CH_RELEASE_URL -O "$CH_RELEASE_NAME" || exit 1
|
|
|
|
chmod +x $CH_RELEASE_NAME
|
2024-01-29 15:38:44 +00:00
|
|
|
popd || exit
|
2022-04-13 18:33:22 +00:00
|
|
|
|
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
|
2024-01-29 15:38:44 +00:00
|
|
|
# shellcheck disable=SC2034
|
2021-08-27 22:30:28 +00:00
|
|
|
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
|
|
|
|
fi
|
|
|
|
|
2024-01-29 15:38:44 +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
|
2024-01-26 15:30:32 +00:00
|
|
|
HUGEPAGESIZE=$(grep Hugepagesize /proc/meminfo | awk '{print $2}')
|
2024-01-29 15:38:44 +00:00
|
|
|
PAGE_NUM=$((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
|