test/vhost: Add proper path for BASE_DIR variable in common.sh library.

Fix in scripts that use BASE_DIR variable
            that is redefined in common.sh.

Change-Id: Ie4ad9fb85f0042d274738f19b0d4696b2056efda
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/411833
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Paweł Niedźwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Pawel Kaminski 2018-05-20 21:35:58 -04:00 committed by Jim Harris
parent 99c8c6d8e1
commit f54106e771
12 changed files with 47 additions and 45 deletions

View File

@ -3,7 +3,7 @@ set -e
: ${SPDK_VHOST_VERBOSE=false} : ${SPDK_VHOST_VERBOSE=false}
: ${QEMU_PREFIX="/usr/local/qemu/spdk-2.12-pre"} : ${QEMU_PREFIX="/usr/local/qemu/spdk-2.12-pre"}
BASE_DIR=$(readlink -f $(dirname $0)) BASE_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
# Default running dir -> spdk/.. # Default running dir -> spdk/..
[[ -z "$TEST_DIR" ]] && TEST_DIR=$BASE_DIR/../../../../ [[ -z "$TEST_DIR" ]] && TEST_DIR=$BASE_DIR/../../../../

View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
BASE_DIR=$(readlink -f $(dirname $0)) AUTOTEST_BASE_DIR=$(readlink -f $(dirname $0))
[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $BASE_DIR/../common && pwd)" [[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $AUTOTEST_BASE_DIR/../common && pwd)"
[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../../../ && pwd)" [[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $AUTOTEST_BASE_DIR/../../../../ && pwd)"
dry_run=false dry_run=false
no_shutdown=false no_shutdown=false
@ -82,7 +82,7 @@ if [[ $test_type =~ "spdk_vhost" ]]; then
notice "" notice ""
notice "running SPDK" notice "running SPDK"
notice "" notice ""
spdk_vhost_run --conf-path=$BASE_DIR spdk_vhost_run --conf-path=$AUTOTEST_BASE_DIR
notice "" notice ""
fi fi

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
BASE_DIR=$(readlink -f $(dirname $0)) INITIATOR_DIR=$(readlink -f $(dirname $0))
[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $BASE_DIR/../common && pwd)" [[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $INITIATOR_DIR/../common && pwd)"
ROOT_DIR=$(readlink -f $BASE_DIR/../../..) ROOT_DIR=$(readlink -f $INITIATOR_DIR/../../..)
function usage() function usage()
{ {
@ -31,7 +31,7 @@ while getopts 'h-:' optchar; do
done done
source $COMMON_DIR/common.sh source $COMMON_DIR/common.sh
source $BASE_DIR/autotest.config source $INITIATOR_DIR/autotest.config
PLUGIN_DIR=$ROOT_DIR/examples/bdev/fio_plugin PLUGIN_DIR=$ROOT_DIR/examples/bdev/fio_plugin
RPC_PY="$ROOT_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock" RPC_PY="$ROOT_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
FIO_BIN="/usr/src/fio/fio" FIO_BIN="/usr/src/fio/fio"
@ -79,14 +79,14 @@ function create_bdev_config()
$RPC_PY construct_vhost_scsi_controller naa.Malloc1.0 $RPC_PY construct_vhost_scsi_controller naa.Malloc1.0
$RPC_PY add_vhost_scsi_lun naa.Malloc1.0 0 Malloc1 $RPC_PY add_vhost_scsi_lun naa.Malloc1.0 0 Malloc1
vbdevs=$(discover_bdevs $ROOT_DIR $BASE_DIR/bdev.conf) vbdevs=$(discover_bdevs $ROOT_DIR $INITIATOR_DIR/bdev.conf)
virtio_bdevs=$(jq -r '[.[].name] | join(":")' <<< $vbdevs) virtio_bdevs=$(jq -r '[.[].name] | join(":")' <<< $vbdevs)
virtio_with_unmap=$(jq -r '[.[] | select(.supported_io_types.unmap==true).name] virtio_with_unmap=$(jq -r '[.[] | select(.supported_io_types.unmap==true).name]
| join(":")' <<< $vbdevs) | join(":")' <<< $vbdevs)
} }
timing_enter spdk_vhost_run timing_enter spdk_vhost_run
spdk_vhost_run --conf-path=$BASE_DIR spdk_vhost_run --conf-path=$INITIATOR_DIR
timing_exit spdk_vhost_run timing_exit spdk_vhost_run
timing_enter create_bdev_config timing_enter create_bdev_config
@ -94,14 +94,14 @@ create_bdev_config
timing_exit create_bdev_config timing_exit create_bdev_config
timing_enter run_spdk_fio timing_enter run_spdk_fio
run_spdk_fio $BASE_DIR/bdev.fio --filename=$virtio_bdevs --section=job_randwrite --section=job_randrw \ run_spdk_fio $INITIATOR_DIR/bdev.fio --filename=$virtio_bdevs --section=job_randwrite --section=job_randrw \
--section=job_write --section=job_rw --spdk_conf=$BASE_DIR/bdev.conf --section=job_write --section=job_rw --spdk_conf=$INITIATOR_DIR/bdev.conf
report_test_completion "vhost_run_spdk_fio" report_test_completion "vhost_run_spdk_fio"
timing_exit run_spdk_fio timing_exit run_spdk_fio
timing_enter run_spdk_fio_unmap timing_enter run_spdk_fio_unmap
run_spdk_fio $BASE_DIR/bdev.fio --filename=$virtio_with_unmap --spdk_conf=$BASE_DIR/bdev.conf \ run_spdk_fio $INITIATOR_DIR/bdev.fio --filename=$virtio_with_unmap --spdk_conf=$INITIATOR_DIR/bdev.conf \
--spdk_conf=$BASE_DIR/bdev.conf --spdk_conf=$INITIATOR_DIR/bdev.conf
timing_exit run_spdk_fio_unmap timing_exit run_spdk_fio_unmap
timing_enter setup_vm timing_enter setup_vm

