2018-10-29 14:40:34 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
|
|
|
rootdir=$(readlink -f $testdir/../..)
|
|
|
|
source $rootdir/test/common/autotest_common.sh
|
2019-09-25 12:09:51 +00:00
|
|
|
source $testdir/common.sh
|
2018-10-29 14:40:34 +00:00
|
|
|
|
2019-01-29 09:54:46 +00:00
|
|
|
declare -A suite
|
|
|
|
suite['basic']='randw-verify randw-verify-j2 randw-verify-depth128'
|
|
|
|
suite['extended']='drive-prep randw-verify-qd128-ext randw randr randrw'
|
|
|
|
|
2019-09-25 12:09:51 +00:00
|
|
|
rpc_py=$rootdir/scripts/rpc.py
|
|
|
|
ftl_bdev_conf=$testdir/config/ftl.conf
|
|
|
|
gen_ftl_nvme_conf > $ftl_bdev_conf
|
|
|
|
|
|
|
|
fio_kill() {
|
|
|
|
$rpc_py stop_nbd_disk /dev/nbd0
|
|
|
|
rmmod nbd || true
|
|
|
|
killprocess $svcpid
|
|
|
|
rm -f $ftl_bdev_conf
|
|
|
|
}
|
|
|
|
|
2018-10-29 14:40:34 +00:00
|
|
|
device=$1
|
2019-01-29 09:54:46 +00:00
|
|
|
tests=${suite[$2]}
|
|
|
|
uuid=$3
|
2018-10-29 14:40:34 +00:00
|
|
|
|
|
|
|
if [ ! -d /usr/src/fio ]; then
|
|
|
|
echo "FIO not available"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-01-29 09:54:46 +00:00
|
|
|
if [ -z "$tests" ]; then
|
|
|
|
echo "Invalid test suite '$2'"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-09-25 12:09:51 +00:00
|
|
|
export FTL_BDEV_NAME=/dev/nbd0
|
|
|
|
|
|
|
|
trap "fio_kill; exit 1" SIGINT SIGTERM EXIT
|
|
|
|
|
|
|
|
$rootdir/app/spdk_tgt/spdk_tgt -c $ftl_bdev_conf & svcpid=$!
|
|
|
|
waitforlisten $svcpid
|
|
|
|
|
|
|
|
$rpc_py bdev_nvme_attach_controller -b nvme0 -a $device -t pcie
|
|
|
|
$rpc_py bdev_ocssd_create -c nvme0 -b nvme0n1
|
2019-01-29 09:54:46 +00:00
|
|
|
|
|
|
|
if [ -z "$uuid" ]; then
|
2020-01-16 13:30:17 +00:00
|
|
|
$rpc_py bdev_ftl_create -b ftl0 -d nvme0n1
|
2019-01-29 09:54:46 +00:00
|
|
|
else
|
2020-01-16 13:30:17 +00:00
|
|
|
$rpc_py bdev_ftl_create -b ftl0 -d nvme0n1 -u $uuid
|
2019-01-29 09:54:46 +00:00
|
|
|
fi
|
2018-10-29 14:40:34 +00:00
|
|
|
|
2019-09-25 12:09:51 +00:00
|
|
|
modprobe nbd
|
|
|
|
$rpc_py start_nbd_disk ftl0 /dev/nbd0
|
|
|
|
waitfornbd nbd0
|
|
|
|
|
2019-11-29 10:49:39 +00:00
|
|
|
for test in ${tests}; do
|
2018-10-29 14:40:34 +00:00
|
|
|
timing_enter $test
|
2019-05-30 06:59:51 +00:00
|
|
|
fio_bdev $testdir/config/fio/$test.fio
|
2018-10-29 14:40:34 +00:00
|
|
|
timing_exit $test
|
|
|
|
done
|
2019-09-25 12:09:51 +00:00
|
|
|
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
fio_kill
|