cloud-hypervisor/scripts/run_unit_tests.sh
Michael Zhao 8ba1bc7621 scripts: Fix musl build error in AArch64 unit test
Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2022-03-02 14:12:29 +00:00

23 lines
651 B
Bash
Executable File

#!/bin/bash
source $HOME/.cargo/env
source $(dirname "$0")/test-util.sh
process_common_args "$@"
BUILD_TARGET=${BUILD_TARGET-x86_64-unknown-linux-gnu}
cargo_args=("")
if [[ $(uname -m) = "aarch64" || $hypervisor = "mshv" ]]; then
cargo_args+=("--no-default-features")
cargo_args+=("--features $hypervisor")
fi
if [[ "${BUILD_TARGET}" == "aarch64-unknown-linux-musl" ]]; then
export TARGET_CC="musl-gcc"
export RUSTFLAGS="-C link-arg=-lgcc -C link_arg=-specs -C link_arg=/usr/lib/aarch64-linux-musl/musl-gcc.specs"
fi
export RUST_BACKTRACE=1
cargo test --lib --bins --target $BUILD_TARGET --workspace ${cargo_args[@]} || exit 1;