xref: /cloud-hypervisor/scripts/run_unit_tests.sh (revision 4d7a4c598ac247aaf770b00dfb057cdac891f67d)
1#!/bin/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