From 98c1e21d922dc60c41753519043227e54db8b6c3 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 19 Oct 2023 21:23:16 +0000 Subject: [PATCH] scripts: pass BUILD_TARGET directly to test scripts There is no need to reconstruct it from within the scripts since the main script already constructed it once. Drop the previously useless setting of BUILD_TARGET from various scripts. The value was always overwritten at a later point. No functional change intended. Signed-off-by: Wei Liu (cherry picked from commit c7e51e51e58a7547b813f0fd245b5e61058854d6) --- scripts/common-aarch64.sh | 2 -- scripts/dev_cli.sh | 14 +++++++------- scripts/run_integration_tests_aarch64.sh | 1 - scripts/run_integration_tests_live_migration.sh | 3 --- scripts/run_integration_tests_rate_limiter.sh | 3 --- scripts/run_integration_tests_sgx.sh | 1 - scripts/run_integration_tests_vfio.sh | 1 - scripts/run_integration_tests_windows_aarch64.sh | 1 - scripts/run_integration_tests_windows_x86_64.sh | 1 - scripts/run_integration_tests_x86_64.sh | 4 ---- scripts/run_metrics.sh | 3 --- scripts/run_unit_tests.sh | 1 - 12 files changed, 7 insertions(+), 28 deletions(-) diff --git a/scripts/common-aarch64.sh b/scripts/common-aarch64.sh index e7a4ab1ca..6db3b7a47 100644 --- a/scripts/common-aarch64.sh +++ b/scripts/common-aarch64.sh @@ -1,7 +1,5 @@ #!/bin/bash -export BUILD_TARGET=${BUILD_TARGET-aarch64-unknown-linux-gnu} - WORKLOADS_DIR="$HOME/workloads" mkdir -p "$WORKLOADS_DIR" diff --git a/scripts/dev_cli.sh b/scripts/dev_cli.sh index 4c5c70762..0dbe9a225 100755 --- a/scripts/dev_cli.sh +++ b/scripts/dev_cli.sh @@ -424,7 +424,7 @@ cmd_tests() { --volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \ --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ - --env CH_LIBC="${libc}" \ + --env BUILD_TARGET="$target" \ "$CTR_IMAGE" \ dbus-run-session ./scripts/run_integration_tests_"$(uname -m)".sh "$@" || fix_dir_perms $? || exit $? fi @@ -443,7 +443,7 @@ cmd_tests() { --volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \ --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ - --env CH_LIBC="${libc}" \ + --env BUILD_TARGET="$target" \ "$CTR_IMAGE" \ ./scripts/run_integration_tests_sgx.sh "$@" || fix_dir_perms $? || exit $? fi @@ -462,7 +462,7 @@ cmd_tests() { --volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \ --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ - --env CH_LIBC="${libc}" \ + --env BUILD_TARGET="$target" \ "$CTR_IMAGE" \ ./scripts/run_integration_tests_vfio.sh "$@" || fix_dir_perms $? || exit $? fi @@ -481,7 +481,7 @@ cmd_tests() { --volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \ --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ - --env CH_LIBC="${libc}" \ + --env BUILD_TARGET="$target" \ "$CTR_IMAGE" \ ./scripts/run_integration_tests_windows_"$(uname -m)".sh "$@" || fix_dir_perms $? || exit $? fi @@ -500,7 +500,7 @@ cmd_tests() { --volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \ --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ - --env CH_LIBC="${libc}" \ + --env BUILD_TARGET="$target" \ "$CTR_IMAGE" \ ./scripts/run_integration_tests_live_migration.sh "$@" || fix_dir_perms $? || exit $? fi @@ -519,7 +519,7 @@ cmd_tests() { --volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \ --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ - --env CH_LIBC="${libc}" \ + --env BUILD_TARGET="$target" \ "$CTR_IMAGE" \ ./scripts/run_integration_tests_rate_limiter.sh "$@" || fix_dir_perms $? || exit $? fi @@ -538,7 +538,7 @@ cmd_tests() { --volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \ --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ - --env CH_LIBC="${libc}" \ + --env BUILD_TARGET="$target" \ --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 6915f7b60..33c150907 100755 --- a/scripts/run_integration_tests_aarch64.sh +++ b/scripts/run_integration_tests_aarch64.sh @@ -233,7 +233,6 @@ if [ $RES -ne 0 ]; then exit 1 fi -BUILD_TARGET="aarch64-unknown-linux-${CH_LIBC}" 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" diff --git a/scripts/run_integration_tests_live_migration.sh b/scripts/run_integration_tests_live_migration.sh index 544eddf6d..a8b8f12bc 100755 --- a/scripts/run_integration_tests_live_migration.sh +++ b/scripts/run_integration_tests_live_migration.sh @@ -4,8 +4,6 @@ set -x source $HOME/.cargo/env source $(dirname "$0")/test-util.sh -export BUILD_TARGET=${BUILD_TARGET-x86_64-unknown-linux-gnu} - WORKLOADS_DIR="$HOME/workloads" mkdir -p "$WORKLOADS_DIR" @@ -60,7 +58,6 @@ if [ ! -f "$VMLINUX_IMAGE" ]; then build_custom_linux fi -BUILD_TARGET="$(uname -m)-unknown-linux-${CH_LIBC}" CFLAGS="" TARGET_CC="" if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then diff --git a/scripts/run_integration_tests_rate_limiter.sh b/scripts/run_integration_tests_rate_limiter.sh index c502d32ac..cdc66335e 100755 --- a/scripts/run_integration_tests_rate_limiter.sh +++ b/scripts/run_integration_tests_rate_limiter.sh @@ -4,8 +4,6 @@ set -x source $HOME/.cargo/env source $(dirname "$0")/test-util.sh -export BUILD_TARGET=${BUILD_TARGET-x86_64-unknown-linux-gnu} - WORKLOADS_DIR="$HOME/workloads" mkdir -p "$WORKLOADS_DIR" @@ -47,7 +45,6 @@ popd build_custom_linux -BUILD_TARGET="$(uname -m)-unknown-linux-${CH_LIBC}" CFLAGS="" TARGET_CC="" if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then diff --git a/scripts/run_integration_tests_sgx.sh b/scripts/run_integration_tests_sgx.sh index c8e9ec62b..96a4ebeb5 100755 --- a/scripts/run_integration_tests_sgx.sh +++ b/scripts/run_integration_tests_sgx.sh @@ -38,7 +38,6 @@ if [ ! -f "$JAMMY_OS_RAW_IMAGE" ]; then popd fi -BUILD_TARGET="$(uname -m)-unknown-linux-${CH_LIBC}" CFLAGS="" TARGET_CC="" if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then diff --git a/scripts/run_integration_tests_vfio.sh b/scripts/run_integration_tests_vfio.sh index afce5e5c0..b69eb5865 100755 --- a/scripts/run_integration_tests_vfio.sh +++ b/scripts/run_integration_tests_vfio.sh @@ -68,7 +68,6 @@ cp $FOCAL_OS_RAW_IMAGE $VFIO_DIR cp $FW $VFIO_DIR cp $VMLINUX_IMAGE $VFIO_DIR || exit 1 -BUILD_TARGET="$(uname -m)-unknown-linux-${CH_LIBC}" CFLAGS="" TARGET_CC="" if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then diff --git a/scripts/run_integration_tests_windows_aarch64.sh b/scripts/run_integration_tests_windows_aarch64.sh index 4d733a818..8ad6a9b41 100755 --- a/scripts/run_integration_tests_windows_aarch64.sh +++ b/scripts/run_integration_tests_windows_aarch64.sh @@ -20,7 +20,6 @@ WIN_IMAGE_FILE="$WORKLOADS_DIR/$WIN_IMAGE_BASENAME" OVMF_FW="$WORKLOADS_DIR/CLOUDHV_EFI.fd" build_edk2 -BUILD_TARGET="$(uname -m)-unknown-linux-${CH_LIBC}" CFLAGS="" TARGET_CC="" if [[ "${BUILD_TARGET}" == "aarch64-unknown-linux-musl" ]]; then diff --git a/scripts/run_integration_tests_windows_x86_64.sh b/scripts/run_integration_tests_windows_x86_64.sh index 4afd5482f..277f81ada 100755 --- a/scripts/run_integration_tests_windows_x86_64.sh +++ b/scripts/run_integration_tests_windows_x86_64.sh @@ -22,7 +22,6 @@ if [ ! -f "$OVMF_FW" ]; then popd fi -BUILD_TARGET="$(uname -m)-unknown-linux-${CH_LIBC}" CFLAGS="" TARGET_CC="" if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then diff --git a/scripts/run_integration_tests_x86_64.sh b/scripts/run_integration_tests_x86_64.sh index 2a14615f0..239dc86f5 100755 --- a/scripts/run_integration_tests_x86_64.sh +++ b/scripts/run_integration_tests_x86_64.sh @@ -4,8 +4,6 @@ set -x source $HOME/.cargo/env source $(dirname "$0")/test-util.sh -export BUILD_TARGET=${BUILD_TARGET-x86_64-unknown-linux-gnu} - WORKLOADS_DIR="$HOME/workloads" mkdir -p "$WORKLOADS_DIR" @@ -162,8 +160,6 @@ cp $FOCAL_OS_RAW_IMAGE $VFIO_DIR cp $FW $VFIO_DIR cp $VMLINUX_IMAGE $VFIO_DIR || exit 1 -BUILD_TARGET="$(uname -m)-unknown-linux-${CH_LIBC}" - cargo build --features mshv --all --release --target $BUILD_TARGET # We always copy a fresh version of our binary for our L2 guest. diff --git a/scripts/run_metrics.sh b/scripts/run_metrics.sh index 7c60bef1b..d69ac59de 100755 --- a/scripts/run_metrics.sh +++ b/scripts/run_metrics.sh @@ -5,8 +5,6 @@ source $HOME/.cargo/env source $(dirname "$0")/test-util.sh export TEST_ARCH=$(uname -m) -export BUILD_TARGET=${BUILD_TARGET-${TEST_ARCH}-unknown-linux-gnu} - WORKLOADS_DIR="$HOME/workloads" mkdir -p "$WORKLOADS_DIR" @@ -84,7 +82,6 @@ fi # Build custom kernel based on virtio-pmem and virtio-fs upstream patches build_custom_linux -BUILD_TARGET="${TEST_ARCH}-unknown-linux-${CH_LIBC}" CFLAGS="" TARGET_CC="" if [[ "${BUILD_TARGET}" == "${TEST_ARCH}-unknown-linux-musl" ]]; then diff --git a/scripts/run_unit_tests.sh b/scripts/run_unit_tests.sh index b511bffd7..0f5af818d 100755 --- a/scripts/run_unit_tests.sh +++ b/scripts/run_unit_tests.sh @@ -5,7 +5,6 @@ source $(dirname "$0")/test-util.sh process_common_args "$@" -BUILD_TARGET=${BUILD_TARGET-x86_64-unknown-linux-gnu} cargo_args=("") if [[ $hypervisor = "mshv" ]]; then