tests: consolidate test config into nextest profiles

Centralize test configuration (filters, retries, fail-fast,
sequential/parallel scheduling) into nextest profiles, replacing
scattered flags across shell scripts. This simplifies the scripts
and provides a single source of truth for test behavior.

Enable JUnit XML output per profile, giving CI systems structured
test results for better reporting.

Not all test invocations are converted to profiles yet. Just the
ones that are repeated across scripts.

Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
This commit is contained in:
Anirudh Rayabharam
2026-04-06 14:02:59 +00:00
committed by Rob Bradford
parent a4f0a18fb5
commit fcd69fb707
5 changed files with 52 additions and 32 deletions

View File

@@ -1,3 +1,38 @@
[profile.default] [profile.default]
# Don't let one individual test run for more than 10 minutes # Don't let one individual test run for more than 10 minutes
slow-timeout = { period = "60s", terminate-after = 10 } slow-timeout = { period = "60s", terminate-after = 10 }
[profile.integration]
fail-fast = false
retries = 3
[profile.common_tests]
inherits = "integration"
default-filter = 'test(common_parallel::) | test(common_sequential::) | test(aarch64_acpi::)'
junit.path = "/root/workloads/junit/common.xml"
[[profile.common_tests.overrides]]
filter = 'test(common_sequential::)'
# use up all the available test threads for each of the sequential tests
# i.e. no other test can be running while a sequential test is running.
threads-required = 'num-test-threads'
[profile.dbus]
inherits = "integration"
default-filter = 'test(dbus_api::)'
junit.path = "/root/workloads/junit/dbus.xml"
[profile.fw_cfg]
inherits = "integration"
default-filter = 'test(fw_cfg::)'
junit.path = "/root/workloads/junit/fw_cfg.xml"
[profile.ivshmem]
inherits = "integration"
default-filter = 'test(ivshmem::)'
junit.path = "/root/workloads/junit/ivshmem.xml"
[profile.common_cvm]
inherits = "integration"
default-filter = 'test(common_cvm::)'
junit.path = "/root/workloads/junit/cvm.xml"

View File

