scripts: Make --hypervisor=mshv only affect features used by tests

This uncouples it from the features used for building the binary under
test allowing it to use the default build features.

This change also removes the feature control from the test scripts where
it was never used (e.g. run_integration_tests_sgx.sh)

This allows the combined binary to be used for all testing but allows
the disabling of tests known not to work under mshv.

Fixes: #4915

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2022-11-24 13:06:53 +00:00
parent e3a5102f85
commit d83fc7f663
9 changed files with 32 additions and 49 deletions

View File

@ -208,8 +208,6 @@ if [[ "$hypervisor" = "mshv" ]]; then
exit 1
fi
# For now these values are deafult for kvm
features=""
# lock the workloads folder to avoid parallel updating by different containers
(
@ -233,8 +231,7 @@ fi
export RUST_BACKTRACE=1
# Test without ACPI
cargo build --all --release $features --target $BUILD_TARGET
cargo build --all --release --target $BUILD_TARGET
# Enable KSM with some reasonable parameters so that it won't take too long
# for the memory to be merged between two processes.
@ -247,13 +244,13 @@ echo 6144 | sudo tee /proc/sys/vm/nr_hugepages
sudo chmod a+rwX /dev/hugepages
# Run all direct kernel boot (Device Tree) test cases in mod `parallel`
time cargo test $features "common_parallel::$test_filter" --target $BUILD_TARGET -- ${test_binary_args[*]}
time cargo test "common_parallel::$test_filter" --target $BUILD_TARGET -- ${test_binary_args[*]}
RES=$?
# Run some tests in sequence since the result could be affected by other tests
# running in parallel.
if [ $RES -eq 0 ]; then
time cargo test $features "common_sequential::$test_filter" --target $BUILD_TARGET -- --test-threads=1 ${test_binary_args[*]}
time cargo test "common_sequential::$test_filter" --target $BUILD_TARGET -- --test-threads=1 ${test_binary_args[*]}
RES=$?
else
exit $RES
@ -261,7 +258,7 @@ fi
# Run all ACPI test cases
if [ $RES -eq 0 ]; then
time cargo test $features "aarch64_acpi::$test_filter" --target $BUILD_TARGET -- ${test_binary_args[*]}
time cargo test "aarch64_acpi::$test_filter" --target $BUILD_TARGET -- ${test_binary_args[*]}
RES=$?
else
exit $RES
@ -269,14 +266,14 @@ fi
# Run all test cases related to live migration
if [ $RES -eq 0 ]; then
time cargo test $features "live_migration_parallel::$test_filter" --target $BUILD_TARGET -- ${test_binary_args[*]}
time cargo test "live_migration_parallel::$test_filter" --target $BUILD_TARGET -- ${test_binary_args[*]}
RES=$?
else
exit $RES
fi
if [ $RES -eq 0 ]; then
time cargo test $features "live_migration_sequential::$test_filter" --target $BUILD_TARGET -- --test-threads=1 ${test_binary_args[*]}
time cargo test "live_migration_sequential::$test_filter" --target $BUILD_TARGET -- --test-threads=1 ${test_binary_args[*]}
RES=$?
else
exit $RES

View File

@ -12,10 +12,10 @@ mkdir -p "$WORKLOADS_DIR"
process_common_args "$@"
# For now these values are default for kvm
features=""
test_features=""
if [ "$hypervisor" = "mshv" ] ; then
features="--no-default-features --features mshv"
test_features="--no-default-features --features mshv"
fi
cp scripts/sha1sums-x86_64 $WORKLOADS_DIR
@ -86,21 +86,21 @@ if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
fi
cargo build --all --release $features --target $BUILD_TARGET
cargo build --all --release --target $BUILD_TARGET
# Test ovs-dpdk relies on hugepages
echo 6144 | sudo tee /proc/sys/vm/nr_hugepages
sudo chmod a+rwX /dev/hugepages
export RUST_BACKTRACE=1
time cargo test $features "live_migration_parallel::$test_filter" -- ${test_binary_args[*]}
time cargo test $test_features "live_migration_parallel::$test_filter" -- ${test_binary_args[*]}
RES=$?
# 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
time cargo test $features "live_migration_sequential::$test_filter" -- --test-threads=1 ${test_binary_args[*]}
time cargo test $test_features "live_migration_sequential::$test_filter" -- --test-threads=1 ${test_binary_args[*]}
RES=$?
fi

View File

@ -12,10 +12,10 @@ mkdir -p "$WORKLOADS_DIR"
process_common_args "$@"
# For now these values are default for kvm
features=""
test_features=""
if [ "$hypervisor" = "mshv" ] ; then
features="--no-default-features --features mshv"
test_features="--no-default-features --features mshv"
fi
cp scripts/sha1sums-x86_64 $WORKLOADS_DIR
@ -77,10 +77,10 @@ if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
fi
cargo build --all --release $features --target $BUILD_TARGET
cargo build --all --release --target $BUILD_TARGET
export RUST_BACKTRACE=1
time cargo test $features "rate_limiter::$test_filter" -- --test-threads=1 ${test_binary_args[*]}
time cargo test $test_features "rate_limiter::$test_filter" -- --test-threads=1 ${test_binary_args[*]}
RES=$?
exit $RES

View File

@ -38,9 +38,6 @@ if [ ! -f "$JAMMY_OS_RAW_IMAGE" ]; then
popd
fi
# For now these values are default for kvm
features=""
BUILD_TARGET="$(uname -m)-unknown-linux-${CH_LIBC}"
CFLAGS=""
TARGET_CC=""
@ -49,11 +46,11 @@ TARGET_CC="musl-gcc"
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
fi
cargo build --all --release $features --target $BUILD_TARGET
cargo build --all --release --target $BUILD_TARGET
export RUST_BACKTRACE=1
time cargo test $features "sgx::$test_filter" -- ${test_binary_args[*]}
time cargo test "sgx::$test_filter" -- ${test_binary_args[*]}
RES=$?
exit $RES

View File

@ -5,8 +5,6 @@ source $HOME/.cargo/env
source $(dirname "$0")/test-util.sh
process_common_args "$@"
# For now these values are default for kvm
features=""
WORKLOADS_DIR="$HOME/workloads"
FOCAL_OS_IMAGE_NAME="focal-server-cloudimg-amd64-custom-20210609-0.raw"
@ -43,7 +41,7 @@ TARGET_CC="musl-gcc"
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
fi
cargo build --all --release $features --target $BUILD_TARGET
cargo build --all --release --target $BUILD_TARGET
# We always copy a fresh version of our binary for our L2 guest.
cp target/$BUILD_TARGET/release/cloud-hypervisor $VFIO_DIR
@ -54,11 +52,11 @@ echo 6144 | sudo tee /proc/sys/vm/nr_hugepages
sudo chmod a+rwX /dev/hugepages
export RUST_BACKTRACE=1
time cargo test $features "vfio::test_vfio" -- ${test_binary_args[*]}
time cargo test "vfio::test_vfio" -- ${test_binary_args[*]}
RES=$?
if [ $RES -eq 0 ]; then
time cargo test $features "vfio::test_nvidia" -- --test-threads=1 ${test_binary_args[*]}
time cargo test "vfio::test_nvidia" -- --test-threads=1 ${test_binary_args[*]}
RES=$?
fi

View File

@ -6,8 +6,6 @@ source $(dirname "$0")/test-util.sh
source $(dirname "$0")/common-aarch64.sh
process_common_args "$@"
# For now these values are default for kvm
features=""
# aarch64 not supported for MSHV
if [[ "$hypervisor" = "mshv" ]]; then
@ -46,11 +44,11 @@ dmsetup mknodes
export RUST_BACKTRACE=1
cargo build --all --release $features --target $BUILD_TARGET
cargo build --all --release --target $BUILD_TARGET
# Only run with 1 thread to avoid tests interfering with one another because
# Windows has a static IP configured
time cargo test $features "windows::$test_filter" --target $BUILD_TARGET -- ${test_binary_args[*]}
time cargo test "windows::$test_filter" --target $BUILD_TARGET -- ${test_binary_args[*]}
RES=$?
dmsetup remove_all -f

View File

@ -6,10 +6,10 @@ source $(dirname "$0")/test-util.sh
process_common_args "$@"
# For now these values are default for kvm
features=""
test_features=""
if [ "$hypervisor" = "mshv" ] ; then
features="--no-default-features --features mshv"
test_features="--no-default-features --features mshv"
fi
WIN_IMAGE_FILE="/root/workloads/windows-server-2019.raw"
@ -44,13 +44,13 @@ dmsetup mknodes
dmsetup create windows-snapshot-base --table "0 $img_blk_size snapshot-origin /dev/mapper/windows-base"
dmsetup mknodes
cargo build --all --release $features --target $BUILD_TARGET
cargo build --all --release --target $BUILD_TARGET
export RUST_BACKTRACE=1
# Only run with 1 thread to avoid tests interfering with one another because
# Windows has a static IP configured
time cargo test $features "windows::$test_filter" -- ${test_binary_args[*]}
time cargo test $test_features "windows::$test_filter" -- ${test_binary_args[*]}
RES=$?
dmsetup remove_all -f

View File

@ -12,10 +12,10 @@ mkdir -p "$WORKLOADS_DIR"
process_common_args "$@"
# For now these values are default for kvm
features=""
test_features=""
if [ "$hypervisor" = "mshv" ] ; then
features="--no-default-features --features mshv"
test_features="--no-default-features --features mshv"
fi
cp scripts/sha1sums-x86_64 $WORKLOADS_DIR
@ -174,7 +174,7 @@ cp $VMLINUX_IMAGE $VFIO_DIR || exit 1
BUILD_TARGET="$(uname -m)-unknown-linux-${CH_LIBC}"
cargo build --all --release $features --target $BUILD_TARGET
cargo build --all --release --target $BUILD_TARGET
# We always copy a fresh version of our binary for our L2 guest.
cp target/$BUILD_TARGET/release/cloud-hypervisor $VFIO_DIR
@ -194,14 +194,14 @@ sudo chmod a+rwX /dev/hugepages
ulimit -l unlimited
export RUST_BACKTRACE=1
time cargo test $features "common_parallel::$test_filter" -- ${test_binary_args[*]}
time cargo test $test_features "common_parallel::$test_filter" -- ${test_binary_args[*]}
RES=$?
# 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
time cargo test $features "common_sequential::$test_filter" -- --test-threads=1 ${test_binary_args[*]}
time cargo test $test_features "common_sequential::$test_filter" -- --test-threads=1 ${test_binary_args[*]}
RES=$?
fi

View File

@ -28,13 +28,6 @@ build_fio() {
process_common_args "$@"
# For now these values are default for kvm
features=""
if [ "$hypervisor" = "mshv" ]; then
features="--no-default-features --features mshv"
fi
cp scripts/sha1sums-${TEST_ARCH} $WORKLOADS_DIR
if [ ${TEST_ARCH} == "aarch64" ]; then
@ -99,7 +92,7 @@ if [[ "${BUILD_TARGET}" == "${TEST_ARCH}-unknown-linux-musl" ]]; then
CFLAGS="-I /usr/include/${TEST_ARCH}-linux-musl/ -idirafter /usr/include/"
fi
cargo build --all --release $features --target $BUILD_TARGET
cargo build --all --release --target $BUILD_TARGET
# setup hugepages
echo 6144 | sudo tee /proc/sys/vm/nr_hugepages