diff --git a/autotest.sh b/autotest.sh index b53f1d464..7ce4736f6 100755 --- a/autotest.sh +++ b/autotest.sh @@ -148,6 +148,10 @@ fi if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then timing_enter lib + if [ $SPDK_TEST_REDUCE -eq 1 ]; then + run_test suite ./test/compress/compress.sh + fi + run_test suite test/env/env.sh run_test suite test/rpc_client/rpc_client.sh run_test suite ./test/json_config/json_config.sh diff --git a/lib/bdev/compress/vbdev_compress_rpc.c b/lib/bdev/compress/vbdev_compress_rpc.c index 69c7ca25a..2381f2147 100644 --- a/lib/bdev/compress/vbdev_compress_rpc.c +++ b/lib/bdev/compress/vbdev_compress_rpc.c @@ -80,7 +80,8 @@ spdk_rpc_set_compress_pmd(struct spdk_jsonrpc_request *request, spdk_jsonrpc_end_result(request, w); } } -SPDK_RPC_REGISTER("set_compress_pmd", spdk_rpc_set_compress_pmd, SPDK_RPC_RUNTIME) +SPDK_RPC_REGISTER("set_compress_pmd", spdk_rpc_set_compress_pmd, + SPDK_RPC_STARTUP | SPDK_RPC_RUNTIME) /* Structure to hold the parameters for this RPC method. */ struct rpc_construct_compress { diff --git a/test/compress/compress.sh b/test/compress/compress.sh new file mode 100755 index 000000000..fe63bd31f --- /dev/null +++ b/test/compress/compress.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash + +set -e + +testdir=$(readlink -f $(dirname $0)) +rootdir=$(readlink -f $testdir/../..) +plugindir=$rootdir/examples/bdev/fio_plugin +rpc_py="$rootdir/scripts/rpc.py" +source "$rootdir/scripts/common.sh" +source "$rootdir/test/common/autotest_common.sh" + +function compress_err_cleanup() { + rm -rf /tmp/pmem + $rootdir/examples/nvme/perf/perf -q 1 -o 131072 -w write -t 2 +} + +# use the bdev svc to create a compress bdev, this assumes +# there is no other metadata on the nvme device, we will put a +# compress vol on a thin provisioned lvol on nvme +mkdir -p /tmp/pmem +$rootdir/test/app/bdev_svc/bdev_svc & +bdev_svc_pid=$! +trap "killprocess $bdev_svc_pid; compress_err_cleanup; exit 1" SIGINT SIGTERM EXIT +waitforlisten $bdev_svc_pid +bdf=$(iter_pci_class_code 01 08 02 | head -1) +$rpc_py construct_nvme_bdev -b "Nvme0" -t "pcie" -a $bdf +lvs_u=$($rpc_py construct_lvol_store Nvme0n1 lvs0) +$rpc_py construct_lvol_bdev -t -u $lvs_u lv0 100 +# this will force isal_pmd as some of the CI systems need a qat driver update +$rpc_py set_compress_pmd -p 2 +compress_bdev=$($rpc_py construct_compress_bdev -b lvs0/lv0 -p /tmp) +trap - SIGINT SIGTERM EXIT +killprocess $bdev_svc_pid + +# run bdevio test +timing_enter compress_test +$rootdir/test/bdev/bdevio/bdevio -w & +bdevio_pid=$! +trap "killprocess $bdevio_pid; compress_err_cleanup; exit 1" SIGINT SIGTERM EXIT +waitforlisten $bdevio_pid +$rpc_py set_compress_pmd -p 2 +$rpc_py construct_nvme_bdev -b "Nvme0" -t "pcie" -a $bdf +waitforbdev $compress_bdev +$rootdir/test/bdev/bdevio/tests.py perform_tests +trap - SIGINT SIGTERM EXIT +killprocess $bdevio_pid + +#run bdevperf with slightly different params for nightly +qd=32 +runtime=3 +iosize=4096 +if [ $RUN_NIGHTLY -eq 1 ]; then + qd=64 + runtime=30 + iosize=16384 +fi +$rootdir/test/bdev/bdevperf/bdevperf -z -q $qd -o $iosize -w verify -t $runtime & +bdevperf_pid=$! +trap "killprocess $bdevperf_pid; compress_err_cleanup; exit 1" SIGINT SIGTERM EXIT +waitforlisten $bdevperf_pid +$rpc_py set_compress_pmd -p 2 +$rpc_py construct_nvme_bdev -b "Nvme0" -t "pcie" -a $bdf +waitforbdev $compress_bdev +$rootdir/test/bdev/bdevperf/bdevperf.py perform_tests + +# now cleanup the vols, deleting the compression vol also deletes the pmem file +$rpc_py delete_compress_bdev COMP_lvs0/lv0 +$rpc_py destroy_lvol_store -l lvs0 + +trap - SIGINT SIGTERM EXIT +killprocess $bdevperf_pid +timing_exit compress_test