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 <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478247
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2019-12-17 13:31:51 -07:00 committed by Tomasz Zawadzki
parent 6ac949c0d1
commit de30327534
2 changed files with 56 additions and 25 deletions

View File

@ -159,7 +159,7 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
run_test "spdkcli_tcp" test/spdkcli/tcp.sh run_test "spdkcli_tcp" test/spdkcli/tcp.sh
if [ $SPDK_TEST_BLOCKDEV -eq 1 ]; then 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 run_test "bdev_raid" test/bdev/bdev_raid.sh
fi fi
@ -172,6 +172,8 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
fi fi
if [ $SPDK_TEST_NVME -eq 1 ]; then 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 run_test "nvme" test/nvme/nvme.sh
if [[ $SPDK_TEST_NVME_CLI -eq 1 ]]; then if [[ $SPDK_TEST_NVME_CLI -eq 1 ]]; then
run_test "nvme_cli" test/nvme/spdk_nvme_cli.sh run_test "nvme_cli" test/nvme/spdk_nvme_cli.sh
@ -252,11 +254,13 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
fi fi
if [ $SPDK_TEST_PMDK -eq 1 ]; then 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 "pmem" ./test/pmem/pmem.sh -x
run_test "spdkcli_pmem" ./test/spdkcli/pmem.sh run_test "spdkcli_pmem" ./test/spdkcli/pmem.sh
fi fi
if [ $SPDK_TEST_RBD -eq 1 ]; then if [ $SPDK_TEST_RBD -eq 1 ]; then
run_test "blockdev_rbd" ./test/bdev/blockdev.sh "rbd"
run_test "spdkcli_rbd" ./test/spdkcli/rbd.sh run_test "spdkcli_rbd" ./test/spdkcli/rbd.sh
fi fi
@ -279,6 +283,10 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
if [ $SPDK_TEST_OPAL -eq 1 ]; then if [ $SPDK_TEST_OPAL -eq 1 ]; then
run_test "nvme_opal" ./test/nvme/nvme_opal.sh run_test "nvme_opal" ./test/nvme/nvme_opal.sh
fi fi
if [ $SPDK_TEST_CRYPTO -eq 1 ]; then
run_test "blockdev_crypto" ./test/bdev/blockdev.sh "crypto"
fi
fi fi
timing_enter cleanup timing_enter cleanup

View File

@ -17,7 +17,7 @@ dd if=/dev/zero of=/tmp/aiofile bs=2048 count=5000
AIO /tmp/aiofile AIO0 2048 AIO /tmp/aiofile AIO0 2048
[Malloc] [Malloc]
NumberOfLuns 8 NumberOfLuns 6
LunSizeInMB 32 LunSizeInMB 32
[Split] [Split]
@ -45,17 +45,21 @@ function setup_nvme_conf() {
} }
function setup_gpt_conf() { function setup_gpt_conf() {
timing_enter nbd_gpt setup_nvme_conf
if grep -q Nvme0 $conf_file; then if grep -q Nvme0 $conf_file; then
part_dev_by_gpt $conf_file Nvme0n1 $rootdir part_dev_by_gpt $conf_file Nvme0n1 $rootdir
else
return 1
fi fi
timing_exit nbd_gpt
} }
function setup_crypto_conf() { function setup_crypto_conf() {
if [ $SPDK_TEST_CRYPTO -eq 1 ]; then cat >$conf_file <<-EOF
$testdir/gen_crypto.sh Malloc6 Malloc7 >> $conf_file [Malloc]
fi NumberOfLuns 2
LunSizeInMB 32
EOF
$testdir/gen_crypto.sh Malloc0 Malloc1 >> $conf_file
} }
function setup_pmem_conf() { function setup_pmem_conf() {
@ -64,17 +68,17 @@ function setup_pmem_conf() {
pmempool create blk --size=32M 512 /tmp/spdk-pmem-pool pmempool create blk --size=32M 512 /tmp/spdk-pmem-pool
echo "[Pmem]" >> $conf_file echo "[Pmem]" >> $conf_file
echo " Blk /tmp/spdk-pmem-pool Pmem0" >> $conf_file echo " Blk /tmp/spdk-pmem-pool Pmem0" >> $conf_file
else
return 1
fi fi
} }
function setup_rbd_conf() { function setup_rbd_conf() {
if [ $SPDK_TEST_RBD -eq 1 ]; then timing_enter rbd_setup
timing_enter rbd_setup rbd_setup 127.0.0.1
rbd_setup 127.0.0.1 timing_exit rbd_setup
timing_exit rbd_setup
$rootdir/scripts/gen_rbd.sh >> $conf_file $rootdir/scripts/gen_rbd.sh >> $conf_file
fi
} }
function bdev_bounds() { function bdev_bounds() {
@ -282,17 +286,28 @@ else
PRE_RESERVED_MEM=2048 PRE_RESERVED_MEM=2048
fi fi
setup_bdev_conf test_type=$1
setup_nvme_conf [ -z "$test_type" ] && setup_bdev_conf
setup_gpt_conf if [ -n "$test_type" ]; then
setup_crypto_conf case "$test_type" in
setup_pmem_conf nvme )
setup_rbd_conf 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)') bdevs=$(discover_bdevs $rootdir $conf_file | jq -r '.[] | select(.claimed == false)')
timing_exit bdev_svc
bdevs_name=$(echo $bdevs | jq -r '.name') bdevs_name=$(echo $bdevs | jq -r '.name')
bdev_list=($bdevs_name) bdev_list=($bdevs_name)
hello_world_bdev=${bdev_list[0]} 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_bounds" bdev_bounds
run_test "bdev_nbd" nbd_function_test $conf_file "$bdevs_name" run_test "bdev_nbd" nbd_function_test $conf_file "$bdevs_name"
if [ -d /usr/src/fio ]; then 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 else
echo "FIO not available" echo "FIO not available"
exit 1 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_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_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 # Temporarily disabled - infinite loop
# if [ $RUN_NIGHTLY -eq 1 ]; then # if [ $RUN_NIGHTLY -eq 1 ]; then
@ -320,7 +343,7 @@ run_test "bdev_qos" qos_test_suite
# Bdev and configuration cleanup below this line # 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 part_dev_by_gpt $conf_file Nvme0n1 $rootdir reset
fi fi