diff --git a/scripts/dev_cli.sh b/scripts/dev_cli.sh index 0dbe9a225..e28f293d5 100755 --- a/scripts/dev_cli.sh +++ b/scripts/dev_cli.sh @@ -396,6 +396,13 @@ cmd_tests() { process_volumes_args 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 say "Running unit tests for $target..." $DOCKER_RUNTIME run \ @@ -406,6 +413,8 @@ cmd_tests() { --cap-add net_admin \ --volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \ --env BUILD_TARGET="$target" \ + --env RUSTFLAGS="$rustflags" \ + --env TARGET_CC="$target_cc" \ "$CTR_IMAGE" \ ./scripts/run_unit_tests.sh "$@" || fix_dir_perms $? || exit $? fi @@ -425,6 +434,8 @@ cmd_tests() { --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ --env BUILD_TARGET="$target" \ + --env RUSTFLAGS="$rustflags" \ + --env TARGET_CC="$target_cc" \ "$CTR_IMAGE" \ dbus-run-session ./scripts/run_integration_tests_"$(uname -m)".sh "$@" || fix_dir_perms $? || exit $? fi @@ -444,6 +455,8 @@ cmd_tests() { --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ --env BUILD_TARGET="$target" \ + --env RUSTFLAGS="$rustflags" \ + --env TARGET_CC="$target_cc" \ "$CTR_IMAGE" \ ./scripts/run_integration_tests_sgx.sh "$@" || fix_dir_perms $? || exit $? fi @@ -463,6 +476,8 @@ cmd_tests() { --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ --env BUILD_TARGET="$target" \ + --env RUSTFLAGS="$rustflags" \ + --env TARGET_CC="$target_cc" \ "$CTR_IMAGE" \ ./scripts/run_integration_tests_vfio.sh "$@" || fix_dir_perms $? || exit $? fi @@ -482,6 +497,8 @@ cmd_tests() { --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ --env BUILD_TARGET="$target" \ + --env RUSTFLAGS="$rustflags" \ + --env TARGET_CC="$target_cc" \ "$CTR_IMAGE" \ ./scripts/run_integration_tests_windows_"$(uname -m)".sh "$@" || fix_dir_perms $? || exit $? fi @@ -501,6 +518,8 @@ cmd_tests() { --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ --env BUILD_TARGET="$target" \ + --env RUSTFLAGS="$rustflags" \ + --env TARGET_CC="$target_cc" \ "$CTR_IMAGE" \ ./scripts/run_integration_tests_live_migration.sh "$@" || fix_dir_perms $? || exit $? fi @@ -520,6 +539,8 @@ cmd_tests() { --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ --env BUILD_TARGET="$target" \ + --env RUSTFLAGS="$rustflags" \ + --env TARGET_CC="$target_cc" \ "$CTR_IMAGE" \ ./scripts/run_integration_tests_rate_limiter.sh "$@" || fix_dir_perms $? || exit $? fi @@ -539,6 +560,8 @@ cmd_tests() { --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ --env BUILD_TARGET="$target" \ + --env RUSTFLAGS="$rustflags" \ + --env TARGET_CC="$target_cc" \ --env RUST_BACKTRACE="${RUST_BACKTRACE}" \ "$CTR_IMAGE" \ ./scripts/run_metrics.sh "$@" || fix_dir_perms $? || exit $? diff --git a/scripts/run_integration_tests_aarch64.sh b/scripts/run_integration_tests_aarch64.sh index 33c150907..931916168 100755 --- a/scripts/run_integration_tests_aarch64.sh +++ b/scripts/run_integration_tests_aarch64.sh @@ -233,11 +233,6 @@ if [ $RES -ne 0 ]; then exit 1 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 build --all --release --target $BUILD_TARGET diff --git a/scripts/run_integration_tests_live_migration.sh b/scripts/run_integration_tests_live_migration.sh index a8b8f12bc..df177e2c3 100755 --- a/scripts/run_integration_tests_live_migration.sh +++ b/scripts/run_integration_tests_live_migration.sh @@ -59,9 +59,7 @@ if [ ! -f "$VMLINUX_IMAGE" ]; then fi CFLAGS="" -TARGET_CC="" if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then - TARGET_CC="musl-gcc" CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/" fi diff --git a/scripts/run_integration_tests_rate_limiter.sh b/scripts/run_integration_tests_rate_limiter.sh index cdc66335e..0e78faca3 100755 --- a/scripts/run_integration_tests_rate_limiter.sh +++ b/scripts/run_integration_tests_rate_limiter.sh @@ -46,9 +46,7 @@ popd build_custom_linux CFLAGS="" -TARGET_CC="" if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then - TARGET_CC="musl-gcc" CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/" fi diff --git a/scripts/run_integration_tests_sgx.sh b/scripts/run_integration_tests_sgx.sh index 96a4ebeb5..5cab0e365 100755 --- a/scripts/run_integration_tests_sgx.sh +++ b/scripts/run_integration_tests_sgx.sh @@ -39,9 +39,7 @@ if [ ! -f "$JAMMY_OS_RAW_IMAGE" ]; then fi CFLAGS="" -TARGET_CC="" if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then - TARGET_CC="musl-gcc" CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/" fi diff --git a/scripts/run_integration_tests_vfio.sh b/scripts/run_integration_tests_vfio.sh index b69eb5865..0ded6a6df 100755 --- a/scripts/run_integration_tests_vfio.sh +++ b/scripts/run_integration_tests_vfio.sh @@ -69,10 +69,8 @@ cp $FW $VFIO_DIR cp $VMLINUX_IMAGE $VFIO_DIR || exit 1 CFLAGS="" -TARGET_CC="" 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 cargo build --features mshv --all --release --target $BUILD_TARGET diff --git a/scripts/run_integration_tests_windows_aarch64.sh b/scripts/run_integration_tests_windows_aarch64.sh index 8ad6a9b41..01932a063 100755 --- a/scripts/run_integration_tests_windows_aarch64.sh +++ b/scripts/run_integration_tests_windows_aarch64.sh @@ -20,13 +20,6 @@ WIN_IMAGE_FILE="$WORKLOADS_DIR/$WIN_IMAGE_BASENAME" OVMF_FW="$WORKLOADS_DIR/CLOUDHV_EFI.fd" 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 if [[ ! -f ${WIN_IMAGE_FILE} || ! -f ${OVMF_FW} ]]; then echo "Windows image/firmware not present in the host" diff --git a/scripts/run_integration_tests_windows_x86_64.sh b/scripts/run_integration_tests_windows_x86_64.sh index 277f81ada..d529af796 100755 --- a/scripts/run_integration_tests_windows_x86_64.sh +++ b/scripts/run_integration_tests_windows_x86_64.sh @@ -23,9 +23,7 @@ if [ ! -f "$OVMF_FW" ]; then fi CFLAGS="" -TARGET_CC="" if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then - TARGET_CC="musl-gcc" CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/" fi diff --git a/scripts/run_metrics.sh b/scripts/run_metrics.sh index d69ac59de..18365848a 100755 --- a/scripts/run_metrics.sh +++ b/scripts/run_metrics.sh @@ -83,9 +83,7 @@ fi build_custom_linux CFLAGS="" -TARGET_CC="" if [[ "${BUILD_TARGET}" == "${TEST_ARCH}-unknown-linux-musl" ]]; then - TARGET_CC="musl-gcc" CFLAGS="-I /usr/include/${TEST_ARCH}-linux-musl/ -idirafter /usr/include/" fi diff --git a/scripts/run_unit_tests.sh b/scripts/run_unit_tests.sh index 0f5af818d..1f4432208 100755 --- a/scripts/run_unit_tests.sh +++ b/scripts/run_unit_tests.sh @@ -13,11 +13,6 @@ elif [[ $(uname -m) = "x86_64" ]]; then cargo_args+=("--features tdx") 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 cargo test --doc --target $BUILD_TARGET --workspace ${cargo_args[@]} || exit 1