From ad25a95cfa66ae4e65c35715595106ca9f8c7dc5 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Fri, 10 May 2019 11:10:28 -0700 Subject: [PATCH] vhost: Move non-function code to top of common.sh Change-Id: Iae8052b76d2cb1e78a993def689a948935d060f9 Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454494 Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Jim Harris --- test/vhost/common.sh | 55 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/test/vhost/common.sh b/test/vhost/common.sh index 0f7624ef7..a166abfd6 100644 --- a/test/vhost/common.sh +++ b/test/vhost/common.sh @@ -13,6 +13,33 @@ SPDK_BUILD_DIR=$BASE_DIR/../../ SPDK_VHOST_SCSI_TEST_DIR=$TEST_DIR/vhost +# SSH key file +: ${SPDK_VHOST_SSH_KEY_FILE="$(readlink -e $HOME/.ssh/spdk_vhost_id_rsa)"} +if [[ ! -r "$SPDK_VHOST_SSH_KEY_FILE" ]]; then + error "Could not find SSH key file $SPDK_VHOST_SSH_KEY_FILE" + exit 1 +fi +echo "Using SSH key file $SPDK_VHOST_SSH_KEY_FILE" + +VM_BASE_DIR="$TEST_DIR/vms" + + +mkdir -p $TEST_DIR + +# +# Source config describing QEMU and VHOST cores and NUMA +# +source $BASE_DIR/common/autotest.config + +# Trace flag is optional, if it wasn't set earlier - disable it after sourcing +# autotest_common.sh +if [[ $- =~ x ]]; then + source $SPDK_BUILD_DIR/test/common/autotest_common.sh +else + source $SPDK_BUILD_DIR/test/common/autotest_common.sh + set +x +fi + function message() { if ! $SPDK_VHOST_VERBOSE; then @@ -55,34 +82,6 @@ function notice() message "INFO" "$@" } - -# SSH key file -: ${SPDK_VHOST_SSH_KEY_FILE="$(readlink -e $HOME/.ssh/spdk_vhost_id_rsa)"} -if [[ ! -r "$SPDK_VHOST_SSH_KEY_FILE" ]]; then - error "Could not find SSH key file $SPDK_VHOST_SSH_KEY_FILE" - exit 1 -fi -echo "Using SSH key file $SPDK_VHOST_SSH_KEY_FILE" - -VM_BASE_DIR="$TEST_DIR/vms" - - -mkdir -p $TEST_DIR - -# -# Source config describing QEMU and VHOST cores and NUMA -# -source $BASE_DIR/common/autotest.config - -# Trace flag is optional, if it wasn't set earlier - disable it after sourcing -# autotest_common.sh -if [[ $- =~ x ]]; then - source $SPDK_BUILD_DIR/test/common/autotest_common.sh -else - source $SPDK_BUILD_DIR/test/common/autotest_common.sh - set +x -fi - function get_vhost_dir() { if [[ ! -z "$1" ]]; then