From 3b9db6c403f247ea98578e55a052ce937bc59e71 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Thu, 30 May 2019 02:59:51 -0400 Subject: [PATCH] test/fio: export single variable for running fio_plugins This patch adds functions in autotest_common.sh, fio_bdev() and fio_nvme() for their respective plugins. It simplifies its usage throughout the scripts. Additionally will help with expanding the fio cmd line with nessecary changes only in single place. This will be used in next patch in series to LD_PRELOAD ASAN before fio_plugin. Note: Did not implement changes for perf scripts, since they are usualy run separately and didn't want to affect those. Similarly didn't change vhost initiator tests, because the exported directories do not work for inside the VM. Will need to think of a way to change it there as well. Change-Id: Idf750ee7aa9d5e30efc0ce430d15fa45ceccb203 Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456314 Reviewed-by: Konrad Sztyber Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Reviewed-by: Darek Stojaczyk Tested-by: SPDK CI Jenkins --- test/bdev/blockdev.sh | 5 ++--- test/common/autotest_common.sh | 18 ++++++++++++++++++ test/ftl/fio.sh | 3 +-- test/nvme/nvme.sh | 2 +- test/nvmf/host/fio.sh | 8 ++++---- test/ocf/integrity/fio-modes.sh | 2 +- test/vhost/initiator/blockdev.sh | 3 +-- test/vhost/shared/shared.sh | 4 +--- 8 files changed, 29 insertions(+), 16 deletions(-) diff --git a/test/bdev/blockdev.sh b/test/bdev/blockdev.sh index 57269db0e..eaf7f6b0f 100755 --- a/test/bdev/blockdev.sh +++ b/test/bdev/blockdev.sh @@ -4,17 +4,16 @@ set -e testdir=$(readlink -f $(dirname $0)) rootdir=$(readlink -f $testdir/../..) -plugindir=$rootdir/examples/bdev/fio_plugin rpc_py="$rootdir/scripts/rpc.py" function run_fio() { if [ $RUN_NIGHTLY -eq 0 ]; then - LD_PRELOAD=$plugindir/fio_plugin /usr/src/fio/fio --ioengine=spdk_bdev --iodepth=8 --bs=4k --runtime=10 $testdir/bdev.fio "$@" + fio_bdev --ioengine=spdk_bdev --iodepth=8 --bs=4k --runtime=10 $testdir/bdev.fio "$@" elif [ $RUN_NIGHTLY_FAILING -eq 1 ]; then # Use size 192KB which both exceeds typical 128KB max NVMe I/O # size and will cross 128KB Intel DC P3700 stripe boundaries. - LD_PRELOAD=$plugindir/fio_plugin /usr/src/fio/fio --ioengine=spdk_bdev --iodepth=128 --bs=192k --runtime=100 $testdir/bdev.fio "$@" + fio_bdev --ioengine=spdk_bdev --iodepth=128 --bs=192k --runtime=100 $testdir/bdev.fio "$@" fi } diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index b3042f377..dbcc13220 100644 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -755,6 +755,24 @@ function fio_config_add_job() echo "filename=$filename" >> $config_file } +function fio_bdev() +{ + # Setup fio binary cmd line + local fio_dir="/usr/src/fio" + local bdev_plugin="$rootdir/examples/bdev/fio_plugin/fio_plugin" + + LD_PRELOAD="$bdev_plugin" "$fio_dir"/fio "$@" +} + +function fio_nvme() +{ + # Setup fio binary cmd line + local fio_dir="/usr/src/fio" + local nvme_plugin="$rootdir/examples/nvme/fio_plugin/fio_plugin" + + LD_PRELOAD="$nvme_plugin" "$fio_dir"/fio "$@" +} + function get_lvs_free_mb() { local lvs_uuid=$1 diff --git a/test/ftl/fio.sh b/test/ftl/fio.sh index 2ff014499..950b77a77 100755 --- a/test/ftl/fio.sh +++ b/test/ftl/fio.sh @@ -4,7 +4,6 @@ set -e testdir=$(readlink -f $(dirname $0)) rootdir=$(readlink -f $testdir/../..) -plugindir=$rootdir/examples/bdev/fio_plugin source $rootdir/test/common/autotest_common.sh @@ -37,7 +36,7 @@ fi for test in ${tests[@]}; do timing_enter $test - LD_PRELOAD=$plugindir/fio_plugin /usr/src/fio/fio $testdir/config/fio/$test.fio + fio_bdev $testdir/config/fio/$test.fio timing_exit $test done diff --git a/test/nvme/nvme.sh b/test/nvme/nvme.sh index 5391318df..755d7d153 100755 --- a/test/nvme/nvme.sh +++ b/test/nvme/nvme.sh @@ -167,7 +167,7 @@ if [ -d /usr/src/fio ] && [ $SPDK_RUN_ASAN -eq 0 ]; then timing_enter fio_plugin PLUGIN_DIR=$rootdir/examples/nvme/fio_plugin for bdf in $(iter_pci_class_code 01 08 02); do - LD_PRELOAD=$PLUGIN_DIR/fio_plugin /usr/src/fio/fio $PLUGIN_DIR/example_config.fio --filename="trtype=PCIe traddr=${bdf//:/.} ns=1" + fio_nvme $PLUGIN_DIR/example_config.fio --filename="trtype=PCIe traddr=${bdf//:/.} ns=1" report_test_completion "bdev_fio" done timing_exit fio_plugin diff --git a/test/nvmf/host/fio.sh b/test/nvmf/host/fio.sh index 3b5c899a5..3021ce8ba 100755 --- a/test/nvmf/host/fio.sh +++ b/test/nvmf/host/fio.sh @@ -37,11 +37,11 @@ $rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPOR PLUGIN_DIR=$rootdir/examples/nvme/fio_plugin # Test fio_plugin as host with malloc backend -LD_PRELOAD=$PLUGIN_DIR/fio_plugin /usr/src/fio/fio $PLUGIN_DIR/example_config.fio --filename="trtype=$TEST_TRANSPORT adrfam=IPv4 \ +fio_nvme $PLUGIN_DIR/example_config.fio --filename="trtype=$TEST_TRANSPORT adrfam=IPv4 \ traddr=$NVMF_FIRST_TARGET_IP trsvcid=$NVMF_PORT ns=1" # second test mocking multiple SGL elements -LD_PRELOAD=$PLUGIN_DIR/fio_plugin /usr/src/fio/fio $PLUGIN_DIR/mock_sgl_config.fio --filename="trtype=$TEST_TRANSPORT adrfam=IPv4 \ +fio_nvme $PLUGIN_DIR/mock_sgl_config.fio --filename="trtype=$TEST_TRANSPORT adrfam=IPv4 \ traddr=$NVMF_FIRST_TARGET_IP trsvcid=$NVMF_PORT ns=1" $rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1 @@ -55,7 +55,7 @@ if [ $RUN_NIGHTLY -eq 1 ]; then $rpc_py nvmf_subsystem_create nqn.2016-06.io.spdk:cnode2 -a -s SPDK00000000000001 $rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode2 lvs_0/lbd_0 $rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode2 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT - LD_PRELOAD=$PLUGIN_DIR/fio_plugin /usr/src/fio/fio $PLUGIN_DIR/example_config.fio --filename="trtype=$TEST_TRANSPORT adrfam=IPv4 \ + fio_nvme $PLUGIN_DIR/example_config.fio --filename="trtype=$TEST_TRANSPORT adrfam=IPv4 \ traddr=$NVMF_FIRST_TARGET_IP trsvcid=$NVMF_PORT ns=1" $rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode2 @@ -66,7 +66,7 @@ if [ $RUN_NIGHTLY -eq 1 ]; then $rpc_py nvmf_subsystem_create nqn.2016-06.io.spdk:cnode3 -a -s SPDK00000000000001 $rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode3 lvs_n_0/lbd_nest_0 $rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode3 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT - LD_PRELOAD=$PLUGIN_DIR/fio_plugin /usr/src/fio/fio $PLUGIN_DIR/example_config.fio --filename="trtype=$TEST_TRANSPORT adrfam=IPv4 \ + fio_nvme $PLUGIN_DIR/example_config.fio --filename="trtype=$TEST_TRANSPORT adrfam=IPv4 \ traddr=$NVMF_FIRST_TARGET_IP trsvcid=$NVMF_PORT ns=1" $rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode3 diff --git a/test/ocf/integrity/fio-modes.sh b/test/ocf/integrity/fio-modes.sh index d4ae0eed8..ab5812482 100755 --- a/test/ocf/integrity/fio-modes.sh +++ b/test/ocf/integrity/fio-modes.sh @@ -7,7 +7,7 @@ plugindir=$rootdir/examples/bdev/fio_plugin source $rootdir/test/common/autotest_common.sh function fio_verify(){ - LD_PRELOAD=$plugindir/fio_plugin /usr/src/fio/fio $curdir/test.fio --aux-path=/tmp/ --ioengine=spdk_bdev $@ + fio_bdev $curdir/test.fio --aux-path=/tmp/ --ioengine=spdk_bdev $@ } function cleanup(){ diff --git a/test/vhost/initiator/blockdev.sh b/test/vhost/initiator/blockdev.sh index 3e4d782b1..0c2ae2cd0 100755 --- a/test/vhost/initiator/blockdev.sh +++ b/test/vhost/initiator/blockdev.sh @@ -78,8 +78,7 @@ function remove_kernel_vhost() 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\ - "$@" --spdk_mem=1024 --spdk_single_seg=1 + fio_bdev --ioengine=spdk_bdev "$@" --spdk_mem=1024 --spdk_single_seg=1 } function create_bdev_config() diff --git a/test/vhost/shared/shared.sh b/test/vhost/shared/shared.sh index ee8948e98..24a51809b 100755 --- a/test/vhost/shared/shared.sh +++ b/test/vhost/shared/shared.sh @@ -7,12 +7,10 @@ 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="$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 \ + fio_bdev --ioengine=spdk_bdev \ "$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 "$@" }