test/vhost: Replace SPDK_BUILD_DIR with rootdir

rootdir is the pattern used in the other tests

Change-Id: Idaedf8a3d9aeed54a9113a38986f29fa04355d9a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454797
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2019-05-10 11:57:39 -07:00 committed by Jim Harris
parent 8be1517d74
commit e422bf69bb
13 changed files with 34 additions and 36 deletions

View File

@ -3,9 +3,7 @@ set -e
: ${SPDK_VHOST_VERBOSE=false}
: ${QEMU_PREFIX="/usr/local/qemu/spdk-3.0.0"}
SPDK_BUILD_DIR=$rootdir
TEST_DIR=$(readlink -f $SPDK_BUILD_DIR/..)
TEST_DIR=$(readlink -f $rootdir/..)
SPDK_VHOST_SCSI_TEST_DIR=$TEST_DIR/vhost
@ -132,7 +130,7 @@ function spdk_vhost_run()
done
local vhost_dir="$(get_vhost_dir $vhost_num)"
local vhost_app="$SPDK_BUILD_DIR/app/vhost/vhost"
local vhost_app="$rootdir/app/vhost/vhost"
local vhost_log_file="$vhost_dir/vhost.log"
local vhost_pid_file="$vhost_dir/vhost.pid"
local vhost_socket="$vhost_dir/usvhost"
@ -162,7 +160,7 @@ function spdk_vhost_run()
local cmd="$vhost_app -m $reactor_mask -p $master_core -s $memory -r $vhost_dir/rpc.sock $no_pci"
if [[ -n "$vhost_conf_path" ]]; then
cp $vhost_conf_template $vhost_conf_file
$SPDK_BUILD_DIR/scripts/gen_nvme.sh >> $vhost_conf_file
$rootdir/scripts/gen_nvme.sh >> $vhost_conf_file
cmd="$vhost_app -m $reactor_mask -p $master_core -c $vhost_conf_file -s $memory -r $vhost_dir/rpc.sock $no_pci"
fi
@ -179,12 +177,12 @@ function spdk_vhost_run()
waitforlisten "$vhost_pid" "$vhost_dir/rpc.sock"
#do not generate nvmes if pci access is disabled
if [[ -z "$vhost_conf_path" ]] && [[ -z "$no_pci" ]]; then
$SPDK_BUILD_DIR/scripts/gen_nvme.sh "--json" | $SPDK_BUILD_DIR/scripts/rpc.py\
$rootdir/scripts/gen_nvme.sh "--json" | $rootdir/scripts/rpc.py\
-s $vhost_dir/rpc.sock load_subsystem_config
fi
if [[ -n "$vhost_json_path" ]]; then
$SPDK_BUILD_DIR/scripts/rpc.py -s $vhost_dir/rpc.sock load_config < "$vhost_json_path/conf.json"
$rootdir/scripts/rpc.py -s $vhost_dir/rpc.sock load_config < "$vhost_json_path/conf.json"
fi
notice "vhost started - pid=$vhost_pid"
@ -1115,7 +1113,7 @@ function run_fio()
return 0
fi
$SPDK_BUILD_DIR/test/vhost/common/run_fio.py --job-file=/root/$job_fname \
$rootdir/test/vhost/common/run_fio.py --job-file=/root/$job_fname \
$([[ ! -z "$fio_bin" ]] && echo "--fio-bin=$fio_bin") \
--out=$out $json ${fio_disks%,}
}

View File

@ -91,7 +91,7 @@ notice ""
notice "Setting up VM"
notice ""
rpc_py="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
for vm_conf in ${vms[@]}; do
IFS=',' read -ra conf <<< "$vm_conf"

View File

