mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-12 07:32:56 +00:00
scripts: propagate RUSTFLAGS and TARGET_CC to test scripts
There is no need to set them in the test scripts while the main script already has them. The consolidates how things are done. Signed-off-by: Wei Liu <liuwe@microsoft.com> (cherry picked from commit 8ba5682e3b1741eedefa0a5d23e4eae74b1f570b) Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
3f489286c5
commit
22867232e1
@ -387,6 +387,13 @@ cmd_tests() {
|
|||||||
process_volumes_args
|
process_volumes_args
|
||||||
target="$(uname -m)-unknown-linux-${libc}"
|
target="$(uname -m)-unknown-linux-${libc}"
|
||||||
|
|
||||||
|
rustflags="$RUSTFLAGS"
|
||||||
|
target_cc=""
|
||||||
|
if [ "$(uname -m)" = "aarch64" ] && [ "$libc" = "musl" ]; then
|
||||||
|
rustflags="$rustflags -C link-arg=-lgcc -C link_arg=-specs -C link_arg=/usr/lib/aarch64-linux-musl/musl-gcc.specs"
|
||||||
|
target_cc="musl-gcc"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$unit" = true ]]; then
|
if [[ "$unit" = true ]]; then
|
||||||
say "Running unit tests for $target..."
|
say "Running unit tests for $target..."
|
||||||
$DOCKER_RUNTIME run \
|
$DOCKER_RUNTIME run \
|
||||||
@ -397,6 +404,8 @@ cmd_tests() {
|
|||||||
--cap-add net_admin \
|
--cap-add net_admin \
|
||||||
--volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \
|
--volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \
|
||||||
--env BUILD_TARGET="$target" \
|
--env BUILD_TARGET="$target" \
|
||||||
|
--env RUSTFLAGS="$rustflags" \
|
||||||
|
--env TARGET_CC="$target_cc" \
|
||||||
"$CTR_IMAGE" \
|
"$CTR_IMAGE" \
|
||||||
./scripts/run_unit_tests.sh "$@" || fix_dir_perms $? || exit $?
|
./scripts/run_unit_tests.sh "$@" || fix_dir_perms $? || exit $?
|
||||||
fi
|
fi
|
||||||
@ -416,6 +425,8 @@ cmd_tests() {
|
|||||||
--volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \
|
--volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \
|
||||||
--env USER="root" \
|
--env USER="root" \
|
||||||
--env BUILD_TARGET="$target" \
|
--env BUILD_TARGET="$target" \
|
||||||
|
--env RUSTFLAGS="$rustflags" \
|
||||||
|
--env TARGET_CC="$target_cc" \
|
||||||
"$CTR_IMAGE" \
|
"$CTR_IMAGE" \
|
||||||
./scripts/run_integration_tests_"$(uname -m)".sh "$@" || fix_dir_perms $? || exit $?
|
./scripts/run_integration_tests_"$(uname -m)".sh "$@" || fix_dir_perms $? || exit $?
|
||||||
fi
|
fi
|
||||||
@ -435,6 +446,8 @@ cmd_tests() {
|
|||||||
--volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \
|
--volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \
|
||||||
--env USER="root" \
|
--env USER="root" \
|
||||||
--env BUILD_TARGET="$target" \
|
--env BUILD_TARGET="$target" \
|
||||||
|
--env RUSTFLAGS="$rustflags" \
|
||||||
|
--env TARGET_CC="$target_cc" \
|
||||||
"$CTR_IMAGE" \
|
"$CTR_IMAGE" \
|
||||||
./scripts/run_integration_tests_sgx.sh "$@" || fix_dir_perms $? || exit $?
|
./scripts/run_integration_tests_sgx.sh "$@" || fix_dir_perms $? || exit $?
|
||||||
fi
|
fi
|
||||||
@ -454,6 +467,8 @@ cmd_tests() {
|
|||||||
--volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \
|
--volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \
|
||||||
--env USER="root" \
|
--env USER="root" \
|
||||||
--env BUILD_TARGET="$target" \
|
--env BUILD_TARGET="$target" \
|
||||||
|
--env RUSTFLAGS="$rustflags" \
|
||||||
|
--env TARGET_CC="$target_cc" \
|
||||||
"$CTR_IMAGE" \
|
"$CTR_IMAGE" \
|
||||||
./scripts/run_integration_tests_vfio.sh "$@" || fix_dir_perms $? || exit $?
|
./scripts/run_integration_tests_vfio.sh "$@" || fix_dir_perms $? || exit $?
|
||||||
fi
|
fi
|
||||||
@ -473,6 +488,8 @@ cmd_tests() {
|
|||||||
--volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \
|
--volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \
|
||||||
--env USER="root" \
|
--env USER="root" \
|
||||||
--env BUILD_TARGET="$target" \
|
--env BUILD_TARGET="$target" \
|
||||||
|
--env RUSTFLAGS="$rustflags" \
|
||||||
|
--env TARGET_CC="$target_cc" \
|
||||||
"$CTR_IMAGE" \
|
"$CTR_IMAGE" \
|
||||||
./scripts/run_integration_tests_windows_"$(uname -m)".sh "$@" || fix_dir_perms $? || exit $?
|
./scripts/run_integration_tests_windows_"$(uname -m)".sh "$@" || fix_dir_perms $? || exit $?
|
||||||
fi
|
fi
|
||||||
@ -492,6 +509,8 @@ cmd_tests() {
|
|||||||
--volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \
|
--volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \
|
||||||
--env USER="root" \
|
--env USER="root" \
|
||||||
--env BUILD_TARGET="$target" \
|
--env BUILD_TARGET="$target" \
|
||||||
|
--env RUSTFLAGS="$rustflags" \
|
||||||
|
--env TARGET_CC="$target_cc" \
|
||||||
"$CTR_IMAGE" \
|
"$CTR_IMAGE" \
|
||||||
./scripts/run_integration_tests_live_migration.sh "$@" || fix_dir_perms $? || exit $?
|
./scripts/run_integration_tests_live_migration.sh "$@" || fix_dir_perms $? || exit $?
|
||||||
fi
|
fi
|
||||||
@ -511,6 +530,8 @@ cmd_tests() {
|
|||||||
--volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \
|
--volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \
|
||||||
--env USER="root" \
|
--env USER="root" \
|
||||||
--env BUILD_TARGET="$target" \
|
--env BUILD_TARGET="$target" \
|
||||||
|
--env RUSTFLAGS="$rustflags" \
|
||||||
|
--env TARGET_CC="$target_cc" \
|
||||||
"$CTR_IMAGE" \
|
"$CTR_IMAGE" \
|
||||||
./scripts/run_integration_tests_rate_limiter.sh "$@" || fix_dir_perms $? || exit $?
|
./scripts/run_integration_tests_rate_limiter.sh "$@" || fix_dir_perms $? || exit $?
|
||||||
fi
|
fi
|
||||||
@ -530,6 +551,8 @@ cmd_tests() {
|
|||||||
--volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \
|
--volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \
|
||||||
--env USER="root" \
|
--env USER="root" \
|
||||||
--env BUILD_TARGET="$target" \
|
--env BUILD_TARGET="$target" \
|
||||||
|
--env RUSTFLAGS="$rustflags" \
|
||||||
|
--env TARGET_CC="$target_cc" \
|
||||||
--env RUST_BACKTRACE="${RUST_BACKTRACE}" \
|
--env RUST_BACKTRACE="${RUST_BACKTRACE}" \
|
||||||
"$CTR_IMAGE" \
|
"$CTR_IMAGE" \
|
||||||
./scripts/run_metrics.sh "$@" || fix_dir_perms $? || exit $?
|
./scripts/run_metrics.sh "$@" || fix_dir_perms $? || exit $?
|
||||||
|
@ -227,11 +227,6 @@ if [ $RES -ne 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
export RUST_BACKTRACE=1
|
||||||
|
|
||||||
# Test without ACPI
|
# Test without ACPI
|
||||||
|
@ -77,9 +77,7 @@ if [ -d "$LINUX_CUSTOM_DIR" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
CFLAGS=""
|
CFLAGS=""
|
||||||
TARGET_CC=""
|
|
||||||
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then
|
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then
|
||||||
TARGET_CC="musl-gcc"
|
|
||||||
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
|
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -68,9 +68,7 @@ if [ -d "$LINUX_CUSTOM_DIR" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
CFLAGS=""
|
CFLAGS=""
|
||||||
TARGET_CC=""
|
|
||||||
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then
|
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then
|
||||||
TARGET_CC="musl-gcc"
|
|
||||||
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
|
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -15,10 +15,8 @@ fi
|
|||||||
features=""
|
features=""
|
||||||
|
|
||||||
CFLAGS=""
|
CFLAGS=""
|
||||||
TARGET_CC=""
|
|
||||||
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then
|
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then
|
||||||
TARGET_CC="musl-gcc"
|
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
|
||||||
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cargo build --all --release $features --target $BUILD_TARGET
|
cargo build --all --release $features --target $BUILD_TARGET
|
||||||
|
@ -36,10 +36,8 @@ cp $FW $VFIO_DIR
|
|||||||
cp $VMLINUX_IMAGE $VFIO_DIR || exit 1
|
cp $VMLINUX_IMAGE $VFIO_DIR || exit 1
|
||||||
|
|
||||||
CFLAGS=""
|
CFLAGS=""
|
||||||
TARGET_CC=""
|
|
||||||
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then
|
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then
|
||||||
TARGET_CC="musl-gcc"
|
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
|
||||||
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cargo build --all --release $features --target $BUILD_TARGET
|
cargo build --all --release $features --target $BUILD_TARGET
|
||||||
|
@ -22,13 +22,6 @@ WIN_IMAGE_FILE="$WORKLOADS_DIR/$WIN_IMAGE_BASENAME"
|
|||||||
OVMF_FW="$WORKLOADS_DIR/CLOUDHV_EFI.fd"
|
OVMF_FW="$WORKLOADS_DIR/CLOUDHV_EFI.fd"
|
||||||
build_edk2
|
build_edk2
|
||||||
|
|
||||||
CFLAGS=""
|
|
||||||
TARGET_CC=""
|
|
||||||
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
|
|
||||||
|
|
||||||
# Check if the images are present
|
# Check if the images are present
|
||||||
if [[ ! -f ${WIN_IMAGE_FILE} || ! -f ${OVMF_FW} ]]; then
|
if [[ ! -f ${WIN_IMAGE_FILE} || ! -f ${OVMF_FW} ]]; then
|
||||||
echo "Windows image/firmware not present in the host"
|
echo "Windows image/firmware not present in the host"
|
||||||
|
@ -23,10 +23,8 @@ if [ ! -f "$OVMF_FW" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
CFLAGS=""
|
CFLAGS=""
|
||||||
TARGET_CC=""
|
|
||||||
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then
|
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then
|
||||||
TARGET_CC="musl-gcc"
|
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
|
||||||
CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the images are present
|
# Check if the images are present
|
||||||
|
@ -90,9 +90,7 @@ fi
|
|||||||
build_custom_linux
|
build_custom_linux
|
||||||
|
|
||||||
CFLAGS=""
|
CFLAGS=""
|
||||||
TARGET_CC=""
|
|
||||||
if [[ "${BUILD_TARGET}" == "${TEST_ARCH}-unknown-linux-musl" ]]; then
|
if [[ "${BUILD_TARGET}" == "${TEST_ARCH}-unknown-linux-musl" ]]; then
|
||||||
TARGET_CC="musl-gcc"
|
|
||||||
CFLAGS="-I /usr/include/${TEST_ARCH}-linux-musl/ -idirafter /usr/include/"
|
CFLAGS="-I /usr/include/${TEST_ARCH}-linux-musl/ -idirafter /usr/include/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -14,10 +14,5 @@ elif [[ $(uname -m) = "x86_64" ]]; then
|
|||||||
cargo_args+=("--features tdx")
|
cargo_args+=("--features tdx")
|
||||||
fi
|
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
|
export RUST_BACKTRACE=1
|
||||||
cargo test --lib --bins --target $BUILD_TARGET --workspace ${cargo_args[@]} || exit 1
|
cargo test --lib --bins --target $BUILD_TARGET --workspace ${cargo_args[@]} || exit 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user