[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/18] iotests: Add test for data_off check
From: |
Denis V. Lunev |
Subject: |
[PULL 18/18] iotests: Add test for data_off check |
Date: |
Wed, 6 Sep 2023 17:54:13 +0200 |
From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Write a pattern to the first cluster. Corrupt the data_off field and check
if the field was repaired on image opening and the pattern has not changed.
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
tests/qemu-iotests/tests/parallels-checks | 15 +++++++++++++++
tests/qemu-iotests/tests/parallels-checks.out | 10 ++++++++++
2 files changed, 25 insertions(+)
diff --git a/tests/qemu-iotests/tests/parallels-checks
b/tests/qemu-iotests/tests/parallels-checks
index 8a63c3daf4..a7a1b357b5 100755
--- a/tests/qemu-iotests/tests/parallels-checks
+++ b/tests/qemu-iotests/tests/parallels-checks
@@ -44,6 +44,7 @@ _supported_os Linux
SIZE=$((4 * 1024 * 1024))
IMGFMT=parallels
CLUSTER_SIZE_OFFSET=28
+DATA_OFF_OFFSET=48
BAT_OFFSET=64
_make_test_img $SIZE
@@ -124,6 +125,20 @@ printf "content: 0x%02x\n" `peek_file_le $TEST_IMG
$(($CLUSTER_SIZE)) 1`
echo "== check second cluster on host =="
printf "content: 0x%02x\n" `peek_file_le $TEST_IMG $(($CLUSTER_SIZE)) 1`
+# Clear image
+_make_test_img $SIZE
+
+echo "== TEST DATA_OFF CHECK =="
+
+echo "== write pattern to first cluster =="
+{ $QEMU_IO -c "write -P 0x55 0 $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 |
_filter_qemu_io | _filter_testdir
+
+echo "== spoil data_off field =="
+poke_file "$TEST_IMG" "$DATA_OFF_OFFSET" "\xff\xff\xff\xff"
+
+echo "== check first cluster =="
+{ $QEMU_IO -c "read -P 0x55 0 $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 |
_filter_qemu_io | _filter_testdir
+
# success, all done
echo "*** done"
rm -f $seq.full
diff --git a/tests/qemu-iotests/tests/parallels-checks.out
b/tests/qemu-iotests/tests/parallels-checks.out
index b747bba1f3..98a3a7f55e 100644
--- a/tests/qemu-iotests/tests/parallels-checks.out
+++ b/tests/qemu-iotests/tests/parallels-checks.out
@@ -62,4 +62,14 @@ read 1048576/1048576 bytes at offset 1048576
content: 0x11
== check second cluster on host ==
content: 0x11
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4194304
+== TEST DATA_OFF CHECK ==
+== write pattern to first cluster ==
+wrote 1048576/1048576 bytes at offset 0
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+== spoil data_off field ==
+== check first cluster ==
+Repairing data_off field has incorrect value
+read 1048576/1048576 bytes at offset 0
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done
--
2.34.1
- [PULL 01/18] MAINTAINERS: add tree to keep parallels format driver changes, (continued)
- [PULL 01/18] MAINTAINERS: add tree to keep parallels format driver changes, Denis V. Lunev, 2023/09/06
- [PULL 06/18] parallels: Add data_start field to BDRVParallelsState, Denis V. Lunev, 2023/09/06
- [PULL 08/18] parallels: Image repairing in parallels_open(), Denis V. Lunev, 2023/09/06
- [PULL 07/18] parallels: Add checking and repairing duplicate offsets in BAT, Denis V. Lunev, 2023/09/06
- [PULL 10/18] parallels: Add data_off check, Denis V. Lunev, 2023/09/06
- [PULL 15/18] iotests: Refactor tests of parallels images checks (131), Denis V. Lunev, 2023/09/06
- [PULL 11/18] parallels: Add data_off repairing to parallels_open(), Denis V. Lunev, 2023/09/06
- [PULL 12/18] iotests: Add out-of-image check test for parallels format, Denis V. Lunev, 2023/09/06
- [PULL 13/18] iotests: Add leak check test for parallels format, Denis V. Lunev, 2023/09/06
- [PULL 17/18] iotests: Fix test 131 after repair was added to parallels_open(), Denis V. Lunev, 2023/09/06
- [PULL 18/18] iotests: Add test for data_off check,
Denis V. Lunev <=
- [PULL 14/18] iotests: Add test for BAT entries duplication check, Denis V. Lunev, 2023/09/06
- [PULL 16/18] iotests: Fix cluster size in parallels images tests (131), Denis V. Lunev, 2023/09/06
- Re: [PULL 00/18] Parallels format driver, Stefan Hajnoczi, 2023/09/07