aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-09-27 16:48:39 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-09-27 16:48:39 +0100
commitcfe4cade054c0e0d00d0185cdc433a9e3ce3e2e4 (patch)
treefb6658177a90773b24ec9ca6fd00f4142fb9887e /tests
parentd666cacaeab904fb6e8361ee791b6e8ab8448577 (diff)
parentb156d51b62e6970753e1f9f36f7c4d5fdbf4c619 (diff)
downloadqemu-cfe4cade054c0e0d00d0185cdc433a9e3ce3e2e4.zip
qemu-cfe4cade054c0e0d00d0185cdc433a9e3ce3e2e4.tar.gz
qemu-cfe4cade054c0e0d00d0185cdc433a9e3ce3e2e4.tar.bz2
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Block layer patches # gpg: Signature made Tue 26 Sep 2017 14:52:32 BST # gpg: using RSA key 0x7F09B272C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: (24 commits) block/qcow2-bitmap: fix use of uninitialized pointer qemu-iotests: add shrinking image test qcow2: add shrink image support qcow2: add qcow2_cache_discard qemu-img: add --shrink flag for resize iotests: fix 181: enable postcopy-ram capability on target qemu-iotests: Test change-backing-file command block: Fix permissions after bdrv_reopen() block: reopen: Queue children after their parents block: Base permissions on rw state after reopen block: Add reopen queue to bdrv_check_perm() block: Add reopen_queue to bdrv_child_perm() qemu-io: Drop write permissions before read-only reopen block: Clean up some bad code in the vvfat driver block/throttle-groups.c: allocate RestartData on the heap throttle: Assert that bkt->max is valid in throttle_compute_wait() iotests: Print full path of bad output if mismatch iotests: use virtio aliases for 067 iotests: use -ccw on s390x for 051 iotests: use -ccw on s390x for 040, 139, and 182 ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/qemu-iotests/0406
-rwxr-xr-xtests/qemu-iotests/05112
-rw-r--r--tests/qemu-iotests/051.out2
-rw-r--r--tests/qemu-iotests/051.pc.out2
-rwxr-xr-xtests/qemu-iotests/0672
-rw-r--r--tests/qemu-iotests/067.out2
-rwxr-xr-xtests/qemu-iotests/1024
-rwxr-xr-xtests/qemu-iotests/1062
-rw-r--r--tests/qemu-iotests/13912
-rw-r--r--tests/qemu-iotests/163170
-rw-r--r--tests/qemu-iotests/163.out5
-rwxr-xr-xtests/qemu-iotests/1722
-rwxr-xr-xtests/qemu-iotests/1812
-rw-r--r--tests/qemu-iotests/181.out1
-rwxr-xr-xtests/qemu-iotests/18213
-rwxr-xr-xtests/qemu-iotests/1866
-rw-r--r--tests/qemu-iotests/187.out2
-rwxr-xr-xtests/qemu-iotests/19592
-rw-r--r--tests/qemu-iotests/195.out78
-rwxr-xr-xtests/qemu-iotests/check2
-rw-r--r--tests/qemu-iotests/group2
21 files changed, 399 insertions, 20 deletions
diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040
index 95b7510..c284d08 100755
--- a/tests/qemu-iotests/040
+++ b/tests/qemu-iotests/040
@@ -82,7 +82,11 @@ class TestSingleDrive(ImageCommitTestCase):
qemu_io('-f', 'raw', '-c', 'write -P 0xab 0 524288', backing_img)
qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xef 524288 524288', mid_img)
self.vm = iotests.VM().add_drive(test_img, "node-name=top,backing.node-name=mid,backing.backing.node-name=base", interface="none")
- self.vm.add_device("virtio-scsi-pci")
+ if iotests.qemu_default_machine == 's390-ccw-virtio':
+ self.vm.add_device("virtio-scsi-ccw")
+ else:
+ self.vm.add_device("virtio-scsi-pci")
+
self.vm.add_device("scsi-hd,id=scsi0,drive=drive0")
self.vm.launch()
diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
index c8cfc76..dba8816 100755
--- a/tests/qemu-iotests/051
+++ b/tests/qemu-iotests/051
@@ -103,7 +103,17 @@ echo
echo === Device without drive ===
echo
-run_qemu -device virtio-scsi-pci -device scsi-hd
+case "$QEMU_DEFAULT_MACHINE" in
+ s390-ccw-virtio)
+ virtio_scsi=virtio-scsi-ccw
+ ;;
+ *)
+ virtio_scsi=virtio-scsi-pci
+ ;;
+esac
+
+run_qemu -device $virtio_scsi -device scsi-hd |
+ sed -e "s/$virtio_scsi/VIRTIO_SCSI/"
echo
echo === Overriding backing file ===
diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out
index 4d3b1ff..e3c6eab 100644
--- a/tests/qemu-iotests/051.out
+++ b/tests/qemu-iotests/051.out
@@ -49,7 +49,7 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=qcow2,format=qcow2: Cannot specif
=== Device without drive ===
-Testing: -device virtio-scsi-pci -device scsi-hd
+Testing: -device VIRTIO_SCSI -device scsi-hd
QEMU X.Y.Z monitor - type 'help' for more information
(qemu) QEMU_PROG: -device scsi-hd: drive property not set
diff --git a/tests/qemu-iotests/051.pc.out b/tests/qemu-iotests/051.pc.out
index 762fb9f..f2c5622 100644
--- a/tests/qemu-iotests/051.pc.out
+++ b/tests/qemu-iotests/051.pc.out
@@ -49,7 +49,7 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=qcow2,format=qcow2: Cannot specif
=== Device without drive ===
-Testing: -device virtio-scsi-pci -device scsi-hd
+Testing: -device VIRTIO_SCSI -device scsi-hd
QEMU X.Y.Z monitor - type 'help' for more information
(qemu) QEMU_PROG: -device scsi-hd: drive property not set
diff --git a/tests/qemu-iotests/067 b/tests/qemu-iotests/067
index 5d4ca4b..ee9595f 100755
--- a/tests/qemu-iotests/067
+++ b/tests/qemu-iotests/067
@@ -141,7 +141,7 @@ echo
echo === Empty drive with -device and device_del ===
echo
-run_qemu -device virtio-scsi-pci -device scsi-cd,id=cd0 <<EOF
+run_qemu -device virtio-scsi -device scsi-cd,id=cd0 <<EOF
{ "execute": "qmp_capabilities" }
{ "execute": "query-block" }
{ "execute": "device_del", "arguments": { "id": "cd0" } }
diff --git a/tests/qemu-iotests/067.out b/tests/qemu-iotests/067.out
index bd70557..58e83c4 100644
--- a/tests/qemu-iotests/067.out
+++ b/tests/qemu-iotests/067.out
@@ -419,7 +419,7 @@ Testing:
=== Empty drive with -device and device_del ===
-Testing: -device virtio-scsi-pci -device scsi-cd,id=cd0
+Testing: -device virtio-scsi -device scsi-cd,id=cd0
{
QMP_VERSION
}
diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102
index 87db1bb..d7ad8d9 100755
--- a/tests/qemu-iotests/102
+++ b/tests/qemu-iotests/102
@@ -54,7 +54,7 @@ _make_test_img $IMG_SIZE
$QEMU_IO -c 'write 0 64k' "$TEST_IMG" | _filter_qemu_io
# Remove data cluster from image (first cluster: image header, second: reftable,
# third: refblock, fourth: L1 table, fifth: L2 table)
-$QEMU_IMG resize -f raw "$TEST_IMG" $((5 * 64 * 1024))
+$QEMU_IMG resize -f raw --shrink "$TEST_IMG" $((5 * 64 * 1024))
$QEMU_IO -c map "$TEST_IMG"
$QEMU_IMG map "$TEST_IMG"
@@ -69,7 +69,7 @@ $QEMU_IO -c 'write 0 64k' "$TEST_IMG" | _filter_qemu_io
qemu_comm_method=monitor _launch_qemu -drive if=none,file="$TEST_IMG",id=drv0
-$QEMU_IMG resize -f raw "$TEST_IMG" $((5 * 64 * 1024))
+$QEMU_IMG resize -f raw --shrink "$TEST_IMG" $((5 * 64 * 1024))
_send_qemu_cmd $QEMU_HANDLE 'qemu-io drv0 map' 'allocated' \
| sed -e 's/^(qemu).*qemu-io drv0 map...$/(qemu) qemu-io drv0 map/'
diff --git a/tests/qemu-iotests/106 b/tests/qemu-iotests/106
index 3264957..bfe71f4 100755
--- a/tests/qemu-iotests/106
+++ b/tests/qemu-iotests/106
@@ -83,7 +83,7 @@ echo '=== Testing image shrinking ==='
for growth_mode in falloc full off; do
echo
echo "--- growth_mode=$growth_mode ---"
- $QEMU_IMG resize -f "$IMGFMT" --preallocation=$growth_mode "$TEST_IMG" -${GROWTH_SIZE}K
+ $QEMU_IMG resize -f "$IMGFMT" --shrink --preallocation=$growth_mode "$TEST_IMG" -${GROWTH_SIZE}K
done
# success, all done
diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139
index 50cf40f..f8f0280 100644
--- a/tests/qemu-iotests/139
+++ b/tests/qemu-iotests/139
@@ -25,13 +25,21 @@ import time
base_img = os.path.join(iotests.test_dir, 'base.img')
new_img = os.path.join(iotests.test_dir, 'new.img')
+if iotests.qemu_default_machine == 's390-ccw-virtio':
+ default_virtio_blk = 'virtio-blk-ccw'
+else:
+ default_virtio_blk = 'virtio-blk-pci'
class TestBlockdevDel(iotests.QMPTestCase):
def setUp(self):
iotests.qemu_img('create', '-f', iotests.imgfmt, base_img, '1M')
self.vm = iotests.VM()
- self.vm.add_device("virtio-scsi-pci,id=virtio-scsi")
+ if iotests.qemu_default_machine == 's390-ccw-virtio':
+ self.vm.add_device("virtio-scsi-ccw,id=virtio-scsi")
+ else:
+ self.vm.add_device("virtio-scsi-pci,id=virtio-scsi")
+
self.vm.launch()
def tearDown(self):
@@ -87,7 +95,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
self.checkBlockDriverState(node, expect_error)
# Add a device model
- def addDeviceModel(self, device, backend, driver = 'virtio-blk-pci'):
+ def addDeviceModel(self, device, backend, driver = default_virtio_blk):
result = self.vm.qmp('device_add', id = device,
driver = driver, drive = backend)
self.assert_qmp(result, 'return', {})
diff --git a/tests/qemu-iotests/163 b/tests/qemu-iotests/163
new file mode 100644
index 0000000..4038423
--- /dev/null
+++ b/tests/qemu-iotests/163
@@ -0,0 +1,170 @@
+#!/usr/bin/env python
+#
+# Tests for shrinking images
+#
+# Copyright (c) 2016-2017 Parallels International GmbH
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+
+import os, random, iotests, struct, qcow2
+from iotests import qemu_img, qemu_io, image_size
+
+test_img = os.path.join(iotests.test_dir, 'test.img')
+check_img = os.path.join(iotests.test_dir, 'check.img')
+
+def size_to_int(str):
+ suff = ['B', 'K', 'M', 'G', 'T']
+ return int(str[:-1]) * 1024**suff.index(str[-1:])
+
+class ShrinkBaseClass(iotests.QMPTestCase):
+ image_len = '128M'
+ shrink_size = '10M'
+ chunk_size = '16M'
+ refcount_bits = '16'
+
+ def __qcow2_check(self, filename):
+ entry_bits = 3
+ entry_size = 1 << entry_bits
+ l1_mask = 0x00fffffffffffe00
+ div_roundup = lambda n, d: (n + d - 1) / d
+
+ def split_by_n(data, n):
+ for x in xrange(0, len(data), n):
+ yield struct.unpack('>Q', data[x:x + n])[0] & l1_mask
+
+ def check_l1_table(h, l1_data):
+ l1_list = list(split_by_n(l1_data, entry_size))
+ real_l1_size = div_roundup(h.size,
+ 1 << (h.cluster_bits*2 - entry_size))
+ used, unused = l1_list[:real_l1_size], l1_list[real_l1_size:]
+
+ self.assertTrue(len(used) != 0, "Verifying l1 table content")
+ self.assertFalse(any(unused), "Verifying l1 table content")
+
+ def check_reftable(fd, h, reftable):
+ for offset in split_by_n(reftable, entry_size):
+ if offset != 0:
+ fd.seek(offset)
+ cluster = fd.read(1 << h.cluster_bits)
+ self.assertTrue(any(cluster), "Verifying reftable content")
+
+ with open(filename, "rb") as fd:
+ h = qcow2.QcowHeader(fd)
+
+ fd.seek(h.l1_table_offset)
+ l1_table = fd.read(h.l1_size << entry_bits)
+
+ fd.seek(h.refcount_table_offset)
+ reftable = fd.read(h.refcount_table_clusters << h.cluster_bits)
+
+ check_l1_table(h, l1_table)
+ check_reftable(fd, h, reftable)
+
+ def __raw_check(self, filename):
+ pass
+
+ image_check = {
+ 'qcow2' : __qcow2_check,
+ 'raw' : __raw_check
+ }
+
+ def setUp(self):
+ if iotests.imgfmt == 'raw':
+ qemu_img('create', '-f', iotests.imgfmt, test_img, self.image_len)
+ qemu_img('create', '-f', iotests.imgfmt, check_img,
+ self.shrink_size)
+ else:
+ qemu_img('create', '-f', iotests.imgfmt,
+ '-o', 'cluster_size=' + self.cluster_size +
+ ',refcount_bits=' + self.refcount_bits,
+ test_img, self.image_len)
+ qemu_img('create', '-f', iotests.imgfmt,
+ '-o', 'cluster_size=%s'% self.cluster_size,
+ check_img, self.shrink_size)
+ qemu_io('-c', 'write -P 0xff 0 ' + self.shrink_size, check_img)
+
+ def tearDown(self):
+ os.remove(test_img)
+ os.remove(check_img)
+
+ def image_verify(self):
+ self.assertEqual(image_size(test_img), image_size(check_img),
+ "Verifying image size")
+ self.image_check[iotests.imgfmt](self, test_img)
+
+ if iotests.imgfmt == 'raw':
+ return
+ self.assertEqual(qemu_img('check', test_img), 0,
+ "Verifying image corruption")
+
+ def test_empty_image(self):
+ qemu_img('resize', '-f', iotests.imgfmt, '--shrink', test_img,
+ self.shrink_size)
+
+ self.assertEqual(
+ qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, test_img),
+ qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, check_img),
+ "Verifying image content")
+
+ self.image_verify()
+
+ def test_sequential_write(self):
+ for offs in range(0, size_to_int(self.image_len),
+ size_to_int(self.chunk_size)):
+ qemu_io('-c', 'write -P 0xff %d %s' % (offs, self.chunk_size),
+ test_img)
+
+ qemu_img('resize', '-f', iotests.imgfmt, '--shrink', test_img,
+ self.shrink_size)
+
+ self.assertEqual(qemu_img("compare", test_img, check_img), 0,
+ "Verifying image content")
+
+ self.image_verify()
+
+ def test_random_write(self):
+ offs_list = range(0, size_to_int(self.image_len),
+ size_to_int(self.chunk_size))
+ random.shuffle(offs_list)
+ for offs in offs_list:
+ qemu_io('-c', 'write -P 0xff %d %s' % (offs, self.chunk_size),
+ test_img)
+
+ qemu_img('resize', '-f', iotests.imgfmt, '--shrink', test_img,
+ self.shrink_size)
+
+ self.assertEqual(qemu_img("compare", test_img, check_img), 0,
+ "Verifying image content")
+
+ self.image_verify()
+
+class TestShrink512(ShrinkBaseClass):
+ image_len = '3M'
+ shrink_size = '1M'
+ chunk_size = '256K'
+ cluster_size = '512'
+ refcount_bits = '64'
+
+class TestShrink64K(ShrinkBaseClass):
+ cluster_size = '64K'
+
+class TestShrink1M(ShrinkBaseClass):
+ cluster_size = '1M'
+ refcount_bits = '1'
+
+ShrinkBaseClass = None
+
+if __name__ == '__main__':
+ iotests.main(supported_fmts=['raw', 'qcow2'])
diff --git a/tests/qemu-iotests/163.out b/tests/qemu-iotests/163.out
new file mode 100644
index 0000000..dae404e
--- /dev/null
+++ b/tests/qemu-iotests/163.out
@@ -0,0 +1,5 @@
+.........
+----------------------------------------------------------------------
+Ran 9 tests
+
+OK
diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172
index 826d6fe..02c5f79 100755
--- a/tests/qemu-iotests/172
+++ b/tests/qemu-iotests/172
@@ -56,7 +56,7 @@ function do_run_qemu()
done
fi
echo quit
- ) | $QEMU -nographic -monitor stdio -serial none "$@"
+ ) | $QEMU -machine accel=qtest -nographic -monitor stdio -serial none "$@"
echo
}
diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181
index 0333dda..0c91e8f 100755
--- a/tests/qemu-iotests/181
+++ b/tests/qemu-iotests/181
@@ -93,7 +93,9 @@ echo
# Slow down migration so much that it definitely won't finish before we can
# switch to postcopy
+# Enable postcopy-ram capability both on source and destination
silent=yes
+_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)"
_send_qemu_cmd $src 'migrate_set_speed 4k' "(qemu)"
_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)"
_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)"
diff --git a/tests/qemu-iotests/181.out b/tests/qemu-iotests/181.out
index 6534ba2..d58c6a9 100644
--- a/tests/qemu-iotests/181.out
+++ b/tests/qemu-iotests/181.out
@@ -20,7 +20,6 @@ read 65536/65536 bytes at offset 0
=== Do some I/O on the destination ===
-QEMU X.Y.Z monitor - type 'help' for more information
(qemu) qemu-io disk "read -P 0x55 0 64k"
read 65536/65536 bytes at offset 0
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
diff --git a/tests/qemu-iotests/182 b/tests/qemu-iotests/182
index 7ecbb22..2e078ce 100755
--- a/tests/qemu-iotests/182
+++ b/tests/qemu-iotests/182
@@ -45,17 +45,26 @@ _supported_os Linux
size=32M
+case "$QEMU_DEFAULT_MACHINE" in
+ s390-ccw-virtio)
+ virtioblk=virtio-blk-ccw
+ ;;
+ *)
+ virtioblk=virtio-blk-pci
+ ;;
+esac
+
_make_test_img $size
echo "Starting QEMU"
_launch_qemu -drive file=$TEST_IMG,if=none,id=drive0,file.locking=on \
- -device virtio-blk-pci,drive=drive0
+ -device $virtioblk,drive=drive0
echo
echo "Starting a second QEMU using the same image should fail"
echo 'quit' | $QEMU -monitor stdio \
-drive file=$TEST_IMG,if=none,id=drive0,file.locking=on \
- -device virtio-blk-pci,drive=drive0 2>&1 | _filter_testdir 2>&1 |
+ -device $virtioblk,drive=drive0 2>&1 | _filter_testdir 2>&1 |
_filter_qemu |
sed -e '/falling back to POSIX file/d' \
-e '/locks can be lost unexpectedly/d'
diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186
index 2b9f618..44cc01e 100755
--- a/tests/qemu-iotests/186
+++ b/tests/qemu-iotests/186
@@ -56,15 +56,15 @@ function do_run_qemu()
done
fi
echo quit
- ) | $QEMU -S -nodefaults -display none -device virtio-scsi-pci -monitor stdio "$@" 2>&1
+ ) | $QEMU -S -display none -device virtio-scsi-pci -monitor stdio "$@" 2>&1
echo
}
function check_info_block()
{
echo "info block" |
- QEMU_OPTIONS="" do_run_qemu "$@" | _filter_win32 | _filter_hmp |
- _filter_qemu | _filter_generated_node_ids
+ do_run_qemu "$@" | _filter_win32 | _filter_hmp | _filter_qemu |
+ _filter_generated_node_ids
}
diff --git a/tests/qemu-iotests/187.out b/tests/qemu-iotests/187.out
index 68fb944..30b987f7 100644
--- a/tests/qemu-iotests/187.out
+++ b/tests/qemu-iotests/187.out
@@ -12,7 +12,7 @@ Start from read-write
wrote 65536/65536 bytes at offset 0
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-write failed: Operation not permitted
+Block node is read-only
wrote 65536/65536 bytes at offset 0
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done
diff --git a/tests/qemu-iotests/195 b/tests/qemu-iotests/195
new file mode 100755
index 0000000..05a239c
--- /dev/null
+++ b/tests/qemu-iotests/195
@@ -0,0 +1,92 @@
+#!/bin/bash
+#
+# Test change-backing-file command
+#
+# Copyright (C) 2017 Red Hat, Inc.
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+
+# creator
+owner=kwolf@redhat.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+status=1 # failure is the default!
+
+_cleanup()
+{
+ _cleanup_test_img
+ rm -f "$TEST_IMG.mid"
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_supported_fmt qcow2
+_supported_proto file
+_supported_os Linux
+
+function do_run_qemu()
+{
+ echo Testing: "$@" | _filter_imgfmt
+ $QEMU -nographic -qmp-pretty stdio -serial none "$@"
+ echo
+}
+
+function run_qemu()
+{
+ do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp \
+ | _filter_qemu_io | _filter_generated_node_ids
+}
+
+size=64M
+TEST_IMG="$TEST_IMG.base" _make_test_img $size
+TEST_IMG="$TEST_IMG.mid" _make_test_img -b "$TEST_IMG.base"
+_make_test_img -b "$TEST_IMG.mid"
+
+echo
+echo "Change backing file of mid (opened read-only)"
+echo
+
+run_qemu -drive if=none,file="$TEST_IMG",backing.node-name=mid <<EOF
+{"execute":"qmp_capabilities"}
+{"execute":"change-backing-file", "arguments":{"device":"none0","image-node-name":"mid","backing-file":"/dev/null"}}
+{"execute":"quit"}
+EOF
+
+TEST_IMG="$TEST_IMG.mid" _img_info
+
+echo
+echo "Change backing file of top (opened writable)"
+echo
+
+TEST_IMG="$TEST_IMG.mid" _make_test_img -b "$TEST_IMG.base"
+
+run_qemu -drive if=none,file="$TEST_IMG",node-name=top <<EOF
+{"execute":"qmp_capabilities"}
+{"execute":"change-backing-file", "arguments":{"device":"none0","image-node-name":"top","backing-file":"/dev/null"}}
+{"execute":"quit"}
+EOF
+
+_img_info
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/195.out b/tests/qemu-iotests/195.out
new file mode 100644
index 0000000..7613575
--- /dev/null
+++ b/tests/qemu-iotests/195.out
@@ -0,0 +1,78 @@
+QA output created by 195
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864
+Formatting 'TEST_DIR/t.IMGFMT.mid', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.mid
+
+Change backing file of mid (opened read-only)
+
+Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,backing.node-name=mid
+{
+ QMP_VERSION
+}
+{
+ "return": {
+ }
+}
+{
+ "return": {
+ }
+}
+{
+ "return": {
+ }
+}
+{
+ "timestamp": {
+ "seconds": TIMESTAMP,
+ "microseconds": TIMESTAMP
+ },
+ "event": "SHUTDOWN",
+ "data": {
+ "guest": false
+ }
+}
+
+image: TEST_DIR/t.IMGFMT.mid
+file format: IMGFMT
+virtual size: 64M (67108864 bytes)
+cluster_size: 65536
+backing file: /dev/null
+backing file format: IMGFMT
+
+Change backing file of top (opened writable)
+
+Formatting 'TEST_DIR/t.IMGFMT.mid', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base
+Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,node-name=top
+{
+ QMP_VERSION
+}
+{
+ "return": {
+ }
+}
+{
+ "return": {
+ }
+}
+{
+ "return": {
+ }
+}
+{
+ "timestamp": {
+ "seconds": TIMESTAMP,
+ "microseconds": TIMESTAMP
+ },
+ "event": "SHUTDOWN",
+ "data": {
+ "guest": false
+ }
+}
+
+image: TEST_DIR/t.IMGFMT
+file format: IMGFMT
+virtual size: 64M (67108864 bytes)
+cluster_size: 65536
+backing file: /dev/null
+backing file format: IMGFMT
+*** done
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index d504b6e..4583a0c 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -353,7 +353,7 @@ do
else
echo " - output mismatch (see $seq.out.bad)"
mv $tmp.out $seq.out.bad
- $diff -w "$reference" $seq.out.bad
+ $diff -w "$reference" $(realpath $seq.out.bad)
err=true
fi
fi
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 94e7648..cdccee3 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -166,6 +166,7 @@
159 rw auto quick
160 rw auto quick
162 auto quick
+163 rw auto quick
165 rw auto quick
170 rw auto quick
171 rw auto quick
@@ -189,3 +190,4 @@
190 rw auto quick
192 rw auto quick
194 rw auto migration quick
+195 rw auto quick