aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/176
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-11-17 19:08:07 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-11-17 19:08:07 +0000
commit2e02083438962d26ef9dcc7100f3b378104183db (patch)
treecff9297aa3887b7d70c3250914b76277b65ee1e9 /tests/qemu-iotests/176
parent085ee6d282d38b430c850900c051e6b9e8c1681f (diff)
parentd5a49c6e7d9e42059450674ec845b7bc0d62cb7e (diff)
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Block layer patches for 2.11.0-rc2 # gpg: Signature made Fri 17 Nov 2017 17:58:36 GMT # 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: (25 commits) iotests: Make 087 pass without AIO enabled block: Make bdrv_next() keep strong references qcow2: Fix overly broad madvise() qcow2: Refuse to get unaligned offsets from cache qcow2: Add bounds check to get_refblock_offset() block: Guard against NULL bs->drv qcow2: Unaligned zero cluster in handle_alloc() qcow2: check_errors are fatal qcow2: reject unaligned offsets in write compressed iotests: Add test for failing qemu-img commit tests: Add check-qobject for equality tests iotests: Add test for non-string option reopening block: qobject_is_equal() in bdrv_reopen_prepare() qapi: Add qobject_is_equal() qapi/qlist: Add qlist_append_null() macro qapi/qnull: Add own header qcow2: fix image corruption on commit with persistent bitmap iotests: test clearing unknown autoclear_features by qcow2 block: Fix permissions in image activation qcow2: fix image corruption after committing qcow2 image into base ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/qemu-iotests/176')
-rwxr-xr-xtests/qemu-iotests/17655
1 files changed, 48 insertions, 7 deletions
diff --git a/tests/qemu-iotests/176 b/tests/qemu-iotests/176
index 950b28720e..0f31a20294 100755
--- a/tests/qemu-iotests/176
+++ b/tests/qemu-iotests/176
@@ -3,10 +3,11 @@
# Commit changes into backing chains and empty the top image if the
# backing image is not explicitly specified.
#
-# Variant of 097, which includes snapshots to test different codepath
-# in qcow2
+# Variant of 097, which includes snapshots and persistent bitmaps, to
+# tickle the slow codepath in qcow2. See also 198, for another feature
+# that tickles the slow codepath.
#
-# Copyright (C) 2014 Red Hat, Inc.
+# Copyright (C) 2014, 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
@@ -43,11 +44,18 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
. ./common.filter
. ./common.pattern
-# Any format supporting backing files and bdrv_make_empty
+# This test is specific to qcow2
_supported_fmt qcow2
_supported_proto file
_supported_os Linux
+function run_qemu()
+{
+ $QEMU -nographic -qmp stdio -serial none "$@" 2>&1 \
+ | _filter_testdir | _filter_qmp | _filter_qemu
+}
+
+for reason in snapshot bitmap; do
# Four passes:
# 0: Two-layer backing chain, commit to upper backing file (implicitly)
@@ -66,14 +74,29 @@ _supported_os Linux
for i in 0 1 2 3; do
echo
-echo "=== Test pass $i ==="
+echo "=== Test pass $reason.$i ==="
echo
len=$((2100 * 1024 * 1024 + 512)) # larger than 2G, and not cluster aligned
TEST_IMG="$TEST_IMG.base" _make_test_img $len
TEST_IMG="$TEST_IMG.itmd" _make_test_img -b "$TEST_IMG.base" $len
_make_test_img -b "$TEST_IMG.itmd" $len
-$QEMU_IMG snapshot -c snap "$TEST_IMG"
+# Update the top image to use a feature that is incompatible with fast path
+case $reason in
+ snapshot) $QEMU_IMG snapshot -c snap "$TEST_IMG" ;;
+ bitmap)
+ run_qemu <<EOF
+{ "execute": "qmp_capabilities" }
+{ "execute": "blockdev-add",
+ "arguments": { "driver": "qcow2", "node-name": "drive0",
+ "file": { "driver": "file", "filename": "$TEST_IMG" } } }
+{ "execute": "block-dirty-bitmap-add",
+ "arguments": { "node": "drive0", "name": "bitmap0",
+ "persistent": true, "autoload": true } }
+{ "execute": "quit" }
+EOF
+ ;;
+esac
$QEMU_IO -c "write -P 1 0x7ffd0000 192k" "$TEST_IMG.base" | _filter_qemu_io
$QEMU_IO -c "write -P 2 0x7ffe0000 128k" "$TEST_IMG.itmd" | _filter_qemu_io
@@ -122,8 +145,26 @@ $QEMU_IMG map "$TEST_IMG.base" | _filter_qemu_img_map
$QEMU_IMG map "$TEST_IMG.itmd" | _filter_qemu_img_map
$QEMU_IMG map "$TEST_IMG" | _filter_qemu_img_map
-done
+# Check that the reason for slow path is still present, as appropriate
+case $reason in
+ snapshot)
+ $QEMU_IMG snapshot -l "$TEST_IMG" |
+ sed 's/^\(.\{20\}\).*/\1/; s/ *$//' ;;
+ bitmap)
+ run_qemu <<EOF
+{ "execute": "qmp_capabilities" }
+{ "execute": "blockdev-add",
+ "arguments": { "driver": "qcow2", "node-name": "drive0",
+ "file": { "driver": "file", "filename": "$TEST_IMG" } } }
+{ "execute": "x-debug-block-dirty-bitmap-sha256",
+ "arguments": { "node": "drive0", "name": "bitmap0" } }
+{ "execute": "quit" }
+EOF
+ ;;
+esac
+done
+done
# success, all done
echo "*** done"