From 968d4dfd6520503288c678014e42bdf099bbb7c9 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Wed, 4 Dec 2019 15:25:07 -0700 Subject: [PATCH] test/vmd: convert to run_test framework This makes the script much more readable and helps delineate test cases more clearly. Change-Id: I729ca0380a7173151d074ebd73ed9766c5008480 Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476821 Tested-by: SPDK CI Jenkins Reviewed-by: Karol Latecki Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- test/vmd/vmd.sh | 68 +++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/test/vmd/vmd.sh b/test/vmd/vmd.sh index 5a3e1068f..54b64be41 100755 --- a/test/vmd/vmd.sh +++ b/test/vmd/vmd.sh @@ -14,43 +14,49 @@ if [ -z "$pci_devs" ]; then exit 1 fi -timing_enter identify -for bdf in $pci_devs; do - $rootdir/examples/nvme/identify/identify -i 0 -V -r "trtype:PCIe traddr:$bdf" -done -timing_exit identify +function vmd_identify { + for bdf in $pci_devs; do + $rootdir/examples/nvme/identify/identify -i 0 -V -r "trtype:PCIe traddr:$bdf" + done +} -timing_enter hello_world -$rootdir/examples/nvme/hello_world/hello_world -V -timing_exit +function vmd_perf { + for bdf in $pci_devs; do + $rootdir/examples/nvme/perf/perf -q 128 -w read -o 12288 -t 1 -LL -i 0 -V -r "trtype:PCIe traddr:$bdf" + done +} -timing_enter perf -for bdf in $pci_devs; do - $rootdir/examples/nvme/perf/perf -q 128 -w read -o 12288 -t 1 -LL -i 0 -V -r "trtype:PCIe traddr:$bdf" -done -timing_exit perf - -if [ -d /usr/src/fio ]; then - timing_enter fio_plugin +function vmd_fio { PLUGIN_DIR=$rootdir/examples/nvme/fio_plugin for bdf in $pci_devs; do fio_nvme $testdir/config/config.fio --filename="trtype=PCIe traddr=${bdf//:/.} ns=1" report_test_completion "bdev_fio" done - timing_exit fio_plugin +} + +function vmd_bdev_svc { + $rootdir/test/app/bdev_svc/bdev_svc --wait-for-rpc & svcpid=$! + trap 'killprocess $svcpid; exit 1' SIGINT SIGTERM EXIT + + # Wait until bdev_svc starts + waitforlisten $svcpid + + $rpc_py enable_vmd + $rpc_py framework_start_init + + for bdf in $pci_devs; do + $rpc_py bdev_nvme_attach_controller -b NVMe_$bdf -t PCIe -a $bdf + done + + trap - SIGINT SIGTERM EXIT + killprocess $svcpid +} + +run_test "case" "vmd_identify" vmd_identify +run_test "case" "vmd_hello_world" $rootdir/examples/nvme/hello_world/hello_world -V +run_test "case" "vmd_perf" vmd_perf +if [ -d /usr/src/fio ]; then + run_test "case" "vmd_fio" vmd_fio fi -$rootdir/test/app/bdev_svc/bdev_svc --wait-for-rpc & svcpid=$! -trap 'killprocess $svcpid; exit 1' SIGINT SIGTERM EXIT -# Wait until bdev_svc starts -waitforlisten $svcpid - -$rpc_py enable_vmd -$rpc_py framework_start_init - -for bdf in $pci_devs; do - $rpc_py bdev_nvme_attach_controller -b NVMe_$bdf -t PCIe -a $bdf -done - -trap - SIGINT SIGTERM EXIT -killprocess $svcpid +run_test "case" "vmd_bdev_svc" vmd_bdev_svc