test/blockdev: move configuration into the script.

Change-Id: I795e729f6e0497a56a0328bb308bc9d32f44922b
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478241
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2019-12-17 11:29:06 -07:00 committed by Tomasz Zawadzki
parent bde783d460
commit 8d945f5256
2 changed files with 49 additions and 62 deletions

View File

@ -1,43 +0,0 @@
[Passthru]
# PT <bdev name> <vbdev name>
PT Malloc3 TestPT
[Malloc]
NumberOfLuns 8
LunSizeInMB 32
[Split]
# Split Malloc1 into two auto-sized halves
Split Malloc1 2
# Split Malloc2 into eight 4-megabyte pieces,
# leaving the rest of the device inaccessible
Split Malloc2 8 4
[AIO]
AIO /tmp/aiofile AIO0 2048
[QoS]
# QoS section defines limitation on performance
# metric like IOPS and bandwidth
#
# Format: Limit_IOPS Bdev_Name IOPS_Limit_Value
#
# IOPS limit must be 10000 or greater and be multiple
# of 10000
#
# Assign 20000 IOPS for the Malloc0 block device
Limit_IOPS Malloc0 20000
#
# Bandwidth limit must be 10 (MB) or greater and be
# multiple of 10
# Assign 100 (MB) bandwidth for the Malloc3 block
# device
Limit_BPS Malloc3 100
[RAID0]
Name raid0
StripSize 64
NumDevices 2
RaidLevel 0
Devices Malloc4 Malloc5

View File

