acpi-build: append description for non-hotplug
[qemu/cris-port.git] / tests / qemu-iotests / 063
bloba47493a0766f3d403dc3316f83240c2d2b67eb6a
1 #!/bin/bash
3 # test of qemu-img convert -n - convert without creation
5 # Copyright (C) 2009 Red Hat, Inc.
6 # Copyright (C) 2013 Alex Bligh (alex@alex.org.uk)
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 # creator
23 owner=alex@alex.org.uk
25 seq=`basename $0`
26 echo "QA output created by $seq"
28 here=`pwd`
29 tmp=/tmp/$$
30 status=1 # failure is the default!
32 _cleanup()
34 _cleanup_test_img
35 rm -f "$TEST_IMG.orig" "$TEST_IMG.raw" "$TEST_IMG.raw2"
37 trap "_cleanup; exit \$status" 0 1 2 3 15
39 # get standard environment, filters and checks
40 . ./common.rc
41 . ./common.filter
42 . ./common.pattern
44 _supported_fmt qcow qcow2 vmdk qed raw
45 _supported_proto file
46 _supported_os Linux
47 _unsupported_imgopts "subformat=monolithicFlat" \
48 "subformat=twoGbMaxExtentFlat" \
49 "subformat=twoGbMaxExtentSparse"
51 _make_test_img 4M
53 echo "== Testing conversion with -n fails with no target file =="
54 # check .orig file does not exist
55 rm -f "$TEST_IMG.orig"
56 if $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n "$TEST_IMG" "$TEST_IMG.orig" >/dev/null 2>&1; then
57 exit 1
60 echo "== Testing conversion with -n succeeds with a target file =="
61 rm -f "$TEST_IMG.orig"
62 cp "$TEST_IMG" "$TEST_IMG.orig"
63 if ! $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n "$TEST_IMG" "$TEST_IMG.orig" ; then
64 exit 1
67 echo "== Testing conversion to raw is the same after conversion with -n =="
68 # compare the raw files
69 if ! $QEMU_IMG convert -f $IMGFMT -O raw "$TEST_IMG" "$TEST_IMG.raw1" ; then
70 exit 1
73 if ! $QEMU_IMG convert -f $IMGFMT -O raw "$TEST_IMG.orig" "$TEST_IMG.raw2" ; then
74 exit 1
77 if ! cmp "$TEST_IMG.raw1" "$TEST_IMG.raw2" ; then
78 exit 1
81 echo "== Testing conversion back to original format =="
82 if ! $QEMU_IMG convert -f raw -O $IMGFMT -n "$TEST_IMG.raw2" "$TEST_IMG" ; then
83 exit 1
85 _check_test_img
87 echo "== Testing conversion to a smaller file fails =="
88 rm -f "$TEST_IMG.orig"
89 mv "$TEST_IMG" "$TEST_IMG.orig"
90 _make_test_img 2M
91 if $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n "$TEST_IMG.orig" "$TEST_IMG" >/dev/null 2>&1; then
92 exit 1
95 rm -f "$TEST_IMG.orig" "$TEST_IMG.raw" "$TEST_IMG.raw2"
97 echo "*** done"
98 rm -f $seq.full
99 status=0
100 exit 0