@@ -3,6 +3,7 @@
WORKLOADS_DIR="$HOME/workloads" WORKLOADS_DIR="$HOME/workloads"
mkdir -p "$WORKLOADS_DIR" mkdir -p "$WORKLOADS_DIR"
mkdir -p "$WORKLOADS_DIR/junit"
build_edk2() { build_edk2() {
EDK2_BUILD_DIR="$WORKLOADS_DIR/edk2_build" EDK2_BUILD_DIR="$WORKLOADS_DIR/edk2_build"

View File

@@ -243,24 +243,13 @@ if ! [[ "${PARALLEL_INTEGRATION_TESTS_NUM:-}" =~ ^[1-9][0-9]*$ ]]; then
PARALLEL_INTEGRATION_TESTS_NUM="${TEST_THREADS_DEFAULT}" PARALLEL_INTEGRATION_TESTS_NUM="${TEST_THREADS_DEFAULT}"
fi fi
echo "nproc:$(nproc), parallel_integration_tests:${PARALLEL_INTEGRATION_TESTS_NUM}" echo "nproc:$(nproc), parallel_integration_tests:${PARALLEL_INTEGRATION_TESTS_NUM}"
# Run all direct kernel boot (Device Tree) test cases in mod `parallel` # Run all direct kernel boot (Device Tree) test cases in mod `parallel`,
time cargo nextest run -p cloud-hypervisor $test_features --retries 3 --no-fail-fast --no-tests=pass --test-threads="${PARALLEL_INTEGRATION_TESTS_NUM}" "common_parallel::$test_filter" -- ${test_binary_args[*]} # `sequential`, and ACPI cases. The `common_tests` profile filter covers
# all three sets, and the per-mod `threads-required = 'num-test-threads'`
# override on `common_sequential` enforces serial scheduling within the run.
time cargo nextest run -p cloud-hypervisor $test_features --profile common_tests --no-tests=pass --test-threads="${PARALLEL_INTEGRATION_TESTS_NUM}" "$test_filter" -- ${test_binary_args[*]}
RES=$? RES=$?
if [ $RES -ne 0 ]; then
# Run some tests in sequence since the result could be affected by other tests
# running in parallel.
if [ $RES -eq 0 ]; then
time cargo nextest run -p cloud-hypervisor $test_features --retries 3 --no-fail-fast --no-tests=pass --test-threads=1 "common_sequential::$test_filter" -- ${test_binary_args[*]}
RES=$?
else
exit $RES
fi
# Run all ACPI test cases
if [ $RES -eq 0 ]; then
time cargo nextest run -p cloud-hypervisor $test_features --retries 3 --no-fail-fast --no-tests=pass --test-threads="$TEST_THREADS_DEFAULT" "aarch64_acpi::$test_filter" -- ${test_binary_args[*]}
RES=$?
else
exit $RES exit $RES
fi fi
@@ -269,7 +258,7 @@ if [ $RES -eq 0 ]; then
cargo build --features "mshv,dbus_api" --all --release --target "$BUILD_TARGET" cargo build --features "mshv,dbus_api" --all --release --target "$BUILD_TARGET"
export RUST_BACKTRACE=1 export RUST_BACKTRACE=1
# integration tests now do not reply on build feature "dbus_api" # integration tests now do not reply on build feature "dbus_api"
time cargo nextest run -p cloud-hypervisor $test_features --retries 3 --no-fail-fast --no-tests=pass --test-threads="$TEST_THREADS_DEFAULT" "dbus_api::$test_filter" -- ${test_binary_args[*]} time cargo nextest run -p cloud-hypervisor $test_features --profile dbus --no-tests=pass --test-threads="$TEST_THREADS_DEFAULT" "$test_filter" -- ${test_binary_args[*]}
RES=$? RES=$?
fi fi
@@ -277,14 +266,14 @@ fi
if [ $RES -eq 0 ]; then if [ $RES -eq 0 ]; then
cargo build --features "mshv,fw_cfg" --all --release --target "$BUILD_TARGET" cargo build --features "mshv,fw_cfg" --all --release --target "$BUILD_TARGET"
export RUST_BACKTRACE=1 export RUST_BACKTRACE=1
time cargo nextest run -p cloud-hypervisor $test_features --retries 3 --no-fail-fast --no-tests=pass --test-threads="$TEST_THREADS_DEFAULT" "fw_cfg::$test_filter" -- ${test_binary_args[*]} time cargo nextest run -p cloud-hypervisor $test_features --profile fw_cfg --no-tests=pass --test-threads="$TEST_THREADS_DEFAULT" "$test_filter" -- ${test_binary_args[*]}
RES=$? RES=$?
fi fi
if [ $RES -eq 0 ]; then if [ $RES -eq 0 ]; then
cargo build --features "mshv,ivshmem" --all --release --target "$BUILD_TARGET" cargo build --features "mshv,ivshmem" --all --release --target "$BUILD_TARGET"
export RUST_BACKTRACE=1 export RUST_BACKTRACE=1
time cargo nextest run -p cloud-hypervisor $test_features --retries 3 --no-fail-fast --no-tests=pass --test-threads="$TEST_THREADS_DEFAULT" "ivshmem::$test_filter" -- ${test_binary_args[*]} time cargo nextest run -p cloud-hypervisor $test_features --profile ivshmem --no-tests=pass --test-threads="$TEST_THREADS_DEFAULT" "$test_filter" -- ${test_binary_args[*]}
RES=$? RES=$?
fi fi

View File

@@ -8,6 +8,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/test-util.sh"
WORKLOADS_DIR="$HOME/workloads" WORKLOADS_DIR="$HOME/workloads"
mkdir -p "$WORKLOADS_DIR" mkdir -p "$WORKLOADS_DIR"
mkdir -p "$WORKLOADS_DIR/junit"
process_common_args "$@" process_common_args "$@"
@@ -27,7 +28,7 @@ popd || exit
cargo build --features $build_features --all --release --target "$BUILD_TARGET" cargo build --features $build_features --all --release --target "$BUILD_TARGET"
export RUST_BACKTRACE=1 export RUST_BACKTRACE=1
time cargo nextest run -p cloud-hypervisor $test_features --retries 3 --no-fail-fast --no-tests=pass --test-threads=$(($(nproc) / 4)) "common_cvm::$test_filter" -- ${test_binary_args[*]} time cargo nextest run -p cloud-hypervisor $test_features --profile common_cvm --no-tests=pass --test-threads=$(($(nproc) / 4)) "$test_filter" -- ${test_binary_args[*]}
RES=$? RES=$?
exit $RES exit $RES

View File

@@ -8,6 +8,7 @@ source "$(dirname "$0")"/test-util.sh
WORKLOADS_DIR="$HOME/workloads" WORKLOADS_DIR="$HOME/workloads"
mkdir -p "$WORKLOADS_DIR" mkdir -p "$WORKLOADS_DIR"
mkdir -p "$WORKLOADS_DIR/junit"
process_common_args "$@" process_common_args "$@"
@@ -225,34 +226,27 @@ if ! [[ "${PARALLEL_INTEGRATION_TESTS_NUM:-}" =~ ^[1-9][0-9]*$ ]]; then
PARALLEL_INTEGRATION_TESTS_NUM="${TEST_THREADS_DEFAULT}" PARALLEL_INTEGRATION_TESTS_NUM="${TEST_THREADS_DEFAULT}"
fi fi
echo "nproc:$(nproc), parallel_integration_tests:${PARALLEL_INTEGRATION_TESTS_NUM}" echo "nproc:$(nproc), parallel_integration_tests:${PARALLEL_INTEGRATION_TESTS_NUM}"
time cargo nextest run -p cloud-hypervisor $test_features --retries 3 --no-fail-fast --no-tests=pass --test-threads="${PARALLEL_INTEGRATION_TESTS_NUM}" "common_parallel::$test_filter" -- ${test_binary_args[*]} time cargo nextest run -p cloud-hypervisor $test_features --profile common_tests --no-tests=pass --test-threads="${PARALLEL_INTEGRATION_TESTS_NUM}" "$test_filter" -- ${test_binary_args[*]}
RES=$? RES=$?
# Run some tests in sequence since the result could be affected by other tests
# running in parallel.
if [ $RES -eq 0 ]; then
cargo nextest run -p cloud-hypervisor $test_features --retries 3 --no-fail-fast --no-tests=pass --test-threads=1 "common_sequential::$test_filter" -- ${test_binary_args[*]}
RES=$?
fi
# Run tests on dbus_api # Run tests on dbus_api
if [ $RES -eq 0 ]; then if [ $RES -eq 0 ]; then
cargo build --features "mshv,dbus_api" --all --release --target "$BUILD_TARGET" cargo build --features "mshv,dbus_api" --all --release --target "$BUILD_TARGET"
# integration tests now do not reply on build feature "dbus_api" # integration tests now do not reply on build feature "dbus_api"
time cargo nextest run -p cloud-hypervisor $test_features --retries 3 --no-fail-fast --no-tests=pass --test-threads="$TEST_THREADS_DEFAULT" "dbus_api::$test_filter" -- ${test_binary_args[*]} time cargo nextest run -p cloud-hypervisor $test_features --profile dbus --no-tests=pass --test-threads="$TEST_THREADS_DEFAULT" "$test_filter" -- ${test_binary_args[*]}
RES=$? RES=$?
fi fi
# Run tests on fw_cfg # Run tests on fw_cfg
if [ $RES -eq 0 ]; then if [ $RES -eq 0 ]; then
cargo build --features "mshv,fw_cfg" --all --release --target "$BUILD_TARGET" cargo build --features "mshv,fw_cfg" --all --release --target "$BUILD_TARGET"
time cargo nextest run -p cloud-hypervisor $test_features --retries 3 --no-fail-fast --no-tests=pass --test-threads="$TEST_THREADS_DEFAULT" "fw_cfg::$test_filter" -- ${test_binary_args[*]} time cargo nextest run -p cloud-hypervisor $test_features --profile fw_cfg --no-tests=pass --test-threads="$TEST_THREADS_DEFAULT" "$test_filter" -- ${test_binary_args[*]}
RES=$? RES=$?
fi fi
if [ $RES -eq 0 ]; then if [ $RES -eq 0 ]; then
cargo build --features "mshv,ivshmem" --all --release --target "$BUILD_TARGET" cargo build --features "mshv,ivshmem" --all --release --target "$BUILD_TARGET"
time cargo nextest run -p cloud-hypervisor $test_features --retries 3 --no-fail-fast --no-tests=pass --test-threads="$TEST_THREADS_DEFAULT" "ivshmem::$test_filter" -- ${test_binary_args[*]} time cargo nextest run -p cloud-hypervisor $test_features --profile ivshmem --no-tests=pass --test-threads="$TEST_THREADS_DEFAULT" "$test_filter" -- ${test_binary_args[*]}
RES=$? RES=$?
fi fi