diff --git a/scripts/run_integration_tests_aarch64.sh b/scripts/run_integration_tests_aarch64.sh index be745c84e..8e05f6c43 100755 --- a/scripts/run_integration_tests_aarch64.sh +++ b/scripts/run_integration_tests_aarch64.sh @@ -11,46 +11,6 @@ WORKLOADS_LOCK="$WORKLOADS_DIR/integration_test.lock" mkdir -p "$WORKLOADS_DIR" -# Checkout source code of a GIT repo with specified branch and commit -# Args: -# $1: Target directory -# $2: GIT URL of the repo -# $3: Required branch -# $4: Required commit (optional) -checkout_repo() { - SRC_DIR="$1" - GIT_URL="$2" - GIT_BRANCH="$3" - GIT_COMMIT="$4" - - # Check whether the local HEAD commit same as the requested commit or not. - # If commit is not specified, compare local HEAD and remote HEAD. - # Remove the folder if there is difference. - if [ -d "$SRC_DIR" ]; then - pushd $SRC_DIR - git fetch - SRC_LOCAL_COMMIT=$(git rev-parse HEAD) - if [ -z "$GIT_COMMIT" ]; then - GIT_COMMIT=$(git rev-parse remotes/origin/"$GIT_BRANCH") - fi - popd - if [ "$SRC_LOCAL_COMMIT" != "$GIT_COMMIT" ]; then - rm -rf "$SRC_DIR" - fi - fi - - # Checkout the specified branch and commit (if required) - if [ ! -d "$SRC_DIR" ]; then - git clone --depth 1 "$GIT_URL" -b "$GIT_BRANCH" "$SRC_DIR" - if [ "$GIT_COMMIT" ]; then - pushd "$SRC_DIR" - git fetch --depth 1 origin "$GIT_COMMIT" - git reset --hard FETCH_HEAD - popd - fi - fi -} - build_custom_linux() { SRCDIR=$PWD LINUX_CUSTOM_DIR="$WORKLOADS_DIR/linux-custom" diff --git a/scripts/run_metrics.sh b/scripts/run_metrics.sh index c50be8658..1822fb7d0 100755 --- a/scripts/run_metrics.sh +++ b/scripts/run_metrics.sh @@ -11,6 +11,21 @@ export BUILD_TARGET=${BUILD_TARGET-${TEST_ARCH}-unknown-linux-gnu} WORKLOADS_DIR="$HOME/workloads" mkdir -p "$WORKLOADS_DIR" +build_fio() { + FIO_DIR="$WORKLOADS_DIR/fio_build" + FIO_REPO="https://github.com/axboe/fio.git" + + checkout_repo "$FIO_DIR" "$FIO_REPO" master "1953e1adb5a28ed21370e85991d7f5c3cdc699f3" + if [ ! -f "$FIO_DIR/.built" ]; then + pushd $FIO_DIR + ./configure + make -j `nproc` + cp fio "$WORKLOADS_DIR/fio" + touch .built + popd + fi +} + process_common_args "$@" # For now these values are default for kvm @@ -57,6 +72,22 @@ if [ $? -ne 0 ]; then fi popd +if [ ${TEST_ARCH} == "aarch64" ]; then + build_fio + + # Update the fio in the cloud image to use io_uring on AArch64 + FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_NAME="focal-server-cloudimg-arm64-custom-20210929-0-update-tool.raw" + cp "$FOCAL_OS_RAW_IMAGE" "$WORKLOADS_DIR/$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_NAME" + FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_ROOT_DIR="$WORKLOADS_DIR/focal-server-cloudimg-root" + if [ ! -d "$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_ROOT_DIR" ]; then + mkdir -p "$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_ROOT_DIR" + fi + # Mount the 'raw' image, replace the fio and umount the working folder + guestmount -a "$WORKLOADS_DIR/$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_NAME" -m /dev/sda1 "$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_ROOT_DIR" || exit 1 + cp "$WORKLOADS_DIR"/fio "$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_ROOT_DIR"/usr/bin/fio + guestunmount "$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_ROOT_DIR" +fi + # Build custom kernel based on virtio-pmem and virtio-fs upstream patches if [ ${TEST_ARCH} == "aarch64" ]; then VMLINUX_IMAGE="$WORKLOADS_DIR/Image" diff --git a/scripts/test-util.sh b/scripts/test-util.sh index 1a4c1d564..0dd84ee13 100644 --- a/scripts/test-util.sh +++ b/scripts/test-util.sh @@ -2,6 +2,46 @@ hypervisor="kvm" test_filter="" +# Checkout source code of a GIT repo with specified branch and commit +# Args: +# $1: Target directory +# $2: GIT URL of the repo +# $3: Required branch +# $4: Required commit (optional) +checkout_repo() { + SRC_DIR="$1" + GIT_URL="$2" + GIT_BRANCH="$3" + GIT_COMMIT="$4" + + # Check whether the local HEAD commit same as the requested commit or not. + # If commit is not specified, compare local HEAD and remote HEAD. + # Remove the folder if there is difference. + if [ -d "$SRC_DIR" ]; then + pushd $SRC_DIR + git fetch + SRC_LOCAL_COMMIT=$(git rev-parse HEAD) + if [ -z "$GIT_COMMIT" ]; then + GIT_COMMIT=$(git rev-parse remotes/origin/"$GIT_BRANCH") + fi + popd + if [ "$SRC_LOCAL_COMMIT" != "$GIT_COMMIT" ]; then + rm -rf "$SRC_DIR" + fi + fi + + # Checkout the specified branch and commit (if required) + if [ ! -d "$SRC_DIR" ]; then + git clone --depth 1 "$GIT_URL" -b "$GIT_BRANCH" "$SRC_DIR" + if [ "$GIT_COMMIT" ]; then + pushd "$SRC_DIR" + git fetch --depth 1 origin "$GIT_COMMIT" + git reset --hard FETCH_HEAD + popd + fi + fi +} + cmd_help() { echo "" echo "Cloud Hypervisor $(basename $0)"