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