Skip to content

Commit d3ed594

Browse files
author
klapinsk
committed
Add ocf stress tests
Signed-off-by: klapinsk <[email protected]>
1 parent 6b0a70e commit d3ed594

File tree

4 files changed

+155
-0
lines changed

4 files changed

+155
-0
lines changed

test/ocf/ocf.sh

+6
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ rootdir=$(readlink -f $testdir/../..)
55

66
source $rootdir/test/common/autotest_common.sh
77

8+
9+
run_test "ocf_stress_create_remove" "$testdir/stress/stress-create-remove.sh"
10+
run_test "ocf_stress_load" "$testdir/stress/stress-load.sh"
11+
run_test "ocf_stress_get_stats" "$testdir/stress/stress-get-stats.sh"
12+
813
run_test "ocf_fio_modes" "$testdir/integrity/fio-modes.sh"
914
run_test "ocf_bdevperf_iotypes" "$testdir/integrity/bdevperf-iotypes.sh"
1015
run_test "ocf_stats" "$testdir/integrity/stats.sh"
16+
1117
run_test "ocf_create_destruct" "$testdir/management/create-destruct.sh"
1218
run_test "ocf_multicore" "$testdir/management/multicore.sh"
1319
run_test "ocf_persistent_metadata" "$testdir/management/persistent-metadata.sh"
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env bash
2+
3+
curdir=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
4+
rootdir=$(readlink -f $curdir/../../..)
5+
source $rootdir/test/ocf/common.sh
6+
source $rootdir/scripts/common.sh
7+
source $rootdir/test/common/autotest_common.sh
8+
rpc_py=$rootdir/scripts/rpc.py
9+
10+
iterations=50
11+
cache_modes=("wa" "wb" "wt" "pt" "wo")
12+
RANDOM=$$$(date +%s)
13+
14+
# Setup NVMe devices
15+
$rootdir/scripts/setup.sh
16+
17+
# Create split NVMe config with two partitions, each 256M size
18+
create_nvme_config 2 256
19+
20+
# Clear nvme device which we will use in test
21+
clear_nvme
22+
23+
# Start SPDK app
24+
start_spdk "$curdir/config"
25+
26+
# Test loop with creating and deleting CAS device
27+
for i in $(eval echo "{1..$iterations}")
28+
do
29+
# Create CAS device
30+
random_cache_mode=${cache_modes[$RANDOM % ${#cache_modes[@]}]}
31+
$rpc_py bdev_ocf_create cas_dev $random_cache_mode Nvme0n1p0 Nvme0n1p1 --create --force
32+
33+
# Check that CAS device was created properly
34+
$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .name' | grep -qw cas_dev
35+
36+
# Remove CAS device
37+
$rpc_py bdev_ocf_delete cas_dev
38+
39+
# Check that CAS device was deleted properly
40+
! $rpc_py bdev_ocf_get_bdevs | jq -r '.[] .name' | grep -qw cas_dev
41+
done
42+
43+
# Stop SPDK app and cleanup
44+
stop_spdk
45+
46+
clear_nvme $bdf
47+
48+
remove_config

test/ocf/stress/stress-get-stats.sh

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
3+
curdir=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
4+
rootdir=$(readlink -f $curdir/../../..)
5+
source $rootdir/test/ocf/common.sh
6+
source $rootdir/scripts/common.sh
7+
source $rootdir/test/common/autotest_common.sh
8+
rpc_py=$rootdir/scripts/rpc.py
9+
bdevperf=$rootdir/test/bdev/bdevperf/bdevperf
10+
iterations=50
11+
12+
# Setup NVMe devices
13+
$rootdir/scripts/setup.sh
14+
15+
# Create split NVMe config with two partitions, each 256M size
16+
create_nvme_config 2 256
17+
18+
# Clear nvme device which we will use in test
19+
clear_nvme
20+
21+
# Start SPDK app
22+
start_spdk "$curdir/config"
23+
24+
# Create CAS device
25+
$rpc_py bdev_ocf_create cas_dev wt Nvme0n1p0 Nvme0n1p1 --create --force
26+
27+
# Check that CAS device was created properly
28+
$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .name' | grep -qw cas_dev
29+
30+
save_and_clean_bdev_config
31+
stop_spdk
32+
33+
# Start I/O in background
34+
$bdevperf --json "$curdir/config" -q 128 -o 4096 -w write -t 360 -r /var/tmp/spdk.sock &
35+
bdev_perf_pid=$!
36+
waitforlisten $bdev_perf_pid
37+
sleep 1
38+
39+
# Test loop with getting CAS device statistics
40+
for i in $(eval echo "{1..$iterations}")
41+
do
42+
get_stat_json cas_dev | jq
43+
sleep 1
44+
done
45+
46+
# Cleanup
47+
kill -9 $bdev_perf_pid
48+
wait $bdev_perf_pid || true
49+
clear_nvme $bdf
50+
remove_config

test/ocf/stress/stress-load.sh

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
3+
curdir=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
4+
rootdir=$(readlink -f $curdir/../../..)
5+
source $rootdir/test/ocf/common.sh
6+
source $rootdir/scripts/common.sh
7+
source $rootdir/test/common/autotest_common.sh
8+
rpc_py=$rootdir/scripts/rpc.py
9+
10+
iterations=50
11+
12+
# Setup NVMe devices
13+
$rootdir/scripts/setup.sh
14+
15+
# Create split NVMe config with two partitions, each 256M size
16+
create_nvme_config 2 256
17+
18+
# Clear nvme device which we will use in test
19+
clear_nvme
20+
21+
# Start SPDK app
22+
start_spdk "$curdir/config"
23+
24+
# Create CAS device
25+
$rpc_py bdev_ocf_create cas_dev wb Nvme0n1p0 Nvme0n1p1 --create --force
26+
27+
# Check that CAS device was created properly
28+
$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .name' | grep -qw cas_dev
29+
30+
# Stop SPDK app
31+
stop_spdk
32+
33+
# Test loop with loading CAS device
34+
for i in $(eval echo "{1..$iterations}")
35+
do
36+
# Start SPDK app
37+
start_spdk "$curdir/config"
38+
39+
# Load CAS device
40+
$rpc_py bdev_ocf_create cas_dev wb Nvme0n1p0 Nvme0n1p1
41+
42+
# Check that CAS device was loaded properly
43+
$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .name' | grep -qw cas_dev
44+
45+
# Stop SPDK app
46+
stop_spdk
47+
done
48+
49+
# Cleanup
50+
clear_nvme $bdf
51+
remove_config

0 commit comments

Comments
 (0)