2016-07-20 11:16:23 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
2018-03-22 12:43:32 -07:00
|
|
|
rootdir=$(readlink -f $testdir/../..)
|
2019-06-10 09:16:46 +02:00
|
|
|
source $rootdir/test/common/autotest_common.sh
|
|
|
|
source $testdir/nbd_common.sh
|
|
|
|
|
2018-09-11 15:26:14 +02:00
|
|
|
rpc_py="$rootdir/scripts/rpc.py"
|
2016-07-20 11:16:23 -07:00
|
|
|
|
2017-08-28 18:27:36 +02:00
|
|
|
function run_fio()
|
|
|
|
{
|
|
|
|
if [ $RUN_NIGHTLY -eq 0 ]; then
|
2019-05-30 02:59:51 -04:00
|
|
|
fio_bdev --ioengine=spdk_bdev --iodepth=8 --bs=4k --runtime=10 $testdir/bdev.fio "$@"
|
2018-12-11 15:48:23 +01:00
|
|
|
elif [ $RUN_NIGHTLY_FAILING -eq 1 ]; then
|
2017-08-28 18:27:36 +02:00
|
|
|
# Use size 192KB which both exceeds typical 128KB max NVMe I/O
|
|
|
|
# size and will cross 128KB Intel DC P3700 stripe boundaries.
|
2019-05-30 02:59:51 -04:00
|
|
|
fio_bdev --ioengine=spdk_bdev --iodepth=128 --bs=192k --runtime=100 $testdir/bdev.fio "$@"
|
2017-08-28 18:27:36 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2017-12-13 20:44:56 -05:00
|
|
|
function nbd_function_test() {
|
|
|
|
if [ $(uname -s) = Linux ] && modprobe -n nbd; then
|
|
|
|
local rpc_server=/var/tmp/spdk-nbd.sock
|
|
|
|
local conf=$1
|
|
|
|
local nbd_num=6
|
2019-06-12 09:48:32 +02:00
|
|
|
local nbd_all=($(ls /dev/nbd* | grep -v p))
|
2017-12-13 20:44:56 -05:00
|
|
|
local bdev_all=($bdevs_name)
|
|
|
|
local nbd_list=(${nbd_all[@]:0:$nbd_num})
|
|
|
|
local bdev_list=(${bdev_all[@]:0:$nbd_num})
|
|
|
|
|
|
|
|
if [ ! -e $conf ]; then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
modprobe nbd
|
|
|
|
$rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -i 0 -c ${conf} &
|
|
|
|
nbd_pid=$!
|
2019-08-09 10:46:01 +02:00
|
|
|
trap 'killprocess $nbd_pid; exit 1' SIGINT SIGTERM EXIT
|
2017-12-13 20:44:56 -05:00
|
|
|
echo "Process nbd pid: $nbd_pid"
|
|
|
|
waitforlisten $nbd_pid $rpc_server
|
|
|
|
|
2019-01-15 20:52:11 +08:00
|
|
|
nbd_rpc_start_stop_verify $rpc_server "${bdev_list[*]}"
|
2017-12-13 20:44:56 -05:00
|
|
|
nbd_rpc_data_verify $rpc_server "${bdev_list[*]}" "${nbd_list[*]}"
|
|
|
|
|
2018-06-22 14:30:19 +02:00
|
|
|
$rpc_py -s $rpc_server delete_passthru_bdev TestPT
|
|
|
|
|
2017-12-13 20:44:56 -05:00
|
|
|
killprocess $nbd_pid
|
2019-06-11 09:07:55 -04:00
|
|
|
trap - SIGINT SIGTERM EXIT
|
2017-12-13 20:44:56 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
2016-07-20 11:16:23 -07:00
|
|
|
|
2017-07-14 16:31:43 -07:00
|
|
|
timing_enter bdev
|
2016-07-20 11:16:23 -07:00
|
|
|
|
2017-08-09 17:28:32 -07:00
|
|
|
# Create a file to be used as an AIO backend
|
|
|
|
dd if=/dev/zero of=/tmp/aiofile bs=2048 count=5000
|
|
|
|
|
2017-01-25 16:36:40 -07:00
|
|
|
cp $testdir/bdev.conf.in $testdir/bdev.conf
|
|
|
|
$rootdir/scripts/gen_nvme.sh >> $testdir/bdev.conf
|
|
|
|
|
2017-08-10 16:33:43 -07:00
|
|
|
if [ $SPDK_TEST_RBD -eq 1 ]; then
|
2018-04-16 09:12:23 -04:00
|
|
|
timing_enter rbd_setup
|
|
|
|
rbd_setup 127.0.0.1
|
|
|
|
timing_exit rbd_setup
|
|
|
|
|
2017-08-10 16:33:43 -07:00
|
|
|
$rootdir/scripts/gen_rbd.sh >> $testdir/bdev.conf
|
|
|
|
fi
|
|
|
|
|
2018-10-15 14:38:49 -07:00
|
|
|
if [ $SPDK_TEST_CRYPTO -eq 1 ]; then
|
2019-04-23 08:18:54 -07:00
|
|
|
$testdir/gen_crypto.sh Malloc6 Malloc7 >> $testdir/bdev.conf
|
2018-10-15 14:38:49 -07:00
|
|
|
fi
|
|
|
|
|
2018-03-30 10:08:58 -07:00
|
|
|
if hash pmempool; then
|
|
|
|
rm -f /tmp/spdk-pmem-pool
|
|
|
|
pmempool create blk --size=32M 512 /tmp/spdk-pmem-pool
|
|
|
|
echo "[Pmem]" >> $testdir/bdev.conf
|
|
|
|
echo " Blk /tmp/spdk-pmem-pool Pmem0" >> $testdir/bdev.conf
|
|
|
|
fi
|
|
|
|
|
2019-05-01 19:36:14 -04:00
|
|
|
if [ $RUN_NIGHTLY -eq 1 ]; then
|
|
|
|
timing_enter hello_bdev
|
|
|
|
if grep -q Nvme0 $testdir/bdev.conf; then
|
|
|
|
$rootdir/examples/bdev/hello_world/hello_bdev -c $testdir/bdev.conf -b Nvme0n1
|
|
|
|
fi
|
|
|
|
timing_exit hello_bdev
|
2018-04-09 17:13:40 -07:00
|
|
|
fi
|
|
|
|
|
2016-10-11 09:02:37 -07:00
|
|
|
timing_enter bounds
|
2018-05-29 10:55:42 -04:00
|
|
|
if [ $(uname -s) = Linux ]; then
|
|
|
|
# Test dynamic memory management. All hugepages will be reserved at runtime
|
|
|
|
PRE_RESERVED_MEM=0
|
|
|
|
else
|
|
|
|
# Dynamic memory management is not supported on BSD
|
|
|
|
PRE_RESERVED_MEM=2048
|
|
|
|
fi
|
2019-06-10 02:06:11 -04:00
|
|
|
$testdir/bdevio/bdevio -w -s $PRE_RESERVED_MEM -c $testdir/bdev.conf &
|
|
|
|
bdevio_pid=$!
|
2019-08-09 10:46:01 +02:00
|
|
|
trap 'killprocess $bdevio_pid; exit 1' SIGINT SIGTERM EXIT
|
2019-06-10 02:06:11 -04:00
|
|
|
echo "Process bdevio pid: $bdevio_pid"
|
|
|
|
waitforlisten $bdevio_pid
|
|
|
|
$testdir/bdevio/tests.py perform_tests
|
|
|
|
killprocess $bdevio_pid
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
2016-10-11 09:02:37 -07:00
|
|
|
timing_exit bounds
|
2016-07-20 11:16:23 -07:00
|
|
|
|
2017-12-13 20:44:56 -05:00
|
|
|
timing_enter nbd_gpt
|
2017-07-17 15:45:46 +08:00
|
|
|
if grep -q Nvme0 $testdir/bdev.conf; then
|
|
|
|
part_dev_by_gpt $testdir/bdev.conf Nvme0n1 $rootdir
|
2017-06-01 13:02:54 +08:00
|
|
|
fi
|
2017-12-13 20:44:56 -05:00
|
|
|
timing_exit nbd_gpt
|
2017-06-01 13:02:54 +08:00
|
|
|
|
2017-07-20 07:11:47 -07:00
|
|
|
timing_enter bdev_svc
|
2017-09-18 14:15:34 +02:00
|
|
|
bdevs=$(discover_bdevs $rootdir $testdir/bdev.conf | jq -r '.[] | select(.claimed == false)')
|
2017-07-20 07:11:47 -07:00
|
|
|
timing_exit bdev_svc
|
|
|
|
|
2017-12-13 20:44:56 -05:00
|
|
|
timing_enter nbd
|
|
|
|
bdevs_name=$(echo $bdevs | jq -r '.name')
|
|
|
|
nbd_function_test $testdir/bdev.conf "$bdevs_name"
|
|
|
|
timing_exit nbd
|
|
|
|
|
2019-05-30 03:29:06 -04:00
|
|
|
if [ -d /usr/src/fio ]; then
|
2017-07-14 16:31:43 -07:00
|
|
|
timing_enter fio
|
2016-07-20 11:16:23 -07:00
|
|
|
|
2017-07-19 14:55:03 -07:00
|
|
|
timing_enter fio_rw_verify
|
2017-07-14 16:31:43 -07:00
|
|
|
# Generate the fio config file given the list of all unclaimed bdevs
|
|
|
|
fio_config_gen $testdir/bdev.fio verify
|
|
|
|
for b in $(echo $bdevs | jq -r '.name'); do
|
|
|
|
fio_config_add_job $testdir/bdev.fio $b
|
|
|
|
done
|
2016-08-04 16:12:51 -07:00
|
|
|
|
2018-05-29 10:55:42 -04:00
|
|
|
run_fio --spdk_conf=./test/bdev/bdev.conf --spdk_mem=$PRE_RESERVED_MEM
|
2017-07-14 16:31:43 -07:00
|
|
|
|
|
|
|
rm -f *.state
|
|
|
|
rm -f $testdir/bdev.fio
|
2017-07-19 14:55:03 -07:00
|
|
|
timing_exit fio_rw_verify
|
|
|
|
|
|
|
|
timing_enter fio_trim
|
|
|
|
# Generate the fio config file given the list of all unclaimed bdevs that support unmap
|
|
|
|
fio_config_gen $testdir/bdev.fio trim
|
|
|
|
for b in $(echo $bdevs | jq -r 'select(.supported_io_types.unmap == true) | .name'); do
|
|
|
|
fio_config_add_job $testdir/bdev.fio $b
|
|
|
|
done
|
|
|
|
|
2018-03-22 12:43:32 -07:00
|
|
|
run_fio --spdk_conf=./test/bdev/bdev.conf
|
2017-07-19 14:55:03 -07:00
|
|
|
|
|
|
|
rm -f *.state
|
|
|
|
rm -f $testdir/bdev.fio
|
|
|
|
timing_exit fio_trim
|
2017-12-18 14:20:41 -07:00
|
|
|
report_test_completion "bdev_fio"
|
2017-07-14 16:31:43 -07:00
|
|
|
timing_exit fio
|
2019-05-30 04:08:19 -04:00
|
|
|
else
|
|
|
|
echo "FIO not available"
|
|
|
|
exit 1
|
2017-07-14 16:31:43 -07:00
|
|
|
fi
|
|
|
|
|
2017-12-07 21:37:12 +08:00
|
|
|
# Create conf file for bdevperf with gpt
|
|
|
|
cat > $testdir/bdev_gpt.conf << EOL
|
|
|
|
[Gpt]
|
|
|
|
Disable No
|
|
|
|
EOL
|
|
|
|
|
|
|
|
# Get Nvme info through filtering gen_nvme.sh's result
|
|
|
|
$rootdir/scripts/gen_nvme.sh >> $testdir/bdev_gpt.conf
|
|
|
|
|
|
|
|
# Run bdevperf with gpt
|
2018-08-09 13:54:39 +02:00
|
|
|
$testdir/bdevperf/bdevperf -c $testdir/bdev_gpt.conf -q 128 -o 4096 -w verify -t 5
|
2018-09-05 15:09:14 -07:00
|
|
|
$testdir/bdevperf/bdevperf -c $testdir/bdev_gpt.conf -q 128 -o 4096 -w write_zeroes -t 1
|
2017-12-07 21:37:12 +08:00
|
|
|
rm -f $testdir/bdev_gpt.conf
|
|
|
|
|
2017-07-14 16:31:43 -07:00
|
|
|
if [ $RUN_NIGHTLY -eq 1 ]; then
|
2017-04-14 15:41:24 -07:00
|
|
|
# Temporarily disabled - infinite loop
|
2017-07-19 14:55:03 -07:00
|
|
|
timing_enter reset
|
2018-08-09 13:54:39 +02:00
|
|
|
#$testdir/bdevperf/bdevperf -c $testdir/bdev.conf -q 16 -w reset -o 4096 -t 60
|
2017-07-19 14:55:03 -07:00
|
|
|
timing_exit reset
|
2017-12-18 14:20:41 -07:00
|
|
|
report_test_completion "nightly_bdev_reset"
|
2016-07-20 11:16:23 -07:00
|
|
|
fi
|
|
|
|
|
2017-08-11 15:06:17 -07:00
|
|
|
|
|
|
|
if grep -q Nvme0 $testdir/bdev.conf; then
|
|
|
|
part_dev_by_gpt $testdir/bdev.conf Nvme0n1 $rootdir reset
|
|
|
|
fi
|
|
|
|
|
2017-08-09 17:28:32 -07:00
|
|
|
rm -f /tmp/aiofile
|
2018-03-30 10:08:58 -07:00
|
|
|
rm -f /tmp/spdk-pmem-pool
|
2017-01-25 16:36:40 -07:00
|
|
|
rm -f $testdir/bdev.conf
|
2018-04-16 09:12:23 -04:00
|
|
|
rbd_cleanup
|
2017-12-18 14:20:41 -07:00
|
|
|
report_test_completion "bdev"
|
2017-07-14 16:31:43 -07:00
|
|
|
timing_exit bdev
|