@ -6,9 +6,42 @@ source $rootdir/test/common/autotest_common.sh
source $testdir/nbd_common.sh source $testdir/nbd_common.sh
rpc_py="$rootdir/scripts/rpc.py" rpc_py="$rootdir/scripts/rpc.py"
conf_file="$testdir/bdev.conf"
function setup_bdev_conf() {
# Create a file to be used as an AIO backend
dd if=/dev/zero of=/tmp/aiofile bs=2048 count=5000
cat >$conf_file <<-EOF
[AIO]
AIO /tmp/aiofile AIO0 2048
[Malloc]
NumberOfLuns 8
LunSizeInMB 32
[Split]
Split Malloc1 2
Split Malloc2 8 4
[Passthru]
PT Malloc3 TestPT
[QoS]
Limit_IOPS Malloc0 20000
Limit_BPS Malloc3 100
[RAID0]
Name raid0
StripSize 64
NumDevices 2
RaidLevel 0
Devices Malloc4 Malloc5
EOF
}
function bdev_bounds() { function bdev_bounds() {
$testdir/bdevio/bdevio -w -s $PRE_RESERVED_MEM -c $testdir/bdev.conf & $testdir/bdevio/bdevio -w -s $PRE_RESERVED_MEM -c $conf_file &
bdevio_pid=$! bdevio_pid=$!
trap 'killprocess $bdevio_pid; exit 1' SIGINT SIGTERM EXIT trap 'killprocess $bdevio_pid; exit 1' SIGINT SIGTERM EXIT
echo "Process bdevio pid: $bdevio_pid" echo "Process bdevio pid: $bdevio_pid"
@ -206,39 +239,36 @@ else
PRE_RESERVED_MEM=2048 PRE_RESERVED_MEM=2048
fi fi
# Create a file to be used as an AIO backend setup_bdev_conf
dd if=/dev/zero of=/tmp/aiofile bs=2048 count=5000 $rootdir/scripts/gen_nvme.sh >> $conf_file
cp $testdir/bdev.conf.in $testdir/bdev.conf
$rootdir/scripts/gen_nvme.sh >> $testdir/bdev.conf
if [ $SPDK_TEST_RBD -eq 1 ]; then if [ $SPDK_TEST_RBD -eq 1 ]; then
timing_enter rbd_setup timing_enter rbd_setup
rbd_setup 127.0.0.1 rbd_setup 127.0.0.1
timing_exit rbd_setup timing_exit rbd_setup
$rootdir/scripts/gen_rbd.sh >> $testdir/bdev.conf $rootdir/scripts/gen_rbd.sh >> $conf_file
fi fi
if [ $SPDK_TEST_CRYPTO -eq 1 ]; then if [ $SPDK_TEST_CRYPTO -eq 1 ]; then
$testdir/gen_crypto.sh Malloc6 Malloc7 >> $testdir/bdev.conf $testdir/gen_crypto.sh Malloc6 Malloc7 >> $conf_file
fi fi
if hash pmempool; then if hash pmempool; then
rm -f /tmp/spdk-pmem-pool rm -f /tmp/spdk-pmem-pool
pmempool create blk --size=32M 512 /tmp/spdk-pmem-pool pmempool create blk --size=32M 512 /tmp/spdk-pmem-pool
echo "[Pmem]" >> $testdir/bdev.conf echo "[Pmem]" >> $conf_file
echo " Blk /tmp/spdk-pmem-pool Pmem0" >> $testdir/bdev.conf echo " Blk /tmp/spdk-pmem-pool Pmem0" >> $conf_file
fi fi
timing_enter nbd_gpt timing_enter nbd_gpt
if grep -q Nvme0 $testdir/bdev.conf; then if grep -q Nvme0 $conf_file; then
part_dev_by_gpt $testdir/bdev.conf Nvme0n1 $rootdir part_dev_by_gpt $conf_file Nvme0n1 $rootdir
fi fi
timing_exit nbd_gpt timing_exit nbd_gpt
timing_enter bdev_svc timing_enter bdev_svc
bdevs=$(discover_bdevs $rootdir $testdir/bdev.conf | jq -r '.[] | select(.claimed == false)') bdevs=$(discover_bdevs $rootdir $conf_file | jq -r '.[] | select(.claimed == false)')
timing_exit bdev_svc timing_exit bdev_svc
bdevs_name=$(echo $bdevs | jq -r '.name') bdevs_name=$(echo $bdevs | jq -r '.name')
@ -254,9 +284,9 @@ $rootdir/scripts/gen_nvme.sh >> $testdir/bdev_gpt.conf
# End bdev configuration # End bdev configuration
#----------------------------------------------------- #-----------------------------------------------------
run_test "bdev_hello_world" $rootdir/examples/bdev/hello_world/hello_bdev -c $testdir/bdev.conf -b Malloc0 run_test "bdev_hello_world" $rootdir/examples/bdev/hello_world/hello_bdev -c $conf_file -b Malloc0
run_test "bdev_bounds" bdev_bounds run_test "bdev_bounds" bdev_bounds
run_test "bdev_nbd" nbd_function_test $testdir/bdev.conf "$bdevs_name" run_test "bdev_nbd" nbd_function_test $conf_file "$bdevs_name"
if [ -d /usr/src/fio ]; then if [ -d /usr/src/fio ]; then
run_test "bdev_fio" fio_test_suite run_test "bdev_fio" fio_test_suite
else else
@ -271,17 +301,17 @@ run_test "bdev_qos" qos_test_suite
# Temporarily disabled - infinite loop # Temporarily disabled - infinite loop
# if [ $RUN_NIGHTLY -eq 1 ]; then # if [ $RUN_NIGHTLY -eq 1 ]; then
# run_test "bdev_gpt_reset" $testdir/bdevperf/bdevperf -c $testdir/bdev.conf -q 16 -w reset -o 4096 -t 60 # run_test "bdev_gpt_reset" $testdir/bdevperf/bdevperf -c $conf_file -q 16 -w reset -o 4096 -t 60
# fi # fi
# Bdev and configuration cleanup below this line # Bdev and configuration cleanup below this line
#----------------------------------------------------- #-----------------------------------------------------
if grep -q Nvme0 $testdir/bdev.conf; then if grep -q Nvme0 $conf_file; then
part_dev_by_gpt $testdir/bdev.conf Nvme0n1 $rootdir reset part_dev_by_gpt $conf_file Nvme0n1 $rootdir reset
fi fi
rm -f $testdir/bdev_gpt.conf rm -f $testdir/bdev_gpt.conf
rm -f /tmp/aiofile rm -f /tmp/aiofile
rm -f /tmp/spdk-pmem-pool rm -f /tmp/spdk-pmem-pool
rm -f $testdir/bdev.conf rm -f $conf_file
rbd_cleanup rbd_cleanup