View File

@ -1,6 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
INTEGRITY_BASE_DIR=$(readlink -f $(dirname $0))
ctrl_type="spdk_vhost_scsi" ctrl_type="spdk_vhost_scsi"
vm_fs="ext4" vm_fs="ext4"
@ -55,7 +56,7 @@ trap 'error_exit "${FUNCNAME}" "${LINENO}"' SIGTERM SIGABRT ERR
vm_kill_all vm_kill_all
notice "Starting SPDK vhost" notice "Starting SPDK vhost"
spdk_vhost_run --conf-path=$BASE_DIR spdk_vhost_run --conf-path=$INTEGRITY_BASE_DIR
notice "..." notice "..."
# Set up lvols and vhost controllers # Set up lvols and vhost controllers
@ -82,7 +83,7 @@ vm_run 0
vm_wait_for_boot 600 0 vm_wait_for_boot 600 0
# Run tests on VM # Run tests on VM
vm_scp 0 $BASE_DIR/integrity_vm.sh root@127.0.0.1:/root/integrity_vm.sh vm_scp 0 $INTEGRITY_BASE_DIR/integrity_vm.sh root@127.0.0.1:/root/integrity_vm.sh
vm_ssh 0 "~/integrity_vm.sh $ctrl_type \"$vm_fs\"" vm_ssh 0 "~/integrity_vm.sh $ctrl_type \"$vm_fs\""
notice "Shutting down virtual machine..." notice "Shutting down virtual machine..."

View File

