check: Only test ipack when it is compiled in
[qemu/kevin.git] / tests / qemu-iotests / 130
blob2c4b94da1bf567ed0537804a4f5d3a7b311c541e
1 #!/bin/bash
3 # Test that temporary backing file overrides (on the command line or in
4 # blockdev-add) don't replace the original path stored in the image during
5 # header updates.
7 # Copyright (C) 2015 Red Hat, Inc.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 # creator
24 owner=kwolf@redhat.com
26 seq="$(basename $0)"
27 echo "QA output created by $seq"
29 here="$PWD"
30 status=1 # failure is the default!
32 _cleanup()
34 _cleanup_qemu
35 _cleanup_test_img
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.qemu
44 _supported_fmt qcow2
45 _supported_proto generic
46 _unsupported_proto vxhs
47 _supported_os Linux
48 # We are going to use lazy-refcounts
49 _unsupported_imgopts 'compat=0.10'
51 qemu_comm_method="monitor"
54 TEST_IMG="$TEST_IMG.orig" _make_test_img 64M
55 TEST_IMG="$TEST_IMG.base" _make_test_img 64M
56 _make_test_img 64M
57 _img_info | _filter_img_info
59 echo
60 echo "=== HMP commit ==="
61 echo
62 # bdrv_make_empty() involves a header update for qcow2
64 # Test that a backing file isn't written
65 _launch_qemu -drive id=testdisk,file="$TEST_IMG",backing.file.filename="$TEST_IMG.base"
66 _send_qemu_cmd $QEMU_HANDLE "commit testdisk" "(qemu)"
67 _send_qemu_cmd $QEMU_HANDLE '' '(qemu)'
68 _cleanup_qemu
69 _img_info | _filter_img_info
71 # Make sure that if there was a backing file that was just overridden on the
72 # command line, that backing file is retained, with the right format
73 _make_test_img -F raw -b "$TEST_IMG.orig" 64M
74 _launch_qemu -drive id=testdisk,file="$TEST_IMG",backing.file.filename="$TEST_IMG.base",backing.driver=$IMGFMT
75 _send_qemu_cmd $QEMU_HANDLE "commit testdisk" "(qemu)"
76 _send_qemu_cmd $QEMU_HANDLE '' '(qemu)'
77 _cleanup_qemu
78 _img_info | _filter_img_info
80 echo
81 echo "=== Marking image dirty (lazy refcounts) ==="
82 echo
84 # Test that a backing file isn't written
85 _make_test_img 64M
86 $QEMU_IO -c "open -o backing.file.filename=$TEST_IMG.base,lazy-refcounts=on $TEST_IMG" -c "write 0 4k" | _filter_qemu_io
87 _img_info | _filter_img_info
89 # Make sure that if there was a backing file that was just overridden on the
90 # command line, that backing file is retained, with the right format
91 _make_test_img -F raw -b "$TEST_IMG.orig" 64M
92 $QEMU_IO -c "open -o backing.file.filename=$TEST_IMG.base,backing.driver=$IMGFMT,lazy-refcounts=on $TEST_IMG" -c "write 0 4k" | _filter_qemu_io
93 _img_info | _filter_img_info
95 # success, all done
96 echo '*** done'
97 rm -f $seq.full
98 status=0