qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 5/5] iotests: add test for prl-xml format


From: Vladimir Sementsov-Ogievskiy
Subject: [PATCH 5/5] iotests: add test for prl-xml format
Date: Fri, 13 Nov 2020 15:58:48 +0300

From: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>

Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 tests/qemu-iotests/164                        |  98 ++++++++++++++++++
 tests/qemu-iotests/164.out                    |  54 ++++++++++
 tests/qemu-iotests/check                      |   7 ++
 tests/qemu-iotests/group                      |   1 +
 .../prl-xml/DiskDescriptor.xml.bz2            | Bin 0 -> 457 bytes
 .../sample_images/prl-xml/Snapshots.xml.bz2   | Bin 0 -> 307 bytes
 ...aabe3-6958-40ff-92a7-860e329aab41}.hds.bz2 | Bin 0 -> 93 bytes
 ...476cf-d62e-45d1-b355-86feca91376e}.hds.bz2 | Bin 0 -> 93 bytes
 8 files changed, 160 insertions(+)
 create mode 100755 tests/qemu-iotests/164
 create mode 100644 tests/qemu-iotests/164.out
 create mode 100644 
tests/qemu-iotests/sample_images/prl-xml/DiskDescriptor.xml.bz2
 create mode 100644 tests/qemu-iotests/sample_images/prl-xml/Snapshots.xml.bz2
 create mode 100644 
tests/qemu-iotests/sample_images/prl-xml/parallels.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.bz2
 create mode 100644 
tests/qemu-iotests/sample_images/prl-xml/parallels.{986476cf-d62e-45d1-b355-86feca91376e}.hds.bz2

