Skip to content

Commit f358143

Browse files
author
klapinsk
committed
Add recovery functional tests
Signed-off-by: klapinsk <katarzyna.lapinska@intel.com>
1 parent d32bcbd commit f358143

File tree

4 files changed

+160
-0
lines changed

4 files changed

+160
-0
lines changed

test/ocf/ocf.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ rootdir=$(readlink -f $testdir/../..)
55

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

8+
run_test "ocf_recovery_from_ram_wrong_disk" "$testdir/recovery/recovery-from-ram-wrong-disk.sh"
9+
run_test "ocf_recovery_from_ram_neg" "$testdir/recovery/recovery-from-ram-neg.sh"
10+
run_test "ocf_recovery_from_disk" "$testdir/recovery/recovery-from-disk.sh"
811
run_test "ocf_fio_modes" "$testdir/integrity/fio-modes.sh"
912
run_test "ocf_bdevperf_iotypes" "$testdir/integrity/bdevperf-iotypes.sh"
1013
run_test "ocf_stats" "$testdir/integrity/stats.sh"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
11+
# Setup NVMe devices
12+
$rootdir/scripts/setup.sh
13+
14+
# Create NVMe config
15+
prepare_nvme_config
16+
17+
# Clear nvme device which we will use in test
18+
clear_nvme
19+
20+
# Start SPDK app
21+
start_spdk "$curdir/config"
22+
23+
# Create 2x256MiB partitions on NVMe device
24+
create_partitions Nvme0n1 2 256
25+
26+
# Create CAS device
27+
$rpc_py bdev_ocf_create cas_dev wb Nvme0n1p0 Nvme0n1p1 --create --force
28+
29+
# Save config
30+
save_and_clean_bdev_config
31+
32+
# Stop SPDK app
33+
stop_spdk
34+
35+
# Remove metadata files from RAM
36+
rm -f /dev/shm/cas_dev*
37+
38+
# Check if recovery from disk works properly
39+
start_spdk "$curdir/config"
40+
41+
$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .started' | grep true
42+
$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .cache.attached' | grep true
43+
$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .core.attached' | grep true
44+
45+
# Stop SPDK app
46+
stop_spdk
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
11+
# Setup NVMe devices
12+
$rootdir/scripts/setup.sh
13+
14+
for i in 1 2
15+
do
16+
# Create NVMe config
17+
prepare_nvme_config
18+
19+
# Clear nvme device which we will use in test
20+
clear_nvme
21+
22+
# Start SPDK app
23+
start_spdk "$curdir/config"
24+
25+
# Create 2x256MiB partitions on NVMe device
26+
create_partitions Nvme0n1 2 256
27+
28+
# Create CAS device
29+
$rpc_py bdev_ocf_create cas_dev wb Nvme0n1p0 Nvme0n1p1 --create --force
30+
31+
# Save config
32+
save_and_clean_bdev_config
33+
34+
# Stop SPDK app
35+
stop_spdk
36+
37+
# Clear NVMe devices
38+
clear_nvme
39+
40+
# Remove one OCF metadata file
41+
rm -f /dev/shm/ocf.cas_dev.$i
42+
43+
# Start SPDK app with config and check if CAS did not start successfully
44+
start_spdk "$curdir/config"
45+
46+
$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .started' | grep false
47+
$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .cache.attached' | grep false
48+
$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .core.attached' | grep false
49+
50+
# Stop SPDK app
51+
stop_spdk
52+
done
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
11+
# Setup NVMe devices
12+
$rootdir/scripts/setup.sh
13+
14+
# Create NVMe config
15+
prepare_nvme_config
16+
17+
# Clear nvme device which we will use in test
18+
clear_nvme
19+
20+
# Start SPDK app
21+
start_spdk "$curdir/config"
22+
23+
# Create 3x256MiB partitions on NVMe device
24+
create_partitions Nvme0n1 3 256
25+
26+
# Create CAS device
27+
$rpc_py bdev_ocf_create cas_dev wb Nvme0n1p0 Nvme0n1p1 --create --force
28+
29+
# Save config
30+
save_and_clean_bdev_config
31+
32+
# Stop SPDK app
33+
stop_spdk
34+
35+
# Copy original config file to temporary file
36+
cp "$curdir/config" /tmp/config
37+
38+
for i in 1 2
39+
do
40+
# Clear NVMe devices
41+
clear_nvme
42+
43+
# Change cache device in config
44+
sed -i "s/Nvme0n1p$i/Nvme0n1p3/g" "$curdir/config"
45+
46+
# Start SPDK app with config and check if CAS did not start successfully
47+
start_spdk "$curdir/config"
48+
49+
$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .started' | grep false
50+
$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .cache.attached' | grep false
51+
$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .core.attached' | grep false
52+
53+
# Stop SPDK app
54+
stop_spdk
55+
56+
# Restore original config
57+
cp /tmp/config "$curdir/config"
58+
done
59+

0 commit comments

Comments
 (0)