diff --git a/test/ocf/ocf.sh b/test/ocf/ocf.sh index dd81371f35e..ee219cecff0 100755 --- a/test/ocf/ocf.sh +++ b/test/ocf/ocf.sh @@ -5,9 +5,15 @@ rootdir=$(readlink -f $testdir/../..) source $rootdir/test/common/autotest_common.sh + +run_test "ocf_stress_create_remove" "$testdir/stress/stress-create-remove.sh" +run_test "ocf_stress_load" "$testdir/stress/stress-load.sh" +run_test "ocf_stress_get_stats" "$testdir/stress/stress-get-stats.sh" + run_test "ocf_fio_modes" "$testdir/integrity/fio-modes.sh" run_test "ocf_bdevperf_iotypes" "$testdir/integrity/bdevperf-iotypes.sh" run_test "ocf_stats" "$testdir/integrity/stats.sh" + run_test "ocf_create_destruct" "$testdir/management/create-destruct.sh" run_test "ocf_multicore" "$testdir/management/multicore.sh" run_test "ocf_persistent_metadata" "$testdir/management/persistent-metadata.sh" diff --git a/test/ocf/stress/stress-create-remove.sh b/test/ocf/stress/stress-create-remove.sh new file mode 100755 index 00000000000..d6c5860a451 --- /dev/null +++ b/test/ocf/stress/stress-create-remove.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +curdir=$(dirname $(readlink -f "${BASH_SOURCE[0]}")) +rootdir=$(readlink -f $curdir/../../..) +source $rootdir/test/ocf/common.sh +source $rootdir/scripts/common.sh +source $rootdir/test/common/autotest_common.sh +rpc_py=$rootdir/scripts/rpc.py + +iterations=50 +cache_modes=("wa" "wb" "wt" "pt" "wo") +RANDOM=$$$(date +%s) + +# Setup NVMe devices +$rootdir/scripts/setup.sh + +# Create split NVMe config with two partitions, each 256M size +create_nvme_config 2 256 + +# Clear nvme device which we will use in test +clear_nvme + +# Start SPDK app +start_spdk "$curdir/config" + +# Test loop with creating and deleting CAS device +for i in $(eval echo "{1..$iterations}") +do + # Create CAS device + random_cache_mode=${cache_modes[$RANDOM % ${#cache_modes[@]}]} + $rpc_py bdev_ocf_create cas_dev $random_cache_mode Nvme0n1p0 Nvme0n1p1 --create --force + + # Check that CAS device was created properly + $rpc_py bdev_ocf_get_bdevs | jq -r '.[] .name' | grep -qw cas_dev + + # Remove CAS device + $rpc_py bdev_ocf_delete cas_dev + + # Check that CAS device was deleted properly + ! $rpc_py bdev_ocf_get_bdevs | jq -r '.[] .name' | grep -qw cas_dev +done + +# Stop SPDK app and cleanup +stop_spdk + +clear_nvme $bdf + +remove_config diff --git a/test/ocf/stress/stress-get-stats.sh b/test/ocf/stress/stress-get-stats.sh new file mode 100755 index 00000000000..57ba99ac861 --- /dev/null +++ b/test/ocf/stress/stress-get-stats.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +curdir=$(dirname $(readlink -f "${BASH_SOURCE[0]}")) +rootdir=$(readlink -f $curdir/../../..) +source $rootdir/test/ocf/common.sh +source $rootdir/scripts/common.sh +source $rootdir/test/common/autotest_common.sh +rpc_py=$rootdir/scripts/rpc.py +bdevperf=$rootdir/test/bdev/bdevperf/bdevperf +iterations=50 + +# Setup NVMe devices +$rootdir/scripts/setup.sh + +# Create split NVMe config with two partitions, each 256M size +create_nvme_config 2 256 + +# Clear nvme device which we will use in test +clear_nvme + +# Start SPDK app +start_spdk "$curdir/config" + +# Create CAS device +$rpc_py bdev_ocf_create cas_dev wt Nvme0n1p0 Nvme0n1p1 --create --force + +# Check that CAS device was created properly +$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .name' | grep -qw cas_dev + +save_and_clean_bdev_config +stop_spdk + +# Start I/O in background +$bdevperf --json "$curdir/config" -q 128 -o 4096 -w write -t 360 -r /var/tmp/spdk.sock & +bdev_perf_pid=$! +waitforlisten $bdev_perf_pid +sleep 1 + +# Test loop with getting CAS device statistics +for i in $(eval echo "{1..$iterations}") +do + get_stat_json cas_dev | jq + sleep 1 +done + +# Cleanup +kill -9 $bdev_perf_pid +wait $bdev_perf_pid || true +clear_nvme $bdf +remove_config diff --git a/test/ocf/stress/stress-load.sh b/test/ocf/stress/stress-load.sh new file mode 100755 index 00000000000..7e20c82c513 --- /dev/null +++ b/test/ocf/stress/stress-load.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +curdir=$(dirname $(readlink -f "${BASH_SOURCE[0]}")) +rootdir=$(readlink -f $curdir/../../..) +source $rootdir/test/ocf/common.sh +source $rootdir/scripts/common.sh +source $rootdir/test/common/autotest_common.sh +rpc_py=$rootdir/scripts/rpc.py + +iterations=50 + +# Setup NVMe devices +$rootdir/scripts/setup.sh + +# Create split NVMe config with two partitions, each 256M size +create_nvme_config 2 256 + +# Clear nvme device which we will use in test +clear_nvme + +# Start SPDK app +start_spdk "$curdir/config" + +# Create CAS device +$rpc_py bdev_ocf_create cas_dev wb Nvme0n1p0 Nvme0n1p1 --create --force + +# Check that CAS device was created properly +$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .name' | grep -qw cas_dev + +# Stop SPDK app +stop_spdk + +# Test loop with loading CAS device +for i in $(eval echo "{1..$iterations}") +do + # Start SPDK app + start_spdk "$curdir/config" + + # Load CAS device + $rpc_py bdev_ocf_create cas_dev wb Nvme0n1p0 Nvme0n1p1 + + # Check that CAS device was loaded properly + $rpc_py bdev_ocf_get_bdevs | jq -r '.[] .name' | grep -qw cas_dev + + # Stop SPDK app + stop_spdk +done + +# Cleanup +clear_nvme $bdf +remove_config