@ -4,9 +4,9 @@ set -e
rootdir=$(readlink -f $(dirname $0))/../../.. rootdir=$(readlink -f $(dirname $0))/../../..
source "$rootdir/scripts/common.sh" source "$rootdir/scripts/common.sh"
BASE_DIR=$(readlink -f $(dirname $0)) LVOL_TEST_DIR=$(readlink -f $(dirname $0))
[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../../../ && pwd)" [[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $LVOL_TEST_DIR/../../../../ && pwd)"
[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $BASE_DIR/../common && pwd)" [[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $LVOL_TEST_DIR/../common && pwd)"
. $COMMON_DIR/common.sh . $COMMON_DIR/common.sh
rpc_py="python $SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock" rpc_py="python $SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
@ -113,7 +113,7 @@ fi
if $distribute_cores; then if $distribute_cores; then
# FIXME: this need to be handled entirely in common.sh # FIXME: this need to be handled entirely in common.sh
source $BASE_DIR/autotest.config source $LVOL_TEST_DIR/autotest.config
fi fi
trap 'error_exit "${FUNCNAME}" "${LINENO}"' SIGTERM SIGABRT ERR trap 'error_exit "${FUNCNAME}" "${LINENO}"' SIGTERM SIGABRT ERR
@ -121,7 +121,7 @@ trap 'error_exit "${FUNCNAME}" "${LINENO}"' SIGTERM SIGABRT ERR
vm_kill_all vm_kill_all
notice "running SPDK vhost" notice "running SPDK vhost"
spdk_vhost_run --conf-path=$BASE_DIR spdk_vhost_run --conf-path=$LVOL_TEST_DIR
notice "..." notice "..."
trap 'clean_lvol_cfg; error_exit "${FUNCNAME}" "${LINENO}"' SIGTERM SIGABRT ERR trap 'clean_lvol_cfg; error_exit "${FUNCNAME}" "${LINENO}"' SIGTERM SIGABRT ERR

View File

@ -54,10 +54,10 @@ function migration_tc1()
# Use 2 VMs: # Use 2 VMs:
# incoming VM - the one we want to migrate # incoming VM - the one we want to migrate
# targe VM - the one which will accept migration # targe VM - the one which will accept migration
local job_file="$BASE_DIR/migration-tc1.job" local job_file="$MIGRATION_DIR/migration-tc1.job"
# Run vhost # Run vhost
spdk_vhost_run --conf-path=$BASE_DIR spdk_vhost_run --conf-path=$MIGRATION_DIR
migration_tc1_configure_vhost migration_tc1_configure_vhost
notice "Setting up VMs" notice "Setting up VMs"

View File

@ -101,11 +101,11 @@ function migration_tc2_configure_vhost()
waitforlisten "$nvmf_tgt_pid" "$nvmf_dir/rpc.sock" waitforlisten "$nvmf_tgt_pid" "$nvmf_dir/rpc.sock"
timing_exit start_nvmf_tgt timing_exit start_nvmf_tgt
spdk_vhost_run --conf-path=$BASE_DIR --memory=512 --vhost-num=0 spdk_vhost_run --conf-path=$MIGRATION_DIR --memory=512 --vhost-num=0
# Those are global intentionaly # Those are global intentionaly
vhost_1_reactor_mask=0x2 vhost_1_reactor_mask=0x2
vhost_1_master_core=1 vhost_1_master_core=1
spdk_vhost_run --conf-path=$BASE_DIR --memory=512 --vhost-num=1 spdk_vhost_run --conf-path=$MIGRATION_DIR --memory=512 --vhost-num=1
local rdma_ip_list=$(get_available_rdma_ips) local rdma_ip_list=$(get_available_rdma_ips)
local nvmf_target_ip=$(echo "$rdma_ip_list" | head -n 1) local nvmf_target_ip=$(echo "$rdma_ip_list" | head -n 1)
@ -160,7 +160,7 @@ function migration_tc2()
# Use 2 VMs: # Use 2 VMs:
# incoming VM - the one we want to migrate # incoming VM - the one we want to migrate
# targe VM - the one which will accept migration # targe VM - the one which will accept migration
local job_file="$BASE_DIR/migration-tc2.job" local job_file="$MIGRATION_DIR/migration-tc2.job"
migration_tc2_configure_vhost migration_tc2_configure_vhost

View File

