From 76f1cf0a5e279a28fb833104b97ea561e4293c47 Mon Sep 17 00:00:00 2001 From: yuchenlin Date: Sat, 5 Jan 2019 16:42:43 +0800 Subject: [PATCH] qemu-iotests: add test case for dmg 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 Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- tests/qemu-iotests/239 | 53 ++++++++++++++++++ tests/qemu-iotests/239.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/239 create mode 100644 tests/qemu-iotests/239.out create mode 100644 tests/qemu-iotests/sample_images/simple-dmg.dmg.bz2 diff --git a/tests/qemu-iotests/239 b/tests/qemu-iotests/239 new file mode 100755 index 00000000000..6f085d573da --- /dev/null +++ b/tests/qemu-iotests/239 @@ -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=npes87184@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/239.out b/tests/qemu-iotests/239.out new file mode 100644 index 00000000000..bedbad065ba --- /dev/null +++ b/tests/qemu-iotests/239.out @@ -0,0 +1,4 @@ +QA output created by 239 + +== Testing conversion to raw should success == +*** done diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 89ed275988a..895e1e3dcbd 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 + -dmg test 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 0f1c3f9cdf8..3e310c7f878 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -235,3 +235,4 @@ 235 auto quick 236 auto quick 238 auto quick +239 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 0000000000000000000000000000000000000000..05e719d03d48d6df4f0e995dd8bae1ce54c9f5f0 GIT binary patch literal 3479 zc-jG%4QTR0T4*^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(&j0^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%IjnFNx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