tests: Use cargo nextest for integration tests

This alternative test runner supports retries and also reports how long
each test takes to run.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
Rob Bradford
2025-11-14 15:04:59 +00:00
parent 2707b0f72a
commit 3734a13cbf
7 changed files with 23 additions and 20 deletions

View File

@@ -208,13 +208,13 @@ echo "$PAGE_NUM" | 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 "common_parallel::$test_filter" --target "$BUILD_TARGET" $test_features -- --test-threads=$(($(nproc) / 8)) ${test_binary_args[*]}
time cargo nextest run $test_features --retries 3 --no-fail-fast --test-threads=$(($(nproc) / 4)) "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
time cargo test "common_sequential::$test_filter" --target "$BUILD_TARGET" $test_features -- --test-threads=1 ${test_binary_args[*]}
time cargo nextest run $test_features --retries 3 --no-fail-fast --test-threads=1 "common_sequential::$test_filter" -- ${test_binary_args[*]}
RES=$?
else
exit $RES
@@ -222,7 +222,7 @@ fi
# Run all ACPI test cases
if [ $RES -eq 0 ]; then
time cargo test "aarch64_acpi::$test_filter" --target "$BUILD_TARGET" $test_features -- ${test_binary_args[*]}
time cargo nextest run $test_features --retries 3 --no-fail-fast --test-threads=$(($(nproc) / 4)) "aarch64_acpi::$test_filter" -- ${test_binary_args[*]}
RES=$?
else
exit $RES
@@ -230,14 +230,14 @@ fi
# Run all test cases related to live migration
if [ $RES -eq 0 ]; then
time cargo test "live_migration_parallel::$test_filter" --target "$BUILD_TARGET" $test_features -- ${test_binary_args[*]}
time cargo nextest run $test_features --retries 3 --no-fail-fast --test-threads=$(($(nproc) / 4)) "live_migration_parallel::$test_filter" -- ${test_binary_args[*]}
RES=$?
else
exit $RES
fi
if [ $RES -eq 0 ]; then
time cargo test "live_migration_sequential::$test_filter" --target "$BUILD_TARGET" $test_features -- --test-threads=1 ${test_binary_args[*]}
time cargo nextest run $test_features --retries 3 --no-fail-fast --test-threads=1 "live_migration_sequential::$test_filter" -- ${test_binary_args[*]}
RES=$?
else
exit $RES
@@ -247,7 +247,8 @@ fi
if [ $RES -eq 0 ]; then
cargo build --features "dbus_api" --all --release --target "$BUILD_TARGET"
export RUST_BACKTRACE=1
time cargo test "dbus_api::$test_filter" --target "$BUILD_TARGET" -- ${test_binary_args[*]}
# integration tests now do not reply on build feature "dbus_api"
time cargo nextest run $test_features --retries 3 --no-fail-fast --test-threads=$(($(nproc) / 4)) "dbus_api::$test_filter" -- ${test_binary_args[*]}
RES=$?
fi
@@ -255,14 +256,15 @@ fi
if [ $RES -eq 0 ]; then
cargo build --features "fw_cfg" --all --release --target "$BUILD_TARGET"
export RUST_BACKTRACE=1
time cargo test "fw_cfg::$test_filter" --target "$BUILD_TARGET" -- ${test_binary_args[*]}
time cargo nextest run $test_features --retries 3 --no-fail-fast --test-threads=$(($(nproc) / 4)) "fw_cfg::$test_filter" -- ${test_binary_args[*]}
RES=$?
fi
if [ $RES -eq 0 ]; then
cargo build --features ivshmem --all --release --target "$BUILD_TARGET"
cargo build --features "ivshmem" --all --release --target "$BUILD_TARGET"
export RUST_BACKTRACE=1
time cargo test "ivshmem::$test_filter" --target "$BUILD_TARGET" -- ${test_binary_args[*]}
time cargo nextest run $test_features --retries 3 --no-fail-fast --test-threads=$(($(nproc) / 4)) "ivshmem::$test_filter" -- ${test_binary_args[*]}
RES=$?
fi