vhost: Use standard path names throughout tests
Follow the pattern that most of the other tests follow by defining testdir and rootdir at the top, then sourcing the common files. Change-Id: I8f4374e91f20edc244e8e8bcf8f9df198b4509c6 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454380 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
266772ded9
commit
73bb5a717f
@ -1,8 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
AUTOTEST_BASE_DIR=$(readlink -f $(dirname $0))
|
||||
[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $AUTOTEST_BASE_DIR/../common && pwd)"
|
||||
[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $AUTOTEST_BASE_DIR/../../../../ && pwd)"
|
||||
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
|
||||
dry_run=false
|
||||
no_shutdown=false
|
||||
@ -69,8 +71,6 @@ if [[ ! -r "$fio_job" ]]; then
|
||||
fail "no fio job file specified"
|
||||
fi
|
||||
|
||||
. $COMMON_DIR/../common.sh
|
||||
|
||||
trap 'error_exit "${FUNCNAME}" "${LINENO}"' ERR
|
||||
|
||||
vm_kill_all
|
||||
@ -80,7 +80,7 @@ if [[ $test_type =~ "spdk_vhost" ]]; then
|
||||
notice ""
|
||||
notice "running SPDK"
|
||||
notice ""
|
||||
spdk_vhost_run --json-path=$AUTOTEST_BASE_DIR
|
||||
spdk_vhost_run --json-path=$testdir
|
||||
notice ""
|
||||
fi
|
||||
|
||||
|
@ -1,7 +1,13 @@
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
source $rootdir/test/vhost/hotplug/common.sh
|
||||
|
||||
dry_run=false
|
||||
no_shutdown=false
|
||||
fio_bin="fio"
|
||||
fio_jobs="$HOTPLUG_DIR/fio_jobs/"
|
||||
fio_jobs="$testdir/fio_jobs/"
|
||||
test_type=spdk_vhost_scsi
|
||||
reuse_vms=false
|
||||
vms=()
|
||||
@ -56,10 +62,9 @@ while getopts 'xh-:' optchar; do
|
||||
done
|
||||
shift $(( OPTIND - 1 ))
|
||||
|
||||
fio_job=$HOTPLUG_DIR/fio_jobs/default_integrity.job
|
||||
tmp_attach_job=$HOTPLUG_DIR/fio_jobs/fio_attach.job.tmp
|
||||
tmp_detach_job=$HOTPLUG_DIR/fio_jobs/fio_detach.job.tmp
|
||||
. $HOTPLUG_DIR/../common.sh
|
||||
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"
|
||||
|
||||
|
@ -1,8 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
HOTPLUG_DIR=$(readlink -f $(dirname $0))
|
||||
|
||||
. $HOTPLUG_DIR/common.sh
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
source $rootdir/test/vhost/hotplug/common.sh
|
||||
|
||||
function prepare_fio_cmd_tc1() {
|
||||
print_test_fio_header
|
||||
|
@ -1,9 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
HOTPLUG_DIR=$(readlink -f $(dirname $0))
|
||||
|
||||
. $HOTPLUG_DIR/common.sh
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
source $rootdir/test/vhost/hotplug/common.sh
|
||||
|
||||
function get_first_disk() {
|
||||
vm_check_scsi_location $1
|
||||
|
@ -1,7 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
HOTPLUG_DIR=$(readlink -f $(dirname $0))
|
||||
. $HOTPLUG_DIR/common.sh
|
||||
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
source $rootdir/test/vhost/hotplug/common.sh
|
||||
|
||||
if [[ $scsi_hot_remove_test == 1 ]] && [[ $blk_hot_remove_test == 1 ]]; then
|
||||
notice "Vhost-scsi and vhost-blk hotremove tests cannot be run together"
|
||||
@ -71,9 +75,9 @@ $rpc_py get_bdevs
|
||||
|
||||
if [[ $scsi_hot_remove_test == 0 ]] && [[ $blk_hot_remove_test == 0 ]]; then
|
||||
pre_hot_attach_detach_test_case
|
||||
$HOTPLUG_DIR/scsi_hotattach.sh --fio-bin=$fio_bin &
|
||||
$testdir/scsi_hotattach.sh --fio-bin=$fio_bin &
|
||||
first_script=$!
|
||||
$HOTPLUG_DIR/scsi_hotdetach.sh --fio-bin=$fio_bin &
|
||||
$testdir/scsi_hotdetach.sh --fio-bin=$fio_bin &
|
||||
second_script=$!
|
||||
wait $first_script
|
||||
wait $second_script
|
||||
@ -81,9 +85,9 @@ if [[ $scsi_hot_remove_test == 0 ]] && [[ $blk_hot_remove_test == 0 ]]; then
|
||||
clear_vhost_config
|
||||
fi
|
||||
if [[ $scsi_hot_remove_test == 1 ]]; then
|
||||
source $HOTPLUG_DIR/scsi_hotremove.sh
|
||||
source $testdir/scsi_hotremove.sh
|
||||
fi
|
||||
if [[ $blk_hot_remove_test == 1 ]]; then
|
||||
source $HOTPLUG_DIR/blk_hotremove.sh
|
||||
source $testdir/blk_hotremove.sh
|
||||
fi
|
||||
post_test_case
|
||||
|
@ -1,11 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
INITIATOR_DIR=$(readlink -f $(dirname $0))
|
||||
[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $INITIATOR_DIR/../common && pwd)"
|
||||
ROOT_DIR=$(readlink -f $INITIATOR_DIR/../../..)
|
||||
|
||||
PLUGIN_DIR=$ROOT_DIR/examples/bdev/fio_plugin
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
|
||||
PLUGIN_DIR=$rootdir/examples/bdev/fio_plugin
|
||||
FIO_PATH="/usr/src/fio"
|
||||
virtio_bdevs=""
|
||||
virtio_with_unmap=""
|
||||
@ -39,10 +41,9 @@ while getopts 'h-:' optchar; do
|
||||
esac
|
||||
done
|
||||
|
||||
source $COMMON_DIR/../common.sh
|
||||
source $INITIATOR_DIR/autotest.config
|
||||
PLUGIN_DIR=$ROOT_DIR/examples/bdev/fio_plugin
|
||||
RPC_PY="$ROOT_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
|
||||
source $testdir/autotest.config
|
||||
PLUGIN_DIR=$rootdir/examples/bdev/fio_plugin
|
||||
RPC_PY="$rootdir/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
|
||||
|
||||
if [ ! -x $FIO_PATH ]; then
|
||||
error "Invalid path of fio binary"
|
||||
@ -72,7 +73,7 @@ function remove_kernel_vhost()
|
||||
fi
|
||||
}
|
||||
|
||||
trap 'rm -f *.state $ROOT_DIR/spdk.tar.gz $ROOT_DIR/fio.tar.gz $(get_vhost_dir)/Virtio0;\
|
||||
trap 'rm -f *.state $rootdir/spdk.tar.gz $rootdir/fio.tar.gz $(get_vhost_dir)/Virtio0;\
|
||||
remove_kernel_vhost; error_exit "${FUNCNAME}""${LINENO}"' ERR SIGTERM SIGABRT
|
||||
function run_spdk_fio() {
|
||||
LD_PRELOAD=$PLUGIN_DIR/fio_plugin $FIO_PATH/fio --ioengine=spdk_bdev\
|
||||
@ -106,7 +107,7 @@ function create_bdev_config()
|
||||
$RPC_PY construct_vhost_scsi_controller naa.Malloc1.0
|
||||
$RPC_PY add_vhost_scsi_lun naa.Malloc1.0 0 Malloc1
|
||||
|
||||
vbdevs=$(discover_bdevs $ROOT_DIR $INITIATOR_DIR/bdev.conf)
|
||||
vbdevs=$(discover_bdevs $rootdir $testdir/bdev.conf)
|
||||
virtio_bdevs=$(jq -r '[.[].name] | join(":")' <<< $vbdevs)
|
||||
virtio_with_unmap=$(jq -r '[.[] | select(.supported_io_types.unmap==true).name]
|
||||
| join(":")' <<< $vbdevs)
|
||||
@ -121,14 +122,14 @@ create_bdev_config
|
||||
timing_exit create_bdev_config
|
||||
|
||||
timing_enter run_spdk_fio
|
||||
run_spdk_fio $INITIATOR_DIR/bdev.fio --filename=$virtio_bdevs --section=job_randwrite --section=job_randrw \
|
||||
--section=job_write --section=job_rw --spdk_conf=$INITIATOR_DIR/bdev.conf
|
||||
run_spdk_fio $testdir/bdev.fio --filename=$virtio_bdevs --section=job_randwrite --section=job_randrw \
|
||||
--section=job_write --section=job_rw --spdk_conf=$testdir/bdev.conf
|
||||
report_test_completion "vhost_run_spdk_fio"
|
||||
timing_exit run_spdk_fio
|
||||
|
||||
timing_enter run_spdk_fio_unmap
|
||||
run_spdk_fio $INITIATOR_DIR/bdev.fio --filename=$virtio_with_unmap --spdk_conf=$INITIATOR_DIR/bdev.conf \
|
||||
--spdk_conf=$INITIATOR_DIR/bdev.conf
|
||||
run_spdk_fio $testdir/bdev.fio --filename=$virtio_with_unmap --spdk_conf=$testdir/bdev.conf \
|
||||
--spdk_conf=$testdir/bdev.conf
|
||||
timing_exit run_spdk_fio_unmap
|
||||
|
||||
timing_enter create_kernel_vhost
|
||||
@ -150,14 +151,14 @@ vm_wait_for_boot 300 $vm_no
|
||||
timing_exit vm_wait_for_boot
|
||||
|
||||
timing_enter vm_scp_spdk
|
||||
touch $ROOT_DIR/spdk.tar.gz
|
||||
tar --exclude="spdk.tar.gz" --exclude="*.o" --exclude="*.d" --exclude=".git" -C $ROOT_DIR -zcf $ROOT_DIR/spdk.tar.gz .
|
||||
vm_scp $vm_no $ROOT_DIR/spdk.tar.gz "127.0.0.1:/root"
|
||||
touch $rootdir/spdk.tar.gz
|
||||
tar --exclude="spdk.tar.gz" --exclude="*.o" --exclude="*.d" --exclude=".git" -C $rootdir -zcf $rootdir/spdk.tar.gz .
|
||||
vm_scp $vm_no $rootdir/spdk.tar.gz "127.0.0.1:/root"
|
||||
vm_ssh $vm_no "mkdir -p /root/spdk; tar -zxf /root/spdk.tar.gz -C /root/spdk --strip-components=1"
|
||||
|
||||
touch $ROOT_DIR/fio.tar.gz
|
||||
tar --exclude="fio.tar.gz" --exclude="*.o" --exclude="*.d" --exclude=".git" -C $FIO_PATH -zcf $ROOT_DIR/fio.tar.gz .
|
||||
vm_scp $vm_no $ROOT_DIR/fio.tar.gz "127.0.0.1:/root"
|
||||
touch $rootdir/fio.tar.gz
|
||||
tar --exclude="fio.tar.gz" --exclude="*.o" --exclude="*.d" --exclude=".git" -C $FIO_PATH -zcf $rootdir/fio.tar.gz .
|
||||
vm_scp $vm_no $rootdir/fio.tar.gz "127.0.0.1:/root"
|
||||
vm_ssh $vm_no "rm -rf /root/fio_src; mkdir -p /root/fio_src; tar -zxf /root/fio.tar.gz -C /root/fio_src --strip-components=1"
|
||||
timing_exit vm_scp_spdk
|
||||
|
||||
@ -192,7 +193,7 @@ timing_enter vm_shutdown_all
|
||||
vm_shutdown_all
|
||||
timing_exit vm_shutdown_all
|
||||
|
||||
rm -f *.state $ROOT_DIR/spdk.tar.gz $ROOT_DIR/fio.tar.gz $(get_vhost_dir)/Virtio0
|
||||
rm -f *.state $rootdir/spdk.tar.gz $rootdir/fio.tar.gz $(get_vhost_dir)/Virtio0
|
||||
timing_enter remove_kernel_vhost
|
||||
remove_kernel_vhost
|
||||
timing_exit remove_kernel_vhost
|
||||
|
@ -1,7 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
INTEGRITY_BASE_DIR=$(readlink -f $(dirname $0))
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
|
||||
ctrl_type="spdk_vhost_scsi"
|
||||
vm_fs="ext4"
|
||||
|
||||
@ -82,7 +86,7 @@ vm_run 0
|
||||
vm_wait_for_boot 300 0
|
||||
|
||||
# Run tests on VM
|
||||
vm_scp 0 $INTEGRITY_BASE_DIR/integrity_vm.sh root@127.0.0.1:/root/integrity_vm.sh
|
||||
vm_scp 0 $testdir/integrity_vm.sh root@127.0.0.1:/root/integrity_vm.sh
|
||||
vm_ssh 0 "~/integrity_vm.sh $ctrl_type \"$vm_fs\""
|
||||
|
||||
notice "Shutting down virtual machine..."
|
||||
|
@ -1,7 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -xe
|
||||
|
||||
basedir=$(readlink -f $(dirname $0))
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
|
||||
MAKE="make -j$(( $(nproc) * 2 ))"
|
||||
|
||||
if [[ $1 == "spdk_vhost_scsi" ]]; then
|
||||
|
@ -1,14 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
rootdir=$(readlink -f $(dirname $0))/../../..
|
||||
source "$rootdir/scripts/common.sh"
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
source $rootdir/scripts/common.sh
|
||||
|
||||
LVOL_TEST_DIR=$(readlink -f $(dirname $0))
|
||||
[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $LVOL_TEST_DIR/../../../../ && pwd)"
|
||||
[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $LVOL_TEST_DIR/../common && pwd)"
|
||||
|
||||
. $COMMON_DIR/../common.sh
|
||||
rpc_py="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
|
||||
|
||||
vm_count=1
|
||||
@ -113,7 +111,7 @@ fi
|
||||
|
||||
if $distribute_cores; then
|
||||
# FIXME: this need to be handled entirely in common.sh
|
||||
source $LVOL_TEST_DIR/autotest.config
|
||||
source $testdir/autotest.config
|
||||
fi
|
||||
|
||||
trap 'error_exit "${FUNCNAME}" "${LINENO}"' SIGTERM SIGABRT ERR
|
||||
@ -249,7 +247,7 @@ else
|
||||
job_file="default_integrity.job"
|
||||
fi
|
||||
# Run FIO traffic
|
||||
run_fio $fio_bin --job-file=$COMMON_DIR/fio_jobs/$job_file --out="$TEST_DIR/fio_results" $fio_disks
|
||||
run_fio $fio_bin --job-file=$rootdir/test/vhost/common/fio_jobs/$job_file --out="$TEST_DIR/fio_results" $fio_disks
|
||||
|
||||
notice "Shutting down virtual machines..."
|
||||
vm_shutdown_all
|
||||
|
@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
rootdir=$(readlink -f $(dirname $0))/../..
|
||||
source "$rootdir/test/common/autotest_common.sh"
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
|
||||
set -e
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
NEGATIVE_BASE_DIR=$(readlink -f $(dirname $0))
|
||||
[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $NEGATIVE_BASE_DIR/../common && pwd)"
|
||||
[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $NEGATIVE_BASE_DIR/../../../../ && pwd)"
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
|
||||
function usage()
|
||||
{
|
||||
@ -31,16 +32,13 @@ while getopts 'xh-:' optchar; do
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
. $COMMON_DIR/../common.sh
|
||||
|
||||
trap error_exit ERR
|
||||
|
||||
VHOST_APP="$SPDK_BUILD_DIR/app/vhost/vhost"
|
||||
|
||||
notice "Testing vhost command line arguments"
|
||||
# Printing help will force vhost to exit without error
|
||||
$VHOST_APP -c /path/to/non_existing_file/conf -S $NEGATIVE_BASE_DIR -e 0x0 -s 1024 -d -h --silence-noticelog
|
||||
$VHOST_APP -c /path/to/non_existing_file/conf -S $testdir -e 0x0 -s 1024 -d -h --silence-noticelog
|
||||
|
||||
# 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
|
||||
@ -48,7 +46,7 @@ if $VHOST_APP -c /path/to/non_existing_file/conf -f $SPDK_VHOST_SCSI_TEST_DIR/vh
|
||||
fi
|
||||
|
||||
# Testing vhost start with invalid config. Vhost will exit with error as bdev module init failed
|
||||
if $VHOST_APP -c $NEGATIVE_BASE_DIR/invalid.config; then
|
||||
if $VHOST_APP -c $testdir/invalid.config; then
|
||||
fail "vhost started when specifying invalid config file"
|
||||
fi
|
||||
|
||||
@ -68,7 +66,7 @@ if [[ $RUN_NIGHTLY -eq 1 ]]; then
|
||||
notice ""
|
||||
notice "running SPDK"
|
||||
notice ""
|
||||
spdk_vhost_run --json-path=$NEGATIVE_BASE_DIR
|
||||
spdk_vhost_run --json-path=$testdir
|
||||
notice ""
|
||||
|
||||
rpc_py="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
|
||||
|
@ -1,6 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
|
||||
vm_count=1
|
||||
vm_memory=2048
|
||||
vm_image="/home/sys_sgsw/vhost_vm_image.qcow2"
|
||||
@ -136,10 +141,6 @@ while getopts 'xh-:' optchar; do
|
||||
esac
|
||||
done
|
||||
|
||||
. $(readlink -e "$(dirname $0)/../common.sh") || exit 1
|
||||
. $(readlink -e "$(dirname $0)/../../../scripts/common.sh") || exit 1
|
||||
BASE_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
|
||||
COMMON_DIR="$(cd $(readlink -f $(dirname $0))/../common && pwd)"
|
||||
rpc_py="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
|
||||
|
||||
if [[ -n $custom_cpu_cfg ]]; then
|
||||
@ -148,7 +149,7 @@ fi
|
||||
|
||||
if [[ -z $fio_job ]]; then
|
||||
warning "No FIO job specified! Will use default from common directory."
|
||||
fio_job="$COMMON_DIR/fio_jobs/default_integrity.job"
|
||||
fio_job="$rootdir/test/vhost/common/fio_jobs/default_integrity.job"
|
||||
fi
|
||||
|
||||
trap 'error_exit "${FUNCNAME}" "${LINENO}"' INT ERR
|
||||
|
@ -1,7 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -xe
|
||||
BASE_DIR=$(readlink -f $(dirname $0))
|
||||
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
|
||||
disk_name="vda"
|
||||
test_folder_name="readonly_test"
|
||||
@ -15,7 +19,7 @@ function error()
|
||||
trap - ERR
|
||||
set +e
|
||||
umount "$test_folder_name"
|
||||
rm -rf "$BASE_DIR/$test_folder_name"
|
||||
rm -rf "$testdir/$test_folder_name"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -36,7 +40,7 @@ mount /dev/$disk_name"1" $test_folder_name
|
||||
|
||||
echo "INFO: Removing folder and unmounting $test_folder_name"
|
||||
umount "$test_folder_name"
|
||||
rm -rf "$BASE_DIR/$test_folder_name"
|
||||
rm -rf "$testdir/$test_folder_name"
|
||||
|
||||
echo "INFO: Deleting partition"
|
||||
echo -e "d\n1\nw" | fdisk /dev/$disk_name
|
||||
|
@ -1,7 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -xe
|
||||
BASE_DIR=$(readlink -f $(dirname $0))
|
||||
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
|
||||
disk_name="vda"
|
||||
test_folder_name="readonly_test"
|
||||
@ -15,7 +19,7 @@ function error()
|
||||
trap - ERR
|
||||
set +e
|
||||
umount "$test_folder_name"
|
||||
rm -rf "$BASE_DIR/$test_folder_name"
|
||||
rm -rf "$testdir/$test_folder_name"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -44,4 +48,4 @@ mount /dev/$disk_name"1" $test_folder_name
|
||||
echo "INFO: Creating a test file $test_file_name"
|
||||
truncate -s "200M" $test_folder_name/$test_file_name
|
||||
umount "$test_folder_name"
|
||||
rm -rf "$BASE_DIR/$test_folder_name"
|
||||
rm -rf "$testdir/$test_folder_name"
|
||||
|
@ -1,7 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
BASE_DIR=$(readlink -f $(dirname $0))
|
||||
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
|
||||
disk_name="vda"
|
||||
test_folder_name="readonly_test"
|
||||
@ -13,7 +17,7 @@ function error()
|
||||
echo -e "ERROR: $@"
|
||||
echo "==========="
|
||||
umount "$test_folder_name"
|
||||
rm -rf "$BASE_DIR/$test_folder_name"
|
||||
rm -rf "$testdir/$test_folder_name"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -30,13 +34,13 @@ if [[ ! -b "/dev/$disk_name"1"" ]]; then
|
||||
error "Partition not found!"
|
||||
fi
|
||||
|
||||
mkdir $BASE_DIR/$test_folder_name
|
||||
mkdir $testdir/$test_folder_name
|
||||
if [[ $? != 0 ]]; then
|
||||
error "Failed to create test folder $test_folder_name"
|
||||
fi
|
||||
|
||||
echo "INFO: Mounting partition"
|
||||
mount /dev/$disk_name"1" $BASE_DIR/$test_folder_name
|
||||
mount /dev/$disk_name"1" $testdir/$test_folder_name
|
||||
if [[ $? != 0 ]]; then
|
||||
error "Failed to mount partition $disk_name""1"
|
||||
fi
|
||||
@ -58,13 +62,13 @@ else
|
||||
fi
|
||||
|
||||
echo "INFO: Copying file from readonly disk"
|
||||
cp $test_folder_name/$test_file_name $BASE_DIR
|
||||
if ! rm $BASE_DIR/$test_file_name; then
|
||||
cp $test_folder_name/$test_file_name $testdir
|
||||
if ! rm $testdir/$test_file_name; then
|
||||
error "Copied file from a readonly disk was not found!"
|
||||
fi
|
||||
|
||||
umount "$test_folder_name"
|
||||
rm -rf "$BASE_DIR/$test_folder_name"
|
||||
rm -rf "$testdir/$test_folder_name"
|
||||
echo "INFO: Trying to create file system on a readonly disk"
|
||||
if mkfs.ext4 -F /dev/$disk_name"1"; then
|
||||
error "Created file system on a readonly disk!"
|
||||
|
@ -1,12 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
READONLY_BASE_DIR=$(readlink -f $(dirname $0))
|
||||
[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $READONLY_BASE_DIR/../../../../ && pwd)"
|
||||
[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $READONLY_BASE_DIR/../common && pwd)"
|
||||
source $COMMON_DIR/../common.sh
|
||||
|
||||
rpc_py="$READONLY_BASE_DIR/../../../scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
|
||||
rpc_py="$testdir/../../../scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
|
||||
|
||||
vm_img=""
|
||||
disk="Nvme0n1"
|
||||
@ -90,7 +91,7 @@ function blk_ro_tc1()
|
||||
vm_run $vm_no
|
||||
vm_wait_for_boot 300 $vm_no
|
||||
notice "Preparing partition and file on guest VM"
|
||||
vm_ssh $vm_no "bash -s" < $READONLY_BASE_DIR/disabled_readonly_vm.sh
|
||||
vm_ssh $vm_no "bash -s" < $testdir/disabled_readonly_vm.sh
|
||||
sleep 1
|
||||
|
||||
vm_shutdown_all
|
||||
@ -102,7 +103,7 @@ function blk_ro_tc1()
|
||||
vm_run $vm_no
|
||||
vm_wait_for_boot 300 $vm_no
|
||||
notice "Testing readonly feature on guest VM"
|
||||
vm_ssh $vm_no "bash -s" < $READONLY_BASE_DIR/enabled_readonly_vm.sh
|
||||
vm_ssh $vm_no "bash -s" < $testdir/enabled_readonly_vm.sh
|
||||
sleep 3
|
||||
|
||||
vm_shutdown_all
|
||||
@ -114,7 +115,7 @@ function blk_ro_tc1()
|
||||
vm_run $vm_no
|
||||
vm_wait_for_boot 300 $vm_no
|
||||
notice "Removing partition and file from test disk on guest VM"
|
||||
vm_ssh $vm_no "bash -s" < $READONLY_BASE_DIR/delete_partition_vm.sh
|
||||
vm_ssh $vm_no "bash -s" < $testdir/delete_partition_vm.sh
|
||||
sleep 1
|
||||
|
||||
vm_shutdown_all
|
||||
|
@ -1,18 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
SHARED_DIR=$(readlink -f $(dirname $0))
|
||||
[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $SHARED_DIR/../common && pwd)"
|
||||
ROOT_DIR=$(readlink -f $SHARED_DIR/../../..)
|
||||
source $COMMON_DIR/../common.sh
|
||||
PLUGIN_DIR=$ROOT_DIR/examples/bdev/fio_plugin
|
||||
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
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"
|
||||
|
||||
function run_spdk_fio() {
|
||||
LD_PRELOAD=$PLUGIN_DIR/fio_plugin $FIO_PATH/fio --ioengine=spdk_bdev \
|
||||
"$COMMON_DIR/fio_jobs/default_initiator.job" --runtime=10 --rw=randrw \
|
||||
--spdk_mem=1024 --spdk_single_seg=1 --spdk_conf=$SHARED_DIR/bdev.conf "$@"
|
||||
"$rootdir/test/vhost/common/fio_jobs/default_initiator.job" --runtime=10 --rw=randrw \
|
||||
--spdk_mem=1024 --spdk_single_seg=1 --spdk_conf=$testdir/bdev.conf "$@"
|
||||
}
|
||||
|
||||
trap 'error_exit "${FUNCNAME}" "${LINENO}"' ERR SIGTERM SIGABRT
|
||||
|
@ -2,6 +2,7 @@
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
|
||||
echo "Running SPDK vhost fio autotest..."
|
||||
if [[ $(uname -s) != Linux ]]; then
|
||||
|
@ -3,8 +3,9 @@ set -xe
|
||||
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
. $testdir/../common.sh
|
||||
. $rootdir/test/bdev/nbd_common.sh
|
||||
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"
|
||||
vm_no="0"
|
||||
|
@ -2,9 +2,9 @@
|
||||
set -e
|
||||
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $(dirname $0))/../../..
|
||||
vhost_common_dir=$(readlink -e "$(dirname $0)/../common")
|
||||
source "$vhost_common_dir/../common.sh"
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/vhost/common.sh
|
||||
|
||||
rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
|
||||
ctrl_type="spdk_vhost_scsi"
|
||||
|
Loading…
Reference in New Issue
Block a user