test/nvme: convert tests into run_test

This unifies the script and makes it easy to see what exactly we are
testing.

Change-Id: Icdbc08077ea4397bfde50493c718f99c3c499062
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476809
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
This commit is contained in:
Seth Howell 2019-12-04 15:02:00 -07:00 committed by Tomasz Zawadzki
parent 785c3f0fe4
commit a0304f54f9

View File

@ -5,6 +5,46 @@ rootdir=$(readlink -f $testdir/../..)
source $rootdir/scripts/common.sh source $rootdir/scripts/common.sh
source $rootdir/test/common/autotest_common.sh source $rootdir/test/common/autotest_common.sh
function nvme_identify {
$rootdir/examples/nvme/identify/identify -i 0
for bdf in $(iter_pci_class_code 01 08 02); do
$rootdir/examples/nvme/identify/identify -r "trtype:PCIe traddr:${bdf}" -i 0
done
timing_exit identify
}
function nvme_perf {
# enable no shutdown notification option
$rootdir/examples/nvme/perf/perf -q 128 -w read -o 12288 -t 1 -LL -i 0 -N
$rootdir/examples/nvme/perf/perf -q 128 -w write -o 12288 -t 1 -LL -i 0
if [ -b /dev/ram0 ]; then
# Test perf with AIO device
$rootdir/examples/nvme/perf/perf /dev/ram0 -q 128 -w read -o 12288 -t 1 -LL -i 0
report_test_completion "nvme_perf"
fi
}
function nvme_fio_test {
PLUGIN_DIR=$rootdir/examples/nvme/fio_plugin
for bdf in $(iter_pci_class_code 01 08 02); do
for blkname in $(get_nvme_name_from_bdf $bdf); do
fio_nvme $PLUGIN_DIR/example_config.fio --filename="trtype=PCIe traddr=${bdf//:/.} ns=${blkname##*n}"
report_test_completion "nvme_fio"
done
done
}
function nvme_multi_secondary {
$rootdir/examples/nvme/perf/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x1 &
pid0=$!
$rootdir/examples/nvme/perf/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x2 &
pid1=$!
$rootdir/examples/nvme/perf/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x4
wait $pid0
wait $pid1
report_test_completion "nvme_multi_secondary"
}
if [ $(uname) = Linux ]; then if [ $(uname) = Linux ]; then
# check that our setup.sh script does not bind NVMe devices to uio/vfio if they # check that our setup.sh script does not bind NVMe devices to uio/vfio if they
# have an active mountpoint # have an active mountpoint
@ -69,92 +109,25 @@ if [ $(uname) = Linux ]; then
trap "kill_stub -9; exit 1" SIGINT SIGTERM EXIT trap "kill_stub -9; exit 1" SIGINT SIGTERM EXIT
fi fi
timing_enter reset run_test "case" "nvme_reset" $testdir/reset/reset -q 64 -w write -s 4096 -t 5
$testdir/reset/reset -q 64 -w write -s 4096 -t 5 run_test "case" "nvme_identify" nvme_identify
timing_exit reset run_test "case" "nvme_perf" nvme_perf
run_test "case" "nvme_reserve" $rootdir/examples/nvme/reserve/reserve
timing_enter identify run_test "case" "nvme_hello_world" $rootdir/examples/nvme/hello_world/hello_world
$rootdir/examples/nvme/identify/identify -i 0 run_test "case" "nvme_deallocated_value" $testdir/deallocated_value/deallocated_value
for bdf in $(iter_pci_class_code 01 08 02); do run_test "case" "nvme_sgl" $testdir/sgl/sgl
$rootdir/examples/nvme/identify/identify -r "trtype:PCIe traddr:${bdf}" -i 0 run_test "case" "nvme_e2edp" $testdir/e2edp/nvme_dp
done run_test "case" "nvme_err_injection" $testdir/err_injection/err_injection
timing_exit identify run_test "case" "nvme_overhead" $testdir/overhead/overhead -s 4096 -t 1 -H
run_test "case" "nvme_arbitration" $rootdir/examples/nvme/arbitration/arbitration -t 3 -i 0
timing_enter perf
#enable no shutdown notification option
$rootdir/examples/nvme/perf/perf -q 128 -w read -o 12288 -t 1 -LL -i 0 -N
$rootdir/examples/nvme/perf/perf -q 128 -w write -o 12288 -t 1 -LL -i 0
if [ -b /dev/ram0 ]; then
# Test perf with AIO device
$rootdir/examples/nvme/perf/perf /dev/ram0 -q 128 -w read -o 12288 -t 1 -LL -i 0
report_test_completion "nvme_perf"
fi
timing_exit perf
timing_enter reserve
$rootdir/examples/nvme/reserve/reserve
timing_exit reserve
timing_enter hello_world
$rootdir/examples/nvme/hello_world/hello_world
timing_exit
timing_enter deallocated_value
$testdir/deallocated_value/deallocated_value
timing_exit deallocated_value
timing_enter sgl
$testdir/sgl/sgl
timing_exit sgl
timing_enter e2edp
$testdir/e2edp/nvme_dp
timing_exit e2edp
timing_enter err_injection
$testdir/err_injection/err_injection
timing_exit err_injection
if [ $(uname) != "FreeBSD" ]; then if [ $(uname) != "FreeBSD" ]; then
timing_enter startup run_test "case" "nvme_startup" $testdir/startup/startup -t 1000000
$testdir/startup/startup -t 1000000 run_test "case" "nvme_multi_secondary" nvme_multi_secondary
timing_exit startup
fi
timing_enter overhead
$testdir/overhead/overhead -s 4096 -t 1 -H
timing_exit overhead
timing_enter arbitration
$rootdir/examples/nvme/arbitration/arbitration -t 3 -i 0
timing_exit arbitration
if [ $(uname) = Linux ]; then
timing_enter multi_secondary
$rootdir/examples/nvme/perf/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x1 &
pid0=$!
$rootdir/examples/nvme/perf/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x2 &
pid1=$!
$rootdir/examples/nvme/perf/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x4
wait $pid0
wait $pid1
report_test_completion "nvme_multi_secondary"
timing_exit multi_secondary
fi
if [ $(uname) = Linux ]; then
trap - SIGINT SIGTERM EXIT trap - SIGINT SIGTERM EXIT
kill_stub kill_stub
fi fi
if [ -d /usr/src/fio ]; then if [ -d /usr/src/fio ]; then
timing_enter fio_plugin run_test "case" "nvme_fio" nvme_fio_test
PLUGIN_DIR=$rootdir/examples/nvme/fio_plugin
for bdf in $(iter_pci_class_code 01 08 02); do
for blkname in $(get_nvme_name_from_bdf $bdf); do
fio_nvme $PLUGIN_DIR/example_config.fio --filename="trtype=PCIe traddr=${bdf//:/.} ns=${blkname##*n}"
report_test_completion "bdev_fio"
done
done
timing_exit fio_plugin
fi fi