@ -65,7 +65,7 @@ fio_job=$testdir/fio_jobs/default_integrity.job
tmp_attach_job=$testdir/fio_jobs/fio_attach.job.tmp
tmp_detach_job=$testdir/fio_jobs/fio_detach.job.tmp
rpc_py="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
function print_test_fio_header() {
notice "==============="
@ -201,7 +201,7 @@ function check_disks() {
function get_traddr() {
local nvme_name=$1
local nvme="$( $SPDK_BUILD_DIR/scripts/gen_nvme.sh )"
local nvme="$( $rootdir/scripts/gen_nvme.sh )"
while read -r line; do
if [[ $line == *"TransportID"* ]] && [[ $line == *$nvme_name* ]]; then
local word_array=($line)

View File

@ -53,7 +53,7 @@ done
vhosttestinit
. $(readlink -e "$(dirname $0)/../common.sh") || exit 1
rpc_py="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
trap 'error_exit "${FUNCNAME}" "${LINENO}"' SIGTERM SIGABRT ERR

View File

@ -7,7 +7,7 @@ source $rootdir/test/common/autotest_common.sh
source $rootdir/test/vhost/common.sh
source $rootdir/scripts/common.sh
rpc_py="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
vm_count=1
max_disks=""

View File

@ -21,7 +21,7 @@ function migration_tc1_configure_vhost()
target_vm=1
incoming_vm_ctrlr=naa.Malloc0.$incoming_vm
target_vm_ctrlr=naa.Malloc0.$target_vm
rpc="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
rpc="$rootdir/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
trap 'migration_tc1_error_handler; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT

View File

@ -1,4 +1,4 @@
source $SPDK_BUILD_DIR/test/nvmf/common.sh
source $rootdir/test/nvmf/common.sh
function migration_tc2_cleanup_nvmf_tgt()
{
@ -76,9 +76,9 @@ function migration_tc2_configure_vhost()
incoming_vm_ctrlr=naa.VhostScsi0.$incoming_vm
target_vm_ctrlr=naa.VhostScsi0.$target_vm
rpc_nvmf="$SPDK_BUILD_DIR/scripts/rpc.py -s $nvmf_dir/rpc.sock"
rpc_0="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock"
rpc_1="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir 1)/rpc.sock"
rpc_nvmf="$rootdir/scripts/rpc.py -s $nvmf_dir/rpc.sock"
rpc_0="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock"
rpc_1="$rootdir/scripts/rpc.py -s $(get_vhost_dir 1)/rpc.sock"
# Default cleanup/error handlers will not shutdown nvmf_tgt app so setup it
# here to teardown in cleanup function
@ -93,13 +93,13 @@ function migration_tc2_configure_vhost()
notice "Running nvmf_tgt..."
mkdir -p $nvmf_dir
rm -f $nvmf_dir/*
$SPDK_BUILD_DIR/app/nvmf_tgt/nvmf_tgt -s 512 -m 0x4 -r $nvmf_dir/rpc.sock --wait-for-rpc &
$rootdir/app/nvmf_tgt/nvmf_tgt -s 512 -m 0x4 -r $nvmf_dir/rpc.sock --wait-for-rpc &
local nvmf_tgt_pid=$!
echo $nvmf_tgt_pid > $nvmf_dir/nvmf_tgt.pid
waitforlisten "$nvmf_tgt_pid" "$nvmf_dir/rpc.sock"
$rpc_nvmf start_subsystem_init
$rpc_nvmf nvmf_create_transport -t RDMA -u 8192
$SPDK_BUILD_DIR/scripts/gen_nvme.sh --json | $rpc_nvmf load_subsystem_config
$rootdir/scripts/gen_nvme.sh --json | $rpc_nvmf load_subsystem_config
timing_exit start_nvmf_tgt
spdk_vhost_run --memory=512 --vhost-num=0 --no-pci

View File

@ -1,4 +1,4 @@
source $SPDK_BUILD_DIR/test/nvmf/common.sh
source $rootdir/test/nvmf/common.sh
source $MIGRATION_DIR/autotest.config
incoming_vm=1
@ -94,20 +94,20 @@ function host1_cleanup_vhost()
function host1_start_nvmf()
{
nvmf_dir="$TEST_DIR/nvmf_tgt"
rpc_nvmf="$SPDK_BUILD_DIR/scripts/rpc.py -s $nvmf_dir/nvmf_rpc.sock"
rpc_nvmf="$rootdir/scripts/rpc.py -s $nvmf_dir/nvmf_rpc.sock"
notice "Starting nvmf_tgt instance on local server"
mkdir -p $nvmf_dir
rm -rf $nvmf_dir/*
trap 'host1_cleanup_nvmf SIGKILL; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT
$SPDK_BUILD_DIR/app/nvmf_tgt/nvmf_tgt -s 512 -m 0xF -r $nvmf_dir/nvmf_rpc.sock --wait-for-rpc &
$rootdir/app/nvmf_tgt/nvmf_tgt -s 512 -m 0xF -r $nvmf_dir/nvmf_rpc.sock --wait-for-rpc &
nvmf_tgt_pid=$!
echo $nvmf_tgt_pid > $nvmf_dir/nvmf_tgt.pid
waitforlisten "$nvmf_tgt_pid" "$nvmf_dir/nvmf_rpc.sock"
$rpc_nvmf start_subsystem_init
$rpc_nvmf nvmf_create_transport -t RDMA -u 8192
$SPDK_BUILD_DIR/scripts/gen_nvme.sh --json | $rpc_nvmf load_subsystem_config
$rootdir/scripts/gen_nvme.sh --json | $rpc_nvmf load_subsystem_config
$rpc_nvmf nvmf_subsystem_create nqn.2018-02.io.spdk:cnode1 -a -s SPDK01
$rpc_nvmf nvmf_subsystem_add_ns nqn.2018-02.io.spdk:cnode1 Nvme0n1
@ -116,7 +116,7 @@ function host1_start_nvmf()
function host1_start_vhost()
{
rpc_0="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock"
rpc_0="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock"
notice "Starting vhost0 instance on local server"
trap 'host1_cleanup_vhost; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT
@ -154,7 +154,7 @@ function host_1_create_share()
mkdir -p $VM_BASE_DIR # This dir would've been created later but we need it now
rm -rf $share_dir/spdk.tar.gz $share_dir/spdk || true
cp $os_image $share_dir/migration.qcow2
tar --exclude="*.o"--exclude="*.d" --exclude="*.git" -C $SPDK_BUILD_DIR -zcf $share_dir/spdk.tar.gz .
tar --exclude="*.o"--exclude="*.d" --exclude="*.git" -C $rootdir -zcf $share_dir/spdk.tar.gz .
}
function host_2_create_share()

View File

@ -7,7 +7,7 @@ source $MIGRATION_DIR/autotest.config
incoming_vm=1
target_vm=2
target_vm_ctrl=naa.VhostScsi0.$target_vm
rpc="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir 1)/rpc.sock"
rpc="$rootdir/scripts/rpc.py -s $(get_vhost_dir 1)/rpc.sock"
share_dir=$TEST_DIR/share
function host_2_cleanup_vhost()

View File

@ -36,7 +36,7 @@ vhosttestinit
trap error_exit ERR
VHOST_APP="$SPDK_BUILD_DIR/app/vhost/vhost"
VHOST_APP="$rootdir/app/vhost/vhost"
notice "Testing vhost command line arguments"
# Printing help will force vhost to exit without error
@ -72,7 +72,7 @@ if [[ $RUN_NIGHTLY -eq 1 ]]; then
spdk_vhost_run --json-path=$testdir
notice ""
rpc_py="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
# General commands
notice "Trying to remove nonexistent controller"

View File

@ -141,7 +141,7 @@ while getopts 'xh-:' optchar; do
esac
done
rpc_py="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
if [[ -n $custom_cpu_cfg ]]; then
source $custom_cpu_cfg
@ -191,14 +191,14 @@ notice "Nvme split list: ${splits[@]}"
if [[ $run_precondition == true ]]; then
# Using the same precondition routine possible for lvols thanks
# to --clear-method option. Lvols should not UNMAP on creation.
$SPDK_BUILD_DIR/scripts/gen_nvme.sh > $SPDK_BUILD_DIR/nvme.cfg
nvmes=$(cat $SPDK_BUILD_DIR/nvme.cfg | grep -oP "Nvme\d+")
$rootdir/scripts/gen_nvme.sh > $rootdir/nvme.cfg
nvmes=$(cat $rootdir/nvme.cfg | grep -oP "Nvme\d+")
nvmes=($nvmes)
fio_filename=$(printf ":%sn1" "${nvmes[@]}")
fio_filename=${fio_filename:1}
$precond_fio_bin --name="precondition" \
--ioengine="${SPDK_BUILD_DIR}/examples/bdev/fio_plugin/fio_plugin" \
--rw="write" --spdk_conf="${SPDK_BUILD_DIR}/nvme.cfg" --thread="1" \
--ioengine="${rootdir}/examples/bdev/fio_plugin/fio_plugin" \
--rw="write" --spdk_conf="${rootdir}/nvme.cfg" --thread="1" \
--group_reporting --direct="1" --size="100%" --loops="2" --bs="256k" \
--iodepth=32 --filename="${fio_filename}" || true
fi

View File

@ -9,7 +9,7 @@ source $rootdir/test/vhost/common.sh
PLUGIN_DIR=$rootdir/examples/bdev/fio_plugin
FIO_PATH="/usr/src/fio"
rpc_py="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
function run_spdk_fio() {
LD_PRELOAD=$PLUGIN_DIR/fio_plugin $FIO_PATH/fio --ioengine=spdk_bdev \

View File

@ -7,7 +7,7 @@ source $rootdir/test/common/autotest_common.sh
source $rootdir/test/vhost/common.sh
source $rootdir/test/bdev/nbd_common.sh
rpc_py="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
vm_no="0"
function err_clean