diff --git a/scripts/dev_cli.sh b/scripts/dev_cli.sh index d0895efa6..3fb80a5bd 100755 --- a/scripts/dev_cli.sh +++ b/scripts/dev_cli.sh @@ -387,6 +387,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 \ @@ -397,6 +404,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 @@ -416,6 +425,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_"$(uname -m)".sh "$@" || fix_dir_perms $? || exit $? fi @@ -435,6 +446,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 @@ -454,6 +467,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 @@ -473,6 +488,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 @@ -492,6 +509,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 @@ -511,6 +530,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 @@ -530,6 +551,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 82d86598b..157d00380 100755 --- a/scripts/run_integration_tests_aarch64.sh +++ b/scripts/run_integration_tests_aarch64.sh @@ -227,11 +227,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 # Test without ACPI diff --git a/scripts/run_integration_tests_live_migration.sh b/scripts/run_integration_tests_live_migration.sh index c144f96e1..f259c0f40 100755 --- a/scripts/run_integration_tests_live_migration.sh +++ b/scripts/run_integration_tests_live_migration.sh @@ -77,9 +77,7 @@ if [ -d "$LINUX_CUSTOM_DIR" ]; 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 4d9a2e5f5..7b60ebe16 100755 --- a/scripts/run_integration_tests_rate_limiter.sh +++ b/scripts/run_integration_tests_rate_limiter.sh @@ -68,9 +68,7 @@ if [ -d "$LINUX_CUSTOM_DIR" ]; 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_sgx.sh b/scripts/run_integration_tests_sgx.sh index c6c7d0f90..d5e44ff98 100755 --- a/scripts/run_integration_tests_sgx.sh +++ b/scripts/run_integration_tests_sgx.sh @@ -15,10 +15,8 @@ fi features="" 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 --all --release $features --target $BUILD_TARGET diff --git a/scripts/run_integration_tests_vfio.sh b/scripts/run_integration_tests_vfio.sh index 4927d3e1b..aeeb106cb 100755 --- a/scripts/run_integration_tests_vfio.sh +++ b/scripts/run_integration_tests_vfio.sh @@ -36,10 +36,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 --all --release $features --target $BUILD_TARGET diff --git a/scripts/run_integration_tests_windows_aarch64.sh b/scripts/run_integration_tests_windows_aarch64.sh index a016207fd..46fc449e6 100755 --- a/scripts/run_integration_tests_windows_aarch64.sh +++ b/scripts/run_integration_tests_windows_aarch64.sh @@ -22,13 +22,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 2170294de..09e071d4b 100755 --- a/scripts/run_integration_tests_windows_x86_64.sh +++ b/scripts/run_integration_tests_windows_x86_64.sh @@ -23,10 +23,8 @@ 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/" + CFLAGS="-I /usr/include/x86_64-linux-musl/ -idirafter /usr/include/" fi # Check if the images are present diff --git a/scripts/run_metrics.sh b/scripts/run_metrics.sh index cebb4f394..566d5efbd 100755 --- a/scripts/run_metrics.sh +++ b/scripts/run_metrics.sh @@ -90,9 +90,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 18de08a0f..e6a9a4740 100755 --- a/scripts/run_unit_tests.sh +++ b/scripts/run_unit_tests.sh @@ -14,10 +14,5 @@ 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