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 0000000000..6f085d573d --- /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 0000000000..bedbad065b --- /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 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 + -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 0f1c3f9cdf..3e310c7f87 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 zcmZ>Y%CIzaj8qGboU|!mHG{Nx{eNuWFOuK`&N}(HTfb{RRDCaBwXSR5dJDN-w%Kpl zPjpBv#Fn*PFTL=%UR7$!beU1y7>qD_=o%zvJbHj zs+#Tb$@x&vpZ*k@V-xVpgzDqtCId zkh9?8mbO_batjw<4t!-I#lY6q%gbTip}0vtd|sQvs+7g9yO_cR{fsJCU1XT#qa>Br z!)>o8x&2U_PzIyVMunhGwZ@Yq5oi3a3Vt$7IE4w_b{V+x9EQj%V@b#O5Z!lY&q67Ioj7 zxI)XP^{0ZTa?Jr1-PxQUmk52C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