From dcca82c109dbaf4e90c1590cd8481801713975e1 Mon Sep 17 00:00:00 2001 From: Pawel Kaminski Date: Wed, 4 Jul 2018 11:30:59 -0400 Subject: [PATCH] test/spdkcli: Test for pmem bdev. Change-Id: I1917ca3002f34b90d74ce360987fc63b3064a20f Signed-off-by: Pawel Kaminski Reviewed-on: https://review.gerrithub.io/417855 Chandler-Test-Pool: SPDK Automated Test System Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Seth Howell --- autotest.sh | 1 + test/spdkcli/common.sh | 2 +- .../match_files/spdkcli_pmem.test.match | 2 ++ test/spdkcli/pmem.sh | 33 +++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 test/spdkcli/match_files/spdkcli_pmem.test.match create mode 100755 test/spdkcli/pmem.sh diff --git a/autotest.sh b/autotest.sh index da6faf01a..ce125580c 100755 --- a/autotest.sh +++ b/autotest.sh @@ -222,6 +222,7 @@ fi if [ $SPDK_TEST_PMDK -eq 1 ]; then run_test ./test/pmem/pmem.sh -x run_test ./test/pmem/json_config/json_config.sh + run_test ./test/spdkcli/pmem.sh fi if [ $SPDK_TEST_RBD -eq 1 ]; then diff --git a/test/spdkcli/common.sh b/test/spdkcli/common.sh index 7f17487fb..4c40aeeff 100644 --- a/test/spdkcli/common.sh +++ b/test/spdkcli/common.sh @@ -9,7 +9,7 @@ spdkcli_job="python3 $SPDKCLI_BUILD_DIR/test/spdkcli/spdkcli_job.py" function on_error_exit() { set +e killprocess $spdk_tgt_pid - rm -f $testdir/${MATCH_FILE} $testdir/match_files/spdkcli_details_vhost.test /tmp/sample_aio + rm -f $testdir/${MATCH_FILE} $testdir/match_files/spdkcli_details_vhost.test /tmp/sample_aio /tmp/sample_pmem print_backtrace exit 1 } diff --git a/test/spdkcli/match_files/spdkcli_pmem.test.match b/test/spdkcli/match_files/spdkcli_pmem.test.match new file mode 100644 index 000000000..0ee659b5e --- /dev/null +++ b/test/spdkcli/match_files/spdkcli_pmem.test.match @@ -0,0 +1,2 @@ +o- pmemblk .............................................................................................................. [Bdevs: 1] + o- pmem_bdev ........................................................................................... [Size=31.6M, Not claimed] diff --git a/test/spdkcli/pmem.sh b/test/spdkcli/pmem.sh new file mode 100755 index 000000000..bdac18736 --- /dev/null +++ b/test/spdkcli/pmem.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +set -xe + +MATCH_FILE="spdkcli_pmem.test" +SPDKCLI_BRANCH="/bdevs/pmemblk" +testdir=$(readlink -f $(dirname $0)) +. $testdir/common.sh + +timing_enter spdkcli_pmem +trap 'on_error_exit;' ERR + +timing_enter run_spdk_tgt +run_spdk_tgt +timing_exit run_spdk_tgt + +timing_enter spdkcli_create_pmem_config +$spdkcli_job "/bdevs/pmemblk create_pmem_pool /tmp/sample_pmem 32 512" "" True +$spdkcli_job "/bdevs/pmemblk create /tmp/sample_pmem pmem_bdev" "pmem_bdev" True +timing_exit spdkcli_create_pmem_config + +timing_enter spdkcli_check_match +check_match +timing_exit spdkcli_check_match + +timing_enter spdkcli_clear_pmem_config +$spdkcli_job "/bdevs/pmemblk delete pmem_bdev" "pmem_bdev" +$spdkcli_job "/bdevs/pmemblk delete_pmem_pool /tmp/sample_pmem" "" +rm -f /tmp/sample_pmem +timing_exit spdkcli_clear_pmem_config + +killprocess $spdk_tgt_pid +timing_exit spdkcli_pmem +report_test_completion spdk_cli