From 3f489286c546db9b1e7af9bb5d640b02e58afe8e 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) Signed-off-by: Bo Chen --- scripts/common-aarch64.sh | 2 -- scripts/dev_cli.sh | 15 ++++++++------- 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, 8 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 b686e7ceb..d0895efa6 100755 --- a/scripts/dev_cli.sh +++ b/scripts/dev_cli.sh @@ -415,7 +415,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_"$(uname -m)".sh "$@" || fix_dir_perms $? || exit $? fi @@ -434,7 +434,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 @@ -453,7 +453,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 @@ -472,7 +472,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 @@ -491,7 +491,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 @@ -510,7 +510,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 @@ -529,7 +529,8 @@ 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 $? fi diff --git a/scripts/run_integration_tests_aarch64.sh b/scripts/run_integration_tests_aarch64.sh index a38336058..82d86598b 100755 --- a/scripts/run_integration_tests_aarch64.sh +++ b/scripts/run_integration_tests_aarch64.sh @@ -227,7 +227,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 29f2b9385..c144f96e1 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" @@ -78,7 +76,6 @@ if [ -d "$LINUX_CUSTOM_DIR" ]; then rm -rf $LINUX_CUSTOM_DIR 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 62df36817..4d9a2e5f5 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" @@ -69,7 +67,6 @@ if [ -d "$LINUX_CUSTOM_DIR" ]; then rm -rf $LINUX_CUSTOM_DIR 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_sgx.sh b/scripts/run_integration_tests_sgx.sh index 6a5334aac..c6c7d0f90 100755 --- a/scripts/run_integration_tests_sgx.sh +++ b/scripts/run_integration_tests_sgx.sh @@ -14,7 +14,6 @@ fi # For now these values are default for kvm features="" -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 77db60500..4927d3e1b 100755 --- a/scripts/run_integration_tests_vfio.sh +++ b/scripts/run_integration_tests_vfio.sh @@ -35,7 +35,6 @@ cp $FOCAL_OS_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 91d5819f7..a016207fd 100755 --- a/scripts/run_integration_tests_windows_aarch64.sh +++ b/scripts/run_integration_tests_windows_aarch64.sh @@ -22,7 +22,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 fe226bcd7..2170294de 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 615e6608e..e27612416 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" @@ -172,8 +170,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 --all --release $features --target $BUILD_TARGET strip target/$BUILD_TARGET/release/cloud-hypervisor strip target/$BUILD_TARGET/release/vhost_user_net diff --git a/scripts/run_metrics.sh b/scripts/run_metrics.sh index 15212703a..cebb4f394 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" @@ -91,7 +89,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 5ad9206e7..18de08a0f 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