xref: /cloud-hypervisor/scripts/run_unit_tests.sh (revision 0a3ad6153a9d19a5d7258c8c9e9895d1af22b986)
1#!/usr/bin/env bash
2# shellcheck disable=SC2068
3
4# shellcheck source=/dev/null
5source "$HOME"/.cargo/env
6source "$(dirname "$0")"/test-util.sh
7
8process_common_args "$@"
9
10cargo_args=("")
11
12# shellcheck disable=SC2154
13if [[ $hypervisor = "mshv" ]]; then
14    cargo_args+=("--features $hypervisor")
15elif [[ $(uname -m) = "x86_64" ]]; then
16    cargo_args+=("--features tdx")
17fi
18
19export RUST_BACKTRACE=1
20cargo test --lib --bins --target "$BUILD_TARGET" --release --workspace ${cargo_args[@]} || exit 1
21cargo test --doc --target "$BUILD_TARGET" --release --workspace ${cargo_args[@]} || exit 1
22