diff --git a/tests/qemu-iotests/164 b/tests/qemu-iotests/164
new file mode 100755
index 0000000000..a55ab5d7d8
--- /dev/null
+++ b/tests/qemu-iotests/164
@@ -0,0 +1,98 @@
+#!/bin/bash
+#
+# prl-xml format validation test
+#
+# Copyright (C) 2017 Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+# creator
+owner=edgar.kaziakhmedov@virtuozzo.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+status=1       # failure is the default!
+
+_cleanup()
+{
+    _rm_test_img "$TEST_DIR/$PRL_XML_DIR/$CUR_IMAGE"
+    _rm_test_img "$TEST_DIR/$PRL_XML_DIR/$BACK_IMAGE"
+    _rm_test_img "$TEST_DIR/$PRL_XML_DIR/$SNAP_LIST"
+    _cleanup_test_img
+    rmdir "$TEST_DIR/$PRL_XML_DIR"
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_supported_fmt prl-xml
+_supported_proto file
+_supported_os Linux
+
+inuse_offset=$((0x2c))
+
+PRL_XML_DIR="prl-xml"
+mkdir "$TEST_DIR/$PRL_XML_DIR"
+CUR_IMAGE="parallels.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds"
+BACK_IMAGE="parallels.{986476cf-d62e-45d1-b355-86feca91376e}.hds"
+SNAP_LIST="Snapshots.xml"
+XML_IMG="DiskDescriptor.xml"
+size=128M
+CLUSTER_SIZE=64k
+IMGFMT=prl-xml
+_use_sample_img "$PRL_XML_DIR/$CUR_IMAGE.bz2"
+_use_sample_img "$PRL_XML_DIR/$BACK_IMAGE.bz2"
+_use_sample_img "$PRL_XML_DIR/$SNAP_LIST.bz2"
+_use_sample_img "$PRL_XML_DIR/$XML_IMG.bz2"
+
+echo == read empty image ==
+{ $QEMU_IO -c "read -P 0 32k 64k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | 
_filter_testdir
+echo == write more than 1 block in a row ==
+{ $QEMU_IO -c "write -P 0x11 32k 128k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | 
_filter_testdir
+echo == read less than block ==
+{ $QEMU_IO -c "read -P 0x69 32k 32k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | 
_filter_testdir
+echo == read exactly 1 block ==
+{ $QEMU_IO -c "read -P 0x69 64k 64k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | 
_filter_testdir
+echo == read more than 1 block ==
+{ $QEMU_IO -c "read -P 0x69 32k 128k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | 
_filter_testdir
+echo == check that there is no trash after written ==
+{ $QEMU_IO -c "read -P 0 160k 32k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | 
_filter_testdir
+echo == check that there is no trash before written ==
+{ $QEMU_IO -c "read -P 0 0 32k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | 
_filter_testdir
+echo == write the whole disk ==
+{ $QEMU_IO -c "write -P 0x45 0 2M" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | 
_filter_testdir
+echo == read the whole disk ==
+{ $QEMU_IO -c "read -P 0x45 0 2M" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | 
_filter_testdir
+echo == check that there is error while write out of range ==
+{ $QEMU_IO -c "write -P 0 2M 32k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | 
_filter_testdir
+echo == check that there is error while disk size is less than data written ==
+{ $QEMU_IO -c "write -P 0x45 0 3M" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | 
_filter_testdir
+
+echo "== Corrupt image =="
+poke_file "$TEST_DIR/$PRL_XML_DIR/$CUR_IMAGE" "$inuse_offset" 
"\x59\x6e\x6f\x74"
+{ $QEMU_IO -c "read -P 0x11 64k 64k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | 
_filter_testdir
+# as it is a block filter, we change driver format
+_check_test_img
+_check_test_img -r all
+{ $QEMU_IO -c "read -P 0x11 64k 64k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | 
_filter_testdir
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/164.out b/tests/qemu-iotests/164.out
new file mode 100644
index 0000000000..777c0c2c1c
--- /dev/null
+++ b/tests/qemu-iotests/164.out
@@ -0,0 +1,54 @@
+QA output created by 164
+== read empty image ==
+read 65536/65536 bytes at offset 32768
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+== write more than 1 block in a row ==
+wrote 131072/131072 bytes at offset 32768
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+== read less than block ==
+Pattern verification failed at offset 32768, 32768 bytes
+read 32768/32768 bytes at offset 32768
+32 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+== read exactly 1 block ==
+Pattern verification failed at offset 65536, 65536 bytes
+read 65536/65536 bytes at offset 65536
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+== read more than 1 block ==
+Pattern verification failed at offset 32768, 131072 bytes
+read 131072/131072 bytes at offset 32768
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+== check that there is no trash after written ==
+read 32768/32768 bytes at offset 163840
+32 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+== check that there is no trash before written ==
+read 32768/32768 bytes at offset 0
+32 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+== write the whole disk ==
+wrote 2097152/2097152 bytes at offset 0
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+== read the whole disk ==
+read 2097152/2097152 bytes at offset 0
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+== check that there is error while write out of range ==
+write failed: Input/output error
+== check that there is error while disk size is less than data written ==
+write failed: Input/output error
+== Corrupt image ==
+can't open device TEST_DIR/prl-xml/DiskDescriptor.xml: parallels: Image was 
not closed correctly; cannot be opened read/write
+Can't open top image
+ERROR image was not closed correctly
+
+1 errors were found on the image.
+Data may be corrupted, or further writes to the image may corrupt it.
+Repairing image was not closed correctly
+The following inconsistencies were found and repaired:
+
+    0 leaked clusters
+    1 corruptions
+
+Double checking the fixed image now...
+No errors were found on the image.
+Pattern verification failed at offset 65536, 65536 bytes
+read 65536/65536 bytes at offset 65536
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+*** done
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index e6b6ff7a04..0a87c8d840 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -229,6 +229,7 @@ image format options
     -bochs              test bochs
     -cloop              test cloop
     -parallels          test parallels
+    -prl-xml            test prl-xml
     -qcow               test qcow
     -qcow2              test qcow2
     -qed                test qed
@@ -288,6 +289,12 @@ testlist options
             xpand=false
             ;;
 
+        -prl-xml)
+            IMGFMT=prl-xml
+            IMGFMT_GENERIC=false
+            xpand=false
+            ;;
+
         -qcow)
             IMGFMT=qcow
             xpand=false
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index a2dfe79d86..d22853fed6 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -168,6 +168,7 @@
 160 rw auto quick
 162 auto quick
 163 rw auto quick
+164 rw auto quick
 165 rw auto quick
 170 rw auto quick
 171 rw auto quick
diff --git a/tests/qemu-iotests/sample_images/prl-xml/DiskDescriptor.xml.bz2 
b/tests/qemu-iotests/sample_images/prl-xml/DiskDescriptor.xml.bz2
new file mode 100644
index 
0000000000000000000000000000000000000000..08dad3b4a9c980e931bc0b1d128bf931754a0730
GIT binary patch
literal 457
zcmV;)0XF_ZT4*^jL0KkKSrF;;(*OYXUw}kZPy_$xpWsgbzwh08Kmq%XS_EJK00000
z00050<x}*N)Bpg{pa1{>0FhFe>Y92HlRY3t1k)x7iM22Qsv;FVpa3SCYG^bXG{_8|
zrfN!{Cd7v_5J(9M0s}_dWC~Q2$^q`CQ9GkqB)PntA`y-oQij;)JNjE(B9Y*5aV@eZ
zNm#hli#yE)7^1NyrcFiV@r278BPk{EYaYR2-xv$bF@i7>S(f6lk}@&{M@|-=EDInh
z1TQdzVh>8Vid!*P!6c*$Ae_l29fvPb-K|eJV1RjPLW4O6g5X2eSUs4Sk}gILzRBoP
zpHePXvokW4>Jvg~PXZ{SSoaK&ZH+Ou+Zm`9dCH>;i})omFSQhX*`7S5GZHtsEf=>w
z1@YYz7*4~Ij?&_cOOoQ={;YNEHAluO=lD$;(-cuvUM(k+scFz|XL9qg!Mwv9P4QDi
zZfryL&S!Erw6rX7Q7R#ko6NZ8#&UYgdr7g++-G_%Jw_LzuB3a>_GL3NF_MS1iYl0^
z6I+QmlSNwC6>a&aGBB|%l=PU|mZaQ)`TG;NQwaRAwJ&DIPvBk26yZWZL#NYBA5X_~

literal 0
HcmV?d00001

diff --git a/tests/qemu-iotests/sample_images/prl-xml/Snapshots.xml.bz2 
b/tests/qemu-iotests/sample_images/prl-xml/Snapshots.xml.bz2
new file mode 100644
index 
0000000000000000000000000000000000000000..b5d80ae94d4500b1b19f3439dc5e953383797c6f
GIT binary patch
literal 307
zcmV-30nGkFT4*^jL0KkKSxpAo!2keSUw}kVa0CDMtRYMaKj+`dFaafl45Vb#^oG(j
z!Ww#j1Juv}&}yEUO*J$z4FF*QqfCtlsip-~(t(pxG&KMKXlV5qfO$lMX&?jw2v8-q
z1`8?>TaY|qfYis;LeUupdT2xBtur^&?vpdx7R17+oiv%}2wGIw-)zxJLr_^;oRJC4
z2#6Ap!Nu!vRP96>_M1>58rRKl2SU7pU?xx5wYliRwKUL%LTSn&49HEuR+X$}sk5@T
z=xr(7)RvMJ8`AEc%m$-oFQzoR=yQk}&wu2md@z{{n6N7=p=AGC+I1H@3>iwz8Wyyr
zWa1$U^GSrJhB+xNlJ>S-MI_qG1yW`~MP9ZklRCtzNpT7YFCZ1HaF+M+cO+AV2?Wq>
FtPtE<hb{mB

literal 0
HcmV?d00001

diff --git 
a/tests/qemu-iotests/sample_images/prl-xml/parallels.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.bz2
 
b/tests/qemu-iotests/sample_images/prl-xml/parallels.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.bz2
new file mode 100644
index 
0000000000000000000000000000000000000000..174c8ba055fc1a24b91f179670fd15b53e00efdd
GIT binary patch
literal 93
zcmV-j0HXgwT4*^jL0KkKS=)oU7yuwJ=Yr6{KmY>(2!JYJ)<6It00<xeR3$(r5vF9&
zDv_iB08MQ#q9On-S)$Yk0W=~I07sO2y<D>Emf9jW8MFZ406H$@ig2MJw+D1EabX`c

literal 0
HcmV?d00001

diff --git 
a/tests/qemu-iotests/sample_images/prl-xml/parallels.{986476cf-d62e-45d1-b355-86feca91376e}.hds.bz2
 
b/tests/qemu-iotests/sample_images/prl-xml/parallels.{986476cf-d62e-45d1-b355-86feca91376e}.hds.bz2
new file mode 100644
index 
0000000000000000000000000000000000000000..174c8ba055fc1a24b91f179670fd15b53e00efdd
GIT binary patch
literal 93
zcmV-j0HXgwT4*^jL0KkKS=)oU7yuwJ=Yr6{KmY>(2!JYJ)<6It00<xeR3$(r5vF9&
zDv_iB08MQ#q9On-S)$Yk0W=~I07sO2y<D>Emf9jW8MFZ406H$@ig2MJw+D1EabX`c

literal 0
HcmV?d00001

-- 
2.21.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]