@ -1,5 +1,5 @@
source $SPDK_BUILD_DIR/test/nvmf/common.sh source $SPDK_BUILD_DIR/test/nvmf/common.sh
source $BASE_DIR/autotest.config source $MIGRATION_DIR/autotest.config
MGMT_TARGET_IP="10.102.17.181" MGMT_TARGET_IP="10.102.17.181"
MGMT_INITIATOR_IP="10.102.17.180" MGMT_INITIATOR_IP="10.102.17.180"
@ -10,7 +10,7 @@ target_vm=2
incoming_vm_ctrlr=naa.VhostScsi0.$incoming_vm incoming_vm_ctrlr=naa.VhostScsi0.$incoming_vm
target_vm_ctrlr=naa.VhostScsi0.$target_vm target_vm_ctrlr=naa.VhostScsi0.$target_vm
share_dir=$TEST_DIR/share share_dir=$TEST_DIR/share
job_file=$BASE_DIR/migration-tc3.job job_file=$MIGRATION_DIR/migration-tc3.job
function ssh_remote() function ssh_remote()
{ {
@ -106,7 +106,7 @@ function host1_start_vhost()
notice "Starting vhost0 instance on local server" notice "Starting vhost0 instance on local server"
trap 'host1_cleanup_vhost; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT trap 'host1_cleanup_vhost; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT
spdk_vhost_run --conf-path=$BASE_DIR --vhost-num=0 spdk_vhost_run --conf-path=$MIGRATION_DIR --vhost-num=0
$rpc_0 construct_nvme_bdev -b Nvme0 -t rdma -f ipv4 -a $RDMA_TARGET_IP -s 4420 -n "nqn.2018-02.io.spdk:cnode1" $rpc_0 construct_nvme_bdev -b Nvme0 -t rdma -f ipv4 -a $RDMA_TARGET_IP -s 4420 -n "nqn.2018-02.io.spdk:cnode1"
$rpc_0 construct_vhost_scsi_controller $incoming_vm_ctrlr $rpc_0 construct_vhost_scsi_controller $incoming_vm_ctrlr
$rpc_0 add_vhost_scsi_lun $incoming_vm_ctrlr 0 Nvme0n1 $rpc_0 add_vhost_scsi_lun $incoming_vm_ctrlr 0 Nvme0n1

View File

@ -2,7 +2,7 @@
# as we are usin non-interactive session to connect to remote. # as we are usin non-interactive session to connect to remote.
# Without -m it would be not possible to suspend the process. # Without -m it would be not possible to suspend the process.
set -m set -m
source $BASE_DIR/autotest.config source $MIGRATION_DIR/autotest.config
RDMA_TARGET_IP="10.0.0.1" RDMA_TARGET_IP="10.0.0.1"
incoming_vm=1 incoming_vm=1
@ -34,7 +34,7 @@ function host_2_start_vhost()
notice "Starting vhost 1 instance on remote server" notice "Starting vhost 1 instance on remote server"
trap 'host_2_cleanup_vhost; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT trap 'host_2_cleanup_vhost; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT
spdk_vhost_run --conf-path=$BASE_DIR --vhost-num=1 spdk_vhost_run --conf-path=$MIGRATION_DIR --vhost-num=1
$rpc construct_nvme_bdev -b Nvme0 -t rdma -f ipv4 -a $RDMA_TARGET_IP -s 4420 -n "nqn.2018-02.io.spdk:cnode1" $rpc construct_nvme_bdev -b Nvme0 -t rdma -f ipv4 -a $RDMA_TARGET_IP -s 4420 -n "nqn.2018-02.io.spdk:cnode1"
$rpc construct_vhost_scsi_controller $target_vm_ctrl $rpc construct_vhost_scsi_controller $target_vm_ctrl

View File

@ -45,6 +45,7 @@ for param in "$@"; do
done done
. $(readlink -e "$(dirname $0)/../common/common.sh") || exit 1 . $(readlink -e "$(dirname $0)/../common/common.sh") || exit 1
MIGRATION_DIR=$(readlink -f $(dirname $0))
[[ ! -z "$test_cases" ]] || fail "Need '--test-cases=' parameter" [[ ! -z "$test_cases" ]] || fail "Need '--test-cases=' parameter"
@ -131,7 +132,7 @@ for test_case in ${test_cases//,/ }; do
notice "===============================" notice "==============================="
timing_enter migration-tc${test_case} timing_enter migration-tc${test_case}
source $BASE_DIR/migration-tc${test_case}.sh source $MIGRATION_DIR/migration-tc${test_case}.sh
timing_exit migration-tc${test_case} timing_exit migration-tc${test_case}
done done

View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
BASE_DIR=$(readlink -f $(dirname $0)) NEGATIVE_BASE_DIR=$(readlink -f $(dirname $0))
[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $BASE_DIR/../common && pwd)" [[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $NEGATIVE_BASE_DIR/../common && pwd)"
[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../../../ && pwd)" [[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $NEGATIVE_BASE_DIR/../../../../ && pwd)"
function usage() function usage()
{ {
@ -42,7 +42,7 @@ VHOST_APP="$SPDK_BUILD_DIR/app/vhost/vhost"
notice "Testing vhost command line arguments" notice "Testing vhost command line arguments"
# Printing help will force vhost to exit without error # Printing help will force vhost to exit without error
$VHOST_APP -c /path/to/non_existing_file/conf -S $BASE_DIR -e 0x0 -s 1024 -d -q -h $VHOST_APP -c /path/to/non_existing_file/conf -S $NEGATIVE_BASE_DIR -e 0x0 -s 1024 -d -q -h
# Testing vhost create pid file option. Vhost will exit with error as invalid config path is given # Testing vhost create pid file option. Vhost will exit with error as invalid config path is given
if $VHOST_APP -c /path/to/non_existing_file/conf -f $SPDK_VHOST_SCSI_TEST_DIR/vhost.pid; then if $VHOST_APP -c /path/to/non_existing_file/conf -f $SPDK_VHOST_SCSI_TEST_DIR/vhost.pid; then

View File

@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
BASE_DIR=$(readlink -f $(dirname $0)) READONLY_BASE_DIR=$(readlink -f $(dirname $0))
[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../../../ && pwd)" [[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $READONLY_BASE_DIR/../../../../ && pwd)"
[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $BASE_DIR/../common && pwd)" [[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $READONLY_BASE_DIR/../common && pwd)"
source $COMMON_DIR/common.sh source $COMMON_DIR/common.sh
rpc_py="$BASE_DIR/../../../scripts/rpc.py -s $(get_vhost_dir)/rpc.sock" rpc_py="$READONLY_BASE_DIR/../../../scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
vm_img="" vm_img=""
disk="Nvme0n1" disk="Nvme0n1"
@ -90,7 +90,7 @@ function blk_ro_tc1()
vm_run $vm_no vm_run $vm_no
vm_wait_for_boot 600 $vm_no vm_wait_for_boot 600 $vm_no
notice "Preparing partition and file on guest VM" notice "Preparing partition and file on guest VM"
vm_ssh $vm_no "bash -s" < $BASE_DIR/disabled_readonly_vm.sh vm_ssh $vm_no "bash -s" < $READONLY_BASE_DIR/disabled_readonly_vm.sh
sleep 1 sleep 1
vm_shutdown_all vm_shutdown_all
@ -102,7 +102,7 @@ function blk_ro_tc1()
vm_run $vm_no vm_run $vm_no
vm_wait_for_boot 600 $vm_no vm_wait_for_boot 600 $vm_no
notice "Testing readonly feature on guest VM" notice "Testing readonly feature on guest VM"
vm_ssh $vm_no "bash -s" < $BASE_DIR/enabled_readonly_vm.sh vm_ssh $vm_no "bash -s" < $READONLY_BASE_DIR/enabled_readonly_vm.sh
sleep 3 sleep 3
vm_shutdown_all vm_shutdown_all
@ -114,13 +114,13 @@ function blk_ro_tc1()
vm_run $vm_no vm_run $vm_no
vm_wait_for_boot 600 $vm_no vm_wait_for_boot 600 $vm_no
notice "Removing partition and file from test disk on guest VM" notice "Removing partition and file from test disk on guest VM"
vm_ssh $vm_no "bash -s" < $BASE_DIR/delete_partition_vm.sh vm_ssh $vm_no "bash -s" < $READONLY_BASE_DIR/delete_partition_vm.sh
sleep 1 sleep 1
vm_shutdown_all vm_shutdown_all
} }
spdk_vhost_run --conf-path=$BASE_DIR spdk_vhost_run --conf-path=$READONLY_BASE_DIR
if [[ -z $x ]]; then if [[ -z $x ]]; then
set +x set +x
fi fi