Re: [Qemu-devel] [PATCH] qemu-iotests: add test case for dmg

2019-01-08 Thread Stefan Hajnoczi
On Sat, Jan 05, 2019 at 04:42:43PM +0800, yuchenlin wrote:
> Recently, some bugs in dmg file have been fixed. To prevent reading dmg
> is broken someday in the future, add a simple test which ensures the
> conversion from dmg to raw should not hang or face any I/O error.
> 
> Signed-off-by: yuchenlin 
> ---
>  tests/qemu-iotests/236|  53 ++
>  tests/qemu-iotests/236.out|   4 ++
>  tests/qemu-iotests/check  |   7 +++
>  tests/qemu-iotests/group  |   1 +
>  .../sample_images/simple-dmg.dmg.bz2  | Bin 0 -> 3479 bytes
>  5 files changed, 65 insertions(+)
>  create mode 100755 tests/qemu-iotests/236
>  create mode 100644 tests/qemu-iotests/236.out
>  create mode 100644 tests/qemu-iotests/sample_images/simple-dmg.dmg.bz2

Kevin: The prerequisite .dmg fixes are already in qemu.git/master.
Please review and take this through your tree, thanks!

Reviewed-by: Stefan Hajnoczi 


signature.asc
Description: PGP signature


Re: [Qemu-devel] [PATCH] qemu-iotests: add test case for dmg

2019-01-08 Thread Kevin Wolf
Am 05.01.2019 um 09:42 hat yuchenlin geschrieben:
> Recently, some bugs in dmg file have been fixed. To prevent reading dmg
> is broken someday in the future, add a simple test which ensures the
> conversion from dmg to raw should not hang or face any I/O error.
> 
> Signed-off-by: yuchenlin 

Thanks, applied to the block branch.

Kevin



[Qemu-devel] [PATCH] qemu-iotests: add test case for dmg

2019-01-05 Thread yuchenlin
Recently, some bugs in dmg file have been fixed. To prevent reading dmg
is broken someday in the future, add a simple test which ensures the
conversion from dmg to raw should not hang or face any I/O error.

Signed-off-by: yuchenlin 
---
 tests/qemu-iotests/236|  53 ++
 tests/qemu-iotests/236.out|   4 ++
 tests/qemu-iotests/check  |   7 +++
 tests/qemu-iotests/group  |   1 +
 .../sample_images/simple-dmg.dmg.bz2  | Bin 0 -> 3479 bytes
 5 files changed, 65 insertions(+)
 create mode 100755 tests/qemu-iotests/236
 create mode 100644 tests/qemu-iotests/236.out
 create mode 100644 tests/qemu-iotests/sample_images/simple-dmg.dmg.bz2

diff --git a/tests/qemu-iotests/236 b/tests/qemu-iotests/236
new file mode 100755
index 00..6f085d573d
--- /dev/null
+++ b/tests/qemu-iotests/236
@@ -0,0 +1,53 @@
+#!/bin/bash
+#
+# Test case for dmg
+#
+# Copyright (C) 2019 yuchenlin 
+#
+# 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 .
+#
+
+# creator
+owner=npes87...@gmail.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+status=1   # failure is the default!
+
+_cleanup()
+{
+rm -f "$TEST_IMG.raw"
+_cleanup_test_img
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+
+_supported_fmt dmg
+_supported_proto file
+_supported_os Linux
+
+echo
+echo "== Testing conversion to raw should success =="
+_use_sample_img simple-dmg.dmg.bz2
+if ! $QEMU_IMG convert -f $IMGFMT -O raw "$TEST_IMG" "$TEST_IMG.raw" ; then
+exit 1
+fi
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/236.out b/tests/qemu-iotests/236.out
new file mode 100644
index 00..a92fc657dd
--- /dev/null
+++ b/tests/qemu-iotests/236.out
@@ -0,0 +1,4 @@
+QA output created by 236
+
+== Testing conversion to raw should success ==
+*** done
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 89ed275988..895e1e3dcb 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -237,6 +237,7 @@ image format options
 -vhdx   test vhdx
 -vmdk   test vmdk
 -luks   test luks
+-dmgtest dmg
 
 image protocol options
 -file   test file (default)
@@ -304,6 +305,12 @@ testlist options
 xpand=false
 ;;
 
+-dmg)
+IMGFMT=dmg
+IMGFMT_GENERIC=false
+xpand=false
+;;
+
 -qed)
 IMGFMT=qed
 xpand=false
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 61a6d98ebd..623ede30f5 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -233,3 +233,4 @@
 233 auto quick
 234 auto quick migration
 235 auto quick
+236 rw auto quick
diff --git a/tests/qemu-iotests/sample_images/simple-dmg.dmg.bz2 
b/tests/qemu-iotests/sample_images/simple-dmg.dmg.bz2
new file mode 100644
index 
..05e719d03d48d6df4f0e995dd8bae1ce54c9f5f0
GIT binary patch
literal 3479
zcmV;I4QTR0T4*^jL0KkKS(36)s{k7pfB*mg|NsC0|NsC0|NsC0|NsC0|Ns5}|NsC0
z|NsC0|Nr0#eji@i`+e|w_jjtUioUNn9=bhi?FYz+8lea^Pt`n6Q`GfM=uI^|rccqR
z#)^4QQ(^vx-<6U8+BMo&{rPgMO9KU6K>tx+G-x7
zKxhH7gFqfr)EbhWqfmN7Xqi0_(|U$T%^~Te(<9O!s(P57)gFnX(HMqCnW^apCLkWB
zfB?c`7=Y8$P|yP*p{9YL8X6e}jSLZ{Kmat*Y9I=F1sjv(V%IjnFNxA1T<(7k~Y;aPez3F!fB%)byHqn^PtYN0c*2G*ZllN2a;wYb5Z@K!FpiLKS04
zAXF_RNbYzNTvjprs6=NSa4=(xVBCm>1#>twBnc>5NRuJv+UXVcw)$K?45Ra5gMtys
z5#=tTi{6o_Dolm>AW0*9z$7i33Gt*7^pYSUXUfIy=|9=(Y5F2D)W#);#I!)dBq)W~
zrFlJ*pf<%vEyY-2j;_z6FzSi8mQn!dfdGLU#z+u}O%{xk@FlI`
z^B@Tz!-52v0~!WxwY>yM5j2L!wDW07lb>SjKuGF1Bv7*3#(>;=WH?%<2(%C(%mi
z3SK&{ts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