From de30327534bcd7a37e74df6109659c0d4d3e5f16 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Tue, 17 Dec 2019 13:31:51 -0700 Subject: [PATCH] test/blockdev: parameterize the blockdev tests. Now we can actually know which tests we are running on which bdevs when we call blockdev.sh. Removing the conditionals from the configuration setup (or failing if they don't succeed) and then calling run_test from the top level allows us to reliably track the bdev tests and fail if they don't run on a desired class of bdev. Change-Id: I14e6e3d993b4af4995adcbc5f138bac4ae9d63be Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478247 Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Karol Latecki Reviewed-by: Jim Harris --- autotest.sh | 10 +++++- test/bdev/blockdev.sh | 71 ++++++++++++++++++++++++++++--------------- 2 files changed, 56 insertions(+), 25 deletions(-) diff --git a/autotest.sh b/autotest.sh index 80093a6e1..0eb1948b5 100755 --- a/autotest.sh +++ b/autotest.sh @@ -159,7 +159,7 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then run_test "spdkcli_tcp" test/spdkcli/tcp.sh if [ $SPDK_TEST_BLOCKDEV -eq 1 ]; then - run_test "blockdev" test/bdev/blockdev.sh + run_test "blockdev_general" test/bdev/blockdev.sh run_test "bdev_raid" test/bdev/bdev_raid.sh fi @@ -172,6 +172,8 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then fi if [ $SPDK_TEST_NVME -eq 1 ]; then + run_test "blockdev_nvme" test/bdev/blockdev.sh "nvme" + run_test "blockdev_nvme_gpt" test/bdev/blockdev.sh "gpt" run_test "nvme" test/nvme/nvme.sh if [[ $SPDK_TEST_NVME_CLI -eq 1 ]]; then run_test "nvme_cli" test/nvme/spdk_nvme_cli.sh @@ -252,11 +254,13 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then fi if [ $SPDK_TEST_PMDK -eq 1 ]; then + run_test "blockdev_pmem" ./test/bdev/blockdev.sh "pmem" run_test "pmem" ./test/pmem/pmem.sh -x run_test "spdkcli_pmem" ./test/spdkcli/pmem.sh fi if [ $SPDK_TEST_RBD -eq 1 ]; then + run_test "blockdev_rbd" ./test/bdev/blockdev.sh "rbd" run_test "spdkcli_rbd" ./test/spdkcli/rbd.sh fi @@ -279,6 +283,10 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then if [ $SPDK_TEST_OPAL -eq 1 ]; then run_test "nvme_opal" ./test/nvme/nvme_opal.sh fi + + if [ $SPDK_TEST_CRYPTO -eq 1 ]; then + run_test "blockdev_crypto" ./test/bdev/blockdev.sh "crypto" + fi fi timing_enter cleanup diff --git a/test/bdev/blockdev.sh b/test/bdev/blockdev.sh index 989c644da..643f04cd8 100755 --- a/test/bdev/blockdev.sh +++ b/test/bdev/blockdev.sh @@ -17,7 +17,7 @@ dd if=/dev/zero of=/tmp/aiofile bs=2048 count=5000 AIO /tmp/aiofile AIO0 2048 [Malloc] - NumberOfLuns 8 + NumberOfLuns 6 LunSizeInMB 32 [Split] @@ -45,17 +45,21 @@ function setup_nvme_conf() { } function setup_gpt_conf() { - timing_enter nbd_gpt + setup_nvme_conf if grep -q Nvme0 $conf_file; then part_dev_by_gpt $conf_file Nvme0n1 $rootdir + else + return 1 fi - timing_exit nbd_gpt } function setup_crypto_conf() { - if [ $SPDK_TEST_CRYPTO -eq 1 ]; then - $testdir/gen_crypto.sh Malloc6 Malloc7 >> $conf_file - fi + cat >$conf_file <<-EOF + [Malloc] + NumberOfLuns 2 + LunSizeInMB 32 + EOF + $testdir/gen_crypto.sh Malloc0 Malloc1 >> $conf_file } function setup_pmem_conf() { @@ -64,17 +68,17 @@ function setup_pmem_conf() { pmempool create blk --size=32M 512 /tmp/spdk-pmem-pool echo "[Pmem]" >> $conf_file echo " Blk /tmp/spdk-pmem-pool Pmem0" >> $conf_file + else + return 1 fi } function setup_rbd_conf() { - if [ $SPDK_TEST_RBD -eq 1 ]; then - timing_enter rbd_setup - rbd_setup 127.0.0.1 - timing_exit rbd_setup + timing_enter rbd_setup + rbd_setup 127.0.0.1 + timing_exit rbd_setup - $rootdir/scripts/gen_rbd.sh >> $conf_file - fi + $rootdir/scripts/gen_rbd.sh >> $conf_file } function bdev_bounds() { @@ -282,17 +286,28 @@ else PRE_RESERVED_MEM=2048 fi -setup_bdev_conf -setup_nvme_conf -setup_gpt_conf -setup_crypto_conf -setup_pmem_conf -setup_rbd_conf +test_type=$1 +[ -z "$test_type" ] && setup_bdev_conf +if [ -n "$test_type" ]; then + case "$test_type" in + nvme ) + setup_nvme_conf;; + gpt ) + setup_gpt_conf;; + crypto ) + setup_crypto_conf;; + pmem ) + setup_pmem_conf;; + rbd ) + setup_rbd_conf;; + * ) + echo "invalid test name" + exit 1 + ;; + esac +fi -timing_enter bdev_svc bdevs=$(discover_bdevs $rootdir $conf_file | jq -r '.[] | select(.claimed == false)') -timing_exit bdev_svc - bdevs_name=$(echo $bdevs | jq -r '.name') bdev_list=($bdevs_name) hello_world_bdev=${bdev_list[0]} @@ -303,7 +318,12 @@ run_test "bdev_hello_world" $rootdir/examples/bdev/hello_world/hello_bdev -c $co run_test "bdev_bounds" bdev_bounds run_test "bdev_nbd" nbd_function_test $conf_file "$bdevs_name" if [ -d /usr/src/fio ]; then - run_test "bdev_fio" fio_test_suite + if [ "$test_type" = "nvme" ] || [ "$test_type" = "gpt" ]; then + # TODO: once we get real multi-ns drives, re-enable this test for NVMe. + echo "skipping fio tests on NVMe due to multi-ns failures." + else + run_test "bdev_fio" fio_test_suite + fi else echo "FIO not available" exit 1 @@ -311,7 +331,10 @@ fi run_test "bdev_verify" $testdir/bdevperf/bdevperf -c $conf_file -q 128 -o 4096 -w verify -t 5 run_test "bdev_write_zeroes" $testdir/bdevperf/bdevperf -c $conf_file -q 128 -o 4096 -w write_zeroes -t 1 -run_test "bdev_qos" qos_test_suite + +if [ -z $test_type ]; then + run_test "bdev_qos" qos_test_suite +fi # Temporarily disabled - infinite loop # if [ $RUN_NIGHTLY -eq 1 ]; then @@ -320,7 +343,7 @@ run_test "bdev_qos" qos_test_suite # Bdev and configuration cleanup below this line #----------------------------------------------------- -if grep -q Nvme0 $conf_file; then +if [ "$test_type" = "gpt" ]; then part_dev_by_gpt $conf_file Nvme0n1 $rootdir reset fi