Browse Source
-----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJZ16bbAAoJEH8JsnLIjy/WjfIP/32TrOPs3e/z1/ojgKrGU48y muiX3j2sr/7s0tWQQg2c+CM6pogmRRubIXB2RzqesZhSrXO6/6vimkprpCcimWNx R5DWATzVWxNAwjpmPYvZ8uyLYaT38S/V3VKzZ+Ga2S96tTEDVuQa7tgnrpfet4vY AYr8gJVvWgWwZXH00w2wD0hpoAGsRtFf6o9oqS5wPJ/wWrael/HubRElRbSzTc9Z lNHibk7eejalLQ9xfCaB2KTaVgzwBaa4RNXkoRjjAIUqQ/JNEWZ2o6cQQTtah/Xl AMckw2EuOMJuti2eoWcXySXRBEVdnYLwgtXwcHpH6FxYrWpW3upwOgLRJuOiR5o0 ldIQAfYQW8bVSVc8XLzNTsEZu1XY/RQurdohJvhh+j7fYv9z9kBQeUjZkMloQfv+ /T3xxQc1zp7D33qvy9is8/qP1HiC9lD1JEnzs9PuOwGHHFusIglxaC8JP+9HSu/u jf0EJZfSXyw1wDX9bBsATcFNZB9upMN+rJ1SS/yr2V7Tki570wlAhH02Rq/IUiVE pVtRn7DjT3nBYUJp1se6fZ6v9aJC+lXMlpeZ/xZFUgdGRBi4k2KxD7UIRJIj9KTE 7BEI54n7AjVP0PcU5LCqEY32R4UBG8E3QZGl5MXJO8UfAly2CtU+JHOokY/MpuZA SkSecvctgPB9oc86uSaN =y2Kg -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging Block layer patches # gpg: Signature made Fri 06 Oct 2017 16:52:59 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: (54 commits) block/mirror: check backing in bdrv_mirror_top_flush qcow2: truncate the tail of the image file after shrinking the image qcow2: fix return error code in qcow2_truncate() iotests: Fix 195 if IMGFMT is part of TEST_DIR block/mirror: check backing in bdrv_mirror_top_refresh_filename block: support passthrough of BDRV_REQ_FUA in crypto driver block: convert qcrypto_block_encrypt|decrypt to take bytes offset block: convert crypto driver to bdrv_co_preadv|pwritev block: fix data type casting for crypto payload offset crypto: expose encryption sector size in APIs block: use 1 MB bounce buffers for crypto instead of 16KB iotests: Add test 197 for covering copy-on-read block: Perform copy-on-read in loop block: Add blkdebug hook for copy-on-read iotests: Restore stty settings on completion block: Uniform handling of 0-length bdrv_get_block_status() qemu-io: Add -C for opening with copy-on-read commit: Remove overlay_bs qemu-iotests: Test commit block job where top has two parents qemu-iotests: Allow QMP pretty printing in common.qemu ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>pull/69/head
45 changed files with 2333 additions and 1311 deletions
@ -0,0 +1,153 @@ |
|||
#!/bin/bash |
|||
# |
|||
# Test commit block job where top has two parents |
|||
# |
|||
# 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! |
|||
|
|||
MIG_SOCKET="${TEST_DIR}/migrate" |
|||
|
|||
_cleanup() |
|||
{ |
|||
rm -f "${TEST_IMG}.mid" |
|||
rm -f "${TEST_IMG}.ovl2" |
|||
rm -f "${TEST_IMG}.ovl3" |
|||
_cleanup_test_img |
|||
_cleanup_qemu |
|||
} |
|||
trap "_cleanup; exit \$status" 0 1 2 3 15 |
|||
|
|||
# get standard environment, filters and checks |
|||
. ./common.rc |
|||
. ./common.filter |
|||
. ./common.qemu |
|||
|
|||
_supported_fmt qcow2 |
|||
_unsupported_imgopts compat=0.10 |
|||
_supported_proto file |
|||
_supported_os Linux |
|||
|
|||
size=64M |
|||
|
|||
echo |
|||
echo === Preparing and starting VM === |
|||
echo |
|||
|
|||
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" |
|||
TEST_IMG="${TEST_IMG}.ovl2" _make_test_img -b "${TEST_IMG}.mid" |
|||
|
|||
$QEMU_IO -c 'write -P 0x55 1M 64k' "${TEST_IMG}.mid" | _filter_qemu_io |
|||
|
|||
qemu_comm_method="qmp" |
|||
qmp_pretty="y" |
|||
|
|||
_launch_qemu \ |
|||
-blockdev "driver=${IMGFMT},file.driver=file,file.filename=${TEST_IMG}.base,node-name=base" \ |
|||
-blockdev "driver=${IMGFMT},file.driver=file,file.filename=${TEST_IMG}.mid,node-name=mid,backing=base" \ |
|||
-blockdev "driver=${IMGFMT},file.driver=file,file.filename=${TEST_IMG},node-name=top,backing=mid" \ |
|||
-blockdev "driver=${IMGFMT},file.driver=file,file.filename=${TEST_IMG}.ovl2,node-name=top2,backing=mid" |
|||
h=$QEMU_HANDLE |
|||
_send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" '^}' |
|||
|
|||
echo |
|||
echo === Perform commit job === |
|||
echo |
|||
|
|||
_send_qemu_cmd $h \ |
|||
"{ 'execute': 'block-commit', |
|||
'arguments': { 'job-id': 'commit0', |
|||
'device': 'top', |
|||
'base':'$TEST_IMG.base', |
|||
'top': '$TEST_IMG.mid' } }" \ |
|||
"BLOCK_JOB_COMPLETED" |
|||
_send_qemu_cmd $h "" "^}" |
|||
|
|||
echo |
|||
echo === Check that both top and top2 point to base now === |
|||
echo |
|||
|
|||
_send_qemu_cmd $h "{ 'execute': 'query-named-block-nodes' }" "^}" | |
|||
_filter_generated_node_ids |
|||
|
|||
_send_qemu_cmd $h "{ 'execute': 'quit' }" "^}" |
|||
wait=1 _cleanup_qemu |
|||
|
|||
_img_info |
|||
TEST_IMG="$TEST_IMG.ovl2" _img_info |
|||
|
|||
|
|||
echo |
|||
echo === Preparing and starting VM with -drive === |
|||
echo |
|||
|
|||
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" |
|||
TEST_IMG="${TEST_IMG}.ovl2" _make_test_img -b "${TEST_IMG}.mid" |
|||
TEST_IMG="${TEST_IMG}.ovl3" _make_test_img -b "${TEST_IMG}.ovl2" |
|||
|
|||
$QEMU_IO -c 'write -P 0x55 1M 64k' "${TEST_IMG}.mid" | _filter_qemu_io |
|||
|
|||
qemu_comm_method="qmp" |
|||
qmp_pretty="y" |
|||
|
|||
_launch_qemu \ |
|||
-drive "driver=${IMGFMT},file=${TEST_IMG},node-name=top,backing.node-name=mid" \ |
|||
-drive "driver=${IMGFMT},file=${TEST_IMG}.ovl3,node-name=top2,backing.backing=mid" |
|||
h=$QEMU_HANDLE |
|||
_send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" '^}' |
|||
|
|||
echo |
|||
echo === Perform commit job === |
|||
echo |
|||
|
|||
_send_qemu_cmd $h \ |
|||
"{ 'execute': 'block-commit', |
|||
'arguments': { 'job-id': 'commit0', |
|||
'device': 'top', |
|||
'base':'$TEST_IMG.base', |
|||
'top': '$TEST_IMG.mid' } }" \ |
|||
"BLOCK_JOB_COMPLETED" |
|||
_send_qemu_cmd $h "" "^}" |
|||
|
|||
echo |
|||
echo === Check that both top and top2 point to base now === |
|||
echo |
|||
|
|||
_send_qemu_cmd $h "{ 'execute': 'query-named-block-nodes' }" "^}" | |
|||
_filter_generated_node_ids |
|||
|
|||
_send_qemu_cmd $h "{ 'execute': 'quit' }" "^}" |
|||
wait=1 _cleanup_qemu |
|||
|
|||
_img_info |
|||
TEST_IMG="$TEST_IMG.ovl2" _img_info |
|||
|
|||
# success, all done |
|||
echo "*** done" |
|||
rm -f $seq.full |
|||
status=0 |
|||
@ -0,0 +1,827 @@ |
|||
QA output created by 191 |
|||
|
|||
=== Preparing and starting VM === |
|||
|
|||
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 |
|||
Formatting 'TEST_DIR/t.IMGFMT.ovl2', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.mid |
|||
wrote 65536/65536 bytes at offset 1048576 |
|||
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
|||
{ |
|||
"return": { |
|||
} |
|||
} |
|||
|
|||
=== Perform commit job === |
|||
|
|||
{ |
|||
"return": { |
|||
} |
|||
} |
|||
{ |
|||
"timestamp": { |
|||
"seconds": TIMESTAMP, |
|||
"microseconds": TIMESTAMP |
|||
}, |
|||
"event": "BLOCK_JOB_COMPLETED", |
|||
"data": { |
|||
"device": "commit0", |
|||
"len": 67108864, |
|||
"offset": 67108864, |
|||
"speed": 0, |
|||
"type": "commit" |
|||
} |
|||
} |
|||
|
|||
=== Check that both top and top2 point to base now === |
|||
|
|||
{ |
|||
"return": [ |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"backing-image": { |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2.base", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 397312, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"dirty-flag": false |
|||
}, |
|||
"backing-filename-format": "qcow2", |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2.ovl2", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 200704, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"full-backing-filename": "TEST_DIR/t.qcow2.base", |
|||
"backing-filename": "TEST_DIR/t.qcow2.base", |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": false, |
|||
"node-name": "top2", |
|||
"backing_file_depth": 1, |
|||
"drv": "qcow2", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"backing_file": "TEST_DIR/t.qcow2.base", |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2.ovl2", |
|||
"encryption_key_missing": false |
|||
}, |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"virtual-size": 197120, |
|||
"filename": "TEST_DIR/t.qcow2.ovl2", |
|||
"format": "file", |
|||
"actual-size": 200704, |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": false, |
|||
"node-name": "NODE_NAME", |
|||
"backing_file_depth": 0, |
|||
"drv": "file", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2.ovl2", |
|||
"encryption_key_missing": false |
|||
}, |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"backing-image": { |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2.base", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 397312, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"dirty-flag": false |
|||
}, |
|||
"backing-filename-format": "qcow2", |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 200704, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"full-backing-filename": "TEST_DIR/t.qcow2.base", |
|||
"backing-filename": "TEST_DIR/t.qcow2.base", |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": false, |
|||
"node-name": "top", |
|||
"backing_file_depth": 1, |
|||
"drv": "qcow2", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"backing_file": "TEST_DIR/t.qcow2.base", |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2", |
|||
"encryption_key_missing": false |
|||
}, |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"virtual-size": 197120, |
|||
"filename": "TEST_DIR/t.qcow2", |
|||
"format": "file", |
|||
"actual-size": 200704, |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": false, |
|||
"node-name": "NODE_NAME", |
|||
"backing_file_depth": 0, |
|||
"drv": "file", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2", |
|||
"encryption_key_missing": false |
|||
}, |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"backing-image": { |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2.base", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 397312, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"dirty-flag": false |
|||
}, |
|||
"backing-filename-format": "qcow2", |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2.mid", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 397312, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"full-backing-filename": "TEST_DIR/t.qcow2.base", |
|||
"backing-filename": "TEST_DIR/t.qcow2.base", |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": false, |
|||
"node-name": "mid", |
|||
"backing_file_depth": 1, |
|||
"drv": "qcow2", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"backing_file": "TEST_DIR/t.qcow2.base", |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2.mid", |
|||
"encryption_key_missing": false |
|||
}, |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"virtual-size": 393216, |
|||
"filename": "TEST_DIR/t.qcow2.mid", |
|||
"format": "file", |
|||
"actual-size": 397312, |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": false, |
|||
"node-name": "NODE_NAME", |
|||
"backing_file_depth": 0, |
|||
"drv": "file", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2.mid", |
|||
"encryption_key_missing": false |
|||
}, |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2.base", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 397312, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": false, |
|||
"node-name": "base", |
|||
"backing_file_depth": 0, |
|||
"drv": "qcow2", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2.base", |
|||
"encryption_key_missing": false |
|||
}, |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"virtual-size": 393216, |
|||
"filename": "TEST_DIR/t.qcow2.base", |
|||
"format": "file", |
|||
"actual-size": 397312, |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": false, |
|||
"node-name": "NODE_NAME", |
|||
"backing_file_depth": 0, |
|||
"drv": "file", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2.base", |
|||
"encryption_key_missing": false |
|||
} |
|||
] |
|||
} |
|||
{ |
|||
"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: TEST_DIR/t.IMGFMT.base |
|||
backing file format: IMGFMT |
|||
image: TEST_DIR/t.IMGFMT.ovl2 |
|||
file format: IMGFMT |
|||
virtual size: 64M (67108864 bytes) |
|||
cluster_size: 65536 |
|||
backing file: TEST_DIR/t.IMGFMT.base |
|||
backing file format: IMGFMT |
|||
|
|||
=== Preparing and starting VM with -drive === |
|||
|
|||
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 |
|||
Formatting 'TEST_DIR/t.IMGFMT.ovl2', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.mid |
|||
Formatting 'TEST_DIR/t.IMGFMT.ovl3', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.ovl2 |
|||
wrote 65536/65536 bytes at offset 1048576 |
|||
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
|||
{ |
|||
"return": { |
|||
} |
|||
} |
|||
|
|||
=== Perform commit job === |
|||
|
|||
{ |
|||
"return": { |
|||
} |
|||
} |
|||
{ |
|||
"timestamp": { |
|||
"seconds": TIMESTAMP, |
|||
"microseconds": TIMESTAMP |
|||
}, |
|||
"event": "BLOCK_JOB_COMPLETED", |
|||
"data": { |
|||
"device": "commit0", |
|||
"len": 67108864, |
|||
"offset": 67108864, |
|||
"speed": 0, |
|||
"type": "commit" |
|||
} |
|||
} |
|||
|
|||
=== Check that both top and top2 point to base now === |
|||
|
|||
{ |
|||
"return": [ |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"backing-image": { |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2.base", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 397312, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"dirty-flag": false |
|||
}, |
|||
"backing-filename-format": "qcow2", |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2.ovl2", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 200704, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"full-backing-filename": "TEST_DIR/t.qcow2.base", |
|||
"backing-filename": "TEST_DIR/t.qcow2.base", |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": true, |
|||
"node-name": "NODE_NAME", |
|||
"backing_file_depth": 1, |
|||
"drv": "qcow2", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"backing_file": "TEST_DIR/t.qcow2.base", |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2.ovl2", |
|||
"encryption_key_missing": false |
|||
}, |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"virtual-size": 197120, |
|||
"filename": "TEST_DIR/t.qcow2.ovl2", |
|||
"format": "file", |
|||
"actual-size": 200704, |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": true, |
|||
"node-name": "NODE_NAME", |
|||
"backing_file_depth": 0, |
|||
"drv": "file", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2.ovl2", |
|||
"encryption_key_missing": false |
|||
}, |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"backing-image": { |
|||
"backing-image": { |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2.base", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 397312, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"dirty-flag": false |
|||
}, |
|||
"backing-filename-format": "qcow2", |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2.ovl2", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 200704, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"full-backing-filename": "TEST_DIR/t.qcow2.base", |
|||
"backing-filename": "TEST_DIR/t.qcow2.base", |
|||
"dirty-flag": false |
|||
}, |
|||
"backing-filename-format": "qcow2", |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2.ovl3", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 200704, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"full-backing-filename": "TEST_DIR/t.qcow2.ovl2", |
|||
"backing-filename": "TEST_DIR/t.qcow2.ovl2", |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": false, |
|||
"node-name": "top2", |
|||
"backing_file_depth": 2, |
|||
"drv": "qcow2", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"backing_file": "TEST_DIR/t.qcow2.ovl2", |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2.ovl3", |
|||
"encryption_key_missing": false |
|||
}, |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"virtual-size": 197120, |
|||
"filename": "TEST_DIR/t.qcow2.ovl3", |
|||
"format": "file", |
|||
"actual-size": 200704, |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": false, |
|||
"node-name": "NODE_NAME", |
|||
"backing_file_depth": 0, |
|||
"drv": "file", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2.ovl3", |
|||
"encryption_key_missing": false |
|||
}, |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2.base", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 397312, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": true, |
|||
"node-name": "NODE_NAME", |
|||
"backing_file_depth": 0, |
|||
"drv": "qcow2", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2.base", |
|||
"encryption_key_missing": false |
|||
}, |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"virtual-size": 393216, |
|||
"filename": "TEST_DIR/t.qcow2.base", |
|||
"format": "file", |
|||
"actual-size": 397312, |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": true, |
|||
"node-name": "NODE_NAME", |
|||
"backing_file_depth": 0, |
|||
"drv": "file", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2.base", |
|||
"encryption_key_missing": false |
|||
}, |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"backing-image": { |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2.base", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 397312, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"dirty-flag": false |
|||
}, |
|||
"backing-filename-format": "qcow2", |
|||
"virtual-size": 67108864, |
|||
"filename": "TEST_DIR/t.qcow2", |
|||
"cluster-size": 65536, |
|||
"format": "qcow2", |
|||
"actual-size": 200704, |
|||
"format-specific": { |
|||
"type": "qcow2", |
|||
"data": { |
|||
"compat": "1.1", |
|||
"lazy-refcounts": false, |
|||
"refcount-bits": 16, |
|||
"corrupt": false |
|||
} |
|||
}, |
|||
"full-backing-filename": "TEST_DIR/t.qcow2.base", |
|||
"backing-filename": "TEST_DIR/t.qcow2.base", |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": false, |
|||
"node-name": "top", |
|||
"backing_file_depth": 1, |
|||
"drv": "qcow2", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"backing_file": "TEST_DIR/t.qcow2.base", |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2", |
|||
"encryption_key_missing": false |
|||
}, |
|||
{ |
|||
"iops_rd": 0, |
|||
"detect_zeroes": "off", |
|||
"image": { |
|||
"virtual-size": 197120, |
|||
"filename": "TEST_DIR/t.qcow2", |
|||
"format": "file", |
|||
"actual-size": 200704, |
|||
"dirty-flag": false |
|||
}, |
|||
"iops_wr": 0, |
|||
"ro": false, |
|||
"node-name": "NODE_NAME", |
|||
"backing_file_depth": 0, |
|||
"drv": "file", |
|||
"iops": 0, |
|||
"bps_wr": 0, |
|||
"write_threshold": 0, |
|||
"encrypted": false, |
|||
"bps": 0, |
|||
"bps_rd": 0, |
|||
"cache": { |
|||
"no-flush": false, |
|||
"direct": false, |
|||
"writeback": true |
|||
}, |
|||
"file": "TEST_DIR/t.qcow2", |
|||
"encryption_key_missing": false |
|||
} |
|||
] |
|||
} |
|||
{ |
|||
"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: TEST_DIR/t.IMGFMT.base |
|||
backing file format: IMGFMT |
|||
image: TEST_DIR/t.IMGFMT.ovl2 |
|||
file format: IMGFMT |
|||
virtual size: 64M (67108864 bytes) |
|||
cluster_size: 65536 |
|||
backing file: TEST_DIR/t.IMGFMT.base |
|||
backing file format: IMGFMT |
|||
*** done |
|||
@ -0,0 +1,109 @@ |
|||
#!/bin/bash |
|||
# |
|||
# Test case for copy-on-read into qcow2 |
|||
# |
|||
# 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=eblake@redhat.com |
|||
|
|||
seq="$(basename $0)" |
|||
echo "QA output created by $seq" |
|||
|
|||
here="$PWD" |
|||
status=1 # failure is the default! |
|||
|
|||
# get standard environment, filters and checks |
|||
. ./common.rc |
|||
. ./common.filter |
|||
|
|||
TEST_WRAP="$TEST_DIR/t.wrap.qcow2" |
|||
BLKDBG_CONF="$TEST_DIR/blkdebug.conf" |
|||
|
|||
# Sanity check: our use of blkdebug fails if $TEST_DIR contains spaces |
|||
# or other problems |
|||
case "$TEST_DIR" in |
|||
*[^-_a-zA-Z0-9/]*) |
|||
_notrun "Suspicious TEST_DIR='$TEST_DIR', cowardly refusing to run" ;; |
|||
esac |
|||
|
|||
_cleanup() |
|||
{ |
|||
_cleanup_test_img |
|||
rm -f "$BLKDBG_CONF" |
|||
} |
|||
trap "_cleanup; exit \$status" 0 1 2 3 15 |
|||
|
|||
# Test is supported for any backing file; but we force qcow2 for our wrapper. |
|||
_supported_fmt generic |
|||
_supported_proto generic |
|||
_supported_os Linux |
|||
# LUKS support may be possible, but it complicates things. |
|||
_unsupported_fmt luks |
|||
|
|||
echo |
|||
echo '=== Copy-on-read ===' |
|||
echo |
|||
|
|||
# Prep the images |
|||
_make_test_img 4G |
|||
$QEMU_IO -c "write -P 55 3G 1k" "$TEST_IMG" | _filter_qemu_io |
|||
IMGPROTO=file IMGFMT=qcow2 IMGOPTS= TEST_IMG_FILE="$TEST_WRAP" \ |
|||
_make_test_img -F "$IMGFMT" -b "$TEST_IMG" | _filter_img_create |
|||
$QEMU_IO -f qcow2 -c "write -z -u 1M 64k" "$TEST_WRAP" | _filter_qemu_io |
|||
|
|||
# Ensure that a read of two clusters, but where one is already allocated, |
|||
# does not re-write the allocated cluster |
|||
cat > "$BLKDBG_CONF" <<EOF |
|||
[inject-error] |
|||
event = "cor_write" |
|||
sector = "2048" |
|||
EOF |
|||
$QEMU_IO -c "open -C \ |
|||
-o driver=blkdebug,config=$BLKDBG_CONF,image.driver=qcow2 $TEST_WRAP" \ |
|||
-c "read -P 0 1M 128k" | _filter_qemu_io |
|||
|
|||
# Read the areas we want copied. A zero-length read should still be a |
|||
# no-op. The next read is under 2G, but aligned so that rounding to |
|||
# clusters copies more than 2G of zeroes. The final read will pick up |
|||
# the non-zero data in the same cluster. Since a 2G read may exhaust |
|||
# memory on some machines (particularly 32-bit), we skip the test if |
|||
# that fails due to memory pressure. |
|||
$QEMU_IO -f qcow2 -C -c "read 0 0" "$TEST_WRAP" | _filter_qemu_io |
|||
output=$($QEMU_IO -f qcow2 -C -c "read -P 0 1k $((2*1024*1024*1024 - 512))" \ |
|||
"$TEST_WRAP" 2>&1 | _filter_qemu_io) |
|||
case $output in |
|||
*allocate*) |
|||
_notrun "Insufficent memory to run test" ;; |
|||
*) printf '%s\n' "$output" ;; |
|||
esac |
|||
$QEMU_IO -f qcow2 -C -c "read -P 0 $((3*1024*1024*1024 + 1024)) 1k" \ |
|||
"$TEST_WRAP" | _filter_qemu_io |
|||
|
|||
# Copy-on-read is incompatible with read-only |
|||
$QEMU_IO -f qcow2 -C -r "$TEST_WRAP" 2>&1 | _filter_testdir |
|||
|
|||
# Break the backing chain, and show that images are identical, and that |
|||
# we properly copied over explicit zeros. |
|||
$QEMU_IMG rebase -u -b "" -f qcow2 "$TEST_WRAP" |
|||
$QEMU_IO -f qcow2 -c map "$TEST_WRAP" |
|||
_check_test_img |
|||
$QEMU_IMG compare -f $IMGFMT -F qcow2 "$TEST_IMG" "$TEST_WRAP" |
|||
|
|||
# success, all done |
|||
echo '*** done' |
|||
status=0 |
|||
@ -0,0 +1,26 @@ |
|||
QA output created by 197 |
|||
|
|||
=== Copy-on-read === |
|||
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4294967296 |
|||
wrote 1024/1024 bytes at offset 3221225472 |
|||
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
|||
Formatting 'TEST_DIR/t.wrap.IMGFMT', fmt=IMGFMT size=4294967296 backing_file=TEST_DIR/t.IMGFMT backing_fmt=IMGFMT |
|||
wrote 65536/65536 bytes at offset 1048576 |
|||
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
|||
read 131072/131072 bytes at offset 1048576 |
|||
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
|||
read 0/0 bytes at offset 0 |
|||
0 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
|||
read 2147483136/2147483136 bytes at offset 1024 |
|||
2 GiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
|||
read 1024/1024 bytes at offset 3221226496 |
|||
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
|||
can't open device TEST_DIR/t.wrap.qcow2: Can't use copy-on-read on read-only device |
|||
2 GiB (0x80010000) bytes allocated at offset 0 bytes (0x0) |
|||
1023.938 MiB (0x3fff0000) bytes not allocated at offset 2 GiB (0x80010000) |
|||
64 KiB (0x10000) bytes allocated at offset 3 GiB (0xc0000000) |
|||
1023.938 MiB (0x3fff0000) bytes not allocated at offset 3 GiB (0xc0010000) |
|||
No errors were found on the image. |
|||
Images are identical. |
|||
*** done |
|||
@ -1,459 +0,0 @@ |
|||
#!/bin/bash |
|||
# |
|||
# Copyright (C) 2009 Red Hat, Inc. |
|||
# Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. |
|||
# |
|||
# 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. |
|||
# |
|||
# This program is distributed in the hope that it would 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/>. |
|||
# |
|||
# |
|||
# common procedures for QA scripts |
|||
# |
|||
|
|||
_setenvironment() |
|||
{ |
|||
MSGVERB="text:action" |
|||
export MSGVERB |
|||
} |
|||
|
|||
rm -f "$OUTPUT_DIR/$iam.out" |
|||
_setenvironment |
|||
|
|||
check=${check-true} |
|||
|
|||
diff="diff -u" |
|||
verbose=false |
|||
debug=false |
|||
group=false |
|||
xgroup=false |
|||
imgopts=false |
|||
showme=false |
|||
sortme=false |
|||
expunge=true |
|||
have_test_arg=false |
|||
randomize=false |
|||
cachemode=false |
|||
rm -f $tmp.list $tmp.tmp $tmp.sed |
|||
|
|||
export IMGFMT=raw |
|||
export IMGFMT_GENERIC=true |
|||
export IMGPROTO=file |
|||
export IMGOPTS="" |
|||
export CACHEMODE="writeback" |
|||
export QEMU_IO_OPTIONS="" |
|||
export QEMU_IO_OPTIONS_NO_FMT="" |
|||
export CACHEMODE_IS_DEFAULT=true |
|||
export QEMU_OPTIONS="-nodefaults -machine accel=qtest" |
|||
export VALGRIND_QEMU= |
|||
export IMGKEYSECRET= |
|||
export IMGOPTSSYNTAX=false |
|||
|
|||
for r |
|||
do |
|||
|
|||
if $group |
|||
then |
|||
# arg after -g |
|||
group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{ |
|||
s/ .*//p |
|||
}'` |
|||
if [ -z "$group_list" ] |
|||
then |
|||
echo "Group \"$r\" is empty or not defined?" |
|||
exit 1 |
|||
fi |
|||
[ ! -s $tmp.list ] && touch $tmp.list |
|||
for t in $group_list |
|||
do |
|||
if grep -s "^$t\$" $tmp.list >/dev/null |
|||
then |
|||
: |
|||
else |
|||
echo "$t" >>$tmp.list |
|||
fi |
|||
done |
|||
group=false |
|||
continue |
|||
|
|||
elif $xgroup |
|||
then |
|||
# arg after -x |
|||
# Populate $tmp.list with all tests |
|||
awk '/^[0-9]{3,}/ {print $1}' "${source_iotests}/group" > $tmp.list 2>/dev/null |
|||
group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{ |
|||
s/ .*//p |
|||
}'` |
|||
if [ -z "$group_list" ] |
|||
then |
|||
echo "Group \"$r\" is empty or not defined?" |
|||
exit 1 |
|||
fi |
|||
numsed=0 |
|||
rm -f $tmp.sed |
|||
for t in $group_list |
|||
do |
|||
if [ $numsed -gt 100 ] |
|||
then |
|||
sed -f $tmp.sed <$tmp.list >$tmp.tmp |
|||
mv $tmp.tmp $tmp.list |
|||
numsed=0 |
|||
rm -f $tmp.sed |
|||
fi |
|||
echo "/^$t\$/d" >>$tmp.sed |
|||
numsed=`expr $numsed + 1` |
|||
done |
|||
sed -f $tmp.sed <$tmp.list >$tmp.tmp |
|||
mv $tmp.tmp $tmp.list |
|||
xgroup=false |
|||
continue |
|||
|
|||
elif $imgopts |
|||
then |
|||
IMGOPTS="$r" |
|||
imgopts=false |
|||
continue |
|||
elif $cachemode |
|||
then |
|||
CACHEMODE="$r" |
|||
CACHEMODE_IS_DEFAULT=false |
|||
cachemode=false |
|||
continue |
|||
fi |
|||
|
|||
xpand=true |
|||
case "$r" |
|||
in |
|||
|
|||
-\? | -h | --help) # usage |
|||
echo "Usage: $0 [options] [testlist]"' |
|||
|
|||
common options |
|||
-v verbose |
|||
-d debug |
|||
|
|||
image format options |
|||
-raw test raw (default) |
|||
-bochs test bochs |
|||
-cloop test cloop |
|||
-parallels test parallels |
|||
-qcow test qcow |
|||
-qcow2 test qcow2 |
|||
-qed test qed |
|||
-vdi test vdi |
|||
-vpc test vpc |
|||
-vhdx test vhdx |
|||
-vmdk test vmdk |
|||
-luks test luks |
|||
|
|||
image protocol options |
|||
-file test file (default) |
|||
-rbd test rbd |
|||
-sheepdog test sheepdog |
|||
-nbd test nbd |
|||
-ssh test ssh |
|||
-nfs test nfs |
|||
-vxhs test vxhs |
|||
|
|||
other options |
|||
-xdiff graphical mode diff |
|||
-nocache use O_DIRECT on backing file |
|||
-misalign misalign memory allocations |
|||
-n show me, do not run tests |
|||
-o options -o options to pass to qemu-img create/convert |
|||
-T output timestamps |
|||
-r randomize test order |
|||
-c mode cache mode |
|||
|
|||
testlist options |
|||
-g group[,group...] include tests from these groups |
|||
-x group[,group...] exclude tests from these groups |
|||
NNN include test NNN |
|||
NNN-NNN include test range (eg. 012-021) |
|||
' |
|||
exit 0 |
|||
;; |
|||
|
|||
-raw) |
|||
IMGFMT=raw |
|||
xpand=false |
|||
;; |
|||
|
|||
-bochs) |
|||
IMGFMT=bochs |
|||
IMGFMT_GENERIC=false |
|||
xpand=false |
|||
;; |
|||
|
|||
-cloop) |
|||
IMGFMT=cloop |
|||
IMGFMT_GENERIC=false |
|||
xpand=false |
|||
;; |
|||
|
|||
-parallels) |
|||
IMGFMT=parallels |
|||
IMGFMT_GENERIC=false |
|||
xpand=false |
|||
;; |
|||
|
|||
-qcow) |
|||
IMGFMT=qcow |
|||
xpand=false |
|||
;; |
|||
|
|||
-qcow2) |
|||
IMGFMT=qcow2 |
|||
xpand=false |
|||
;; |
|||
|
|||
-luks) |
|||
IMGOPTSSYNTAX=true |
|||
IMGFMT=luks |
|||
IMGKEYSECRET=123456 |
|||
xpand=false |
|||
;; |
|||
|
|||
-qed) |
|||
IMGFMT=qed |
|||
xpand=false |
|||
;; |
|||
|
|||
-vdi) |
|||
IMGFMT=vdi |
|||
xpand=false |
|||
;; |
|||
|
|||
-vmdk) |
|||
IMGFMT=vmdk |
|||
xpand=false |
|||
;; |
|||
|
|||
-vpc) |
|||
IMGFMT=vpc |
|||
xpand=false |
|||
;; |
|||
|
|||
-vhdx) |
|||
IMGFMT=vhdx |
|||
xpand=false |
|||
;; |
|||
|
|||
-file) |
|||
IMGPROTO=file |
|||
xpand=false |
|||
;; |
|||
|
|||
-rbd) |
|||
IMGPROTO=rbd |
|||
xpand=false |
|||
;; |
|||
|
|||
-sheepdog) |
|||
IMGPROTO=sheepdog |
|||
xpand=false |
|||
;; |
|||
|
|||
-nbd) |
|||
IMGPROTO=nbd |
|||
xpand=false |
|||
;; |
|||
|
|||
-vxhs) |
|||
IMGPROTO=vxhs |
|||
xpand=false |
|||
;; |
|||
|
|||
-ssh) |
|||
IMGPROTO=ssh |
|||
xpand=false |
|||
;; |
|||
|
|||
-nfs) |
|||
IMGPROTO=nfs |
|||
xpand=false |
|||
;; |
|||
|
|||
-nocache) |
|||
CACHEMODE="none" |
|||
CACHEMODE_IS_DEFAULT=false |
|||
xpand=false |
|||
;; |
|||
|
|||
-misalign) |
|||
QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --misalign" |
|||
xpand=false |
|||
;; |
|||
|
|||
-valgrind) |
|||
VALGRIND_QEMU='y' |
|||
xpand=false |
|||
;; |
|||
|
|||
-g) # -g group ... pick from group file |
|||
group=true |
|||
xpand=false |
|||
;; |
|||
|
|||
-xdiff) # graphical diff mode |
|||
xpand=false |
|||
|
|||
if [ ! -z "$DISPLAY" ] |
|||
then |
|||
command -v xdiff >/dev/null 2>&1 && diff=xdiff |
|||
command -v gdiff >/dev/null 2>&1 && diff=gdiff |
|||
command -v tkdiff >/dev/null 2>&1 && diff=tkdiff |
|||
command -v xxdiff >/dev/null 2>&1 && diff=xxdiff |
|||
fi |
|||
;; |
|||
|
|||
-n) # show me, don't do it |
|||
showme=true |
|||
xpand=false |
|||
;; |
|||
-o) |
|||
imgopts=true |
|||
xpand=false |
|||
;; |
|||
-c) |
|||
cachemode=true |
|||
xpand=false |
|||
;; |
|||
-r) # randomize test order |
|||
randomize=true |
|||
xpand=false |
|||
;; |
|||
|
|||
-T) # turn on timestamp output |
|||
timestamp=true |
|||
xpand=false |
|||
;; |
|||
|
|||
-v) |
|||
verbose=true |
|||
xpand=false |
|||
;; |
|||
-d) |
|||
debug=true |
|||
xpand=false |
|||
;; |
|||
-x) # -x group ... exclude from group file |
|||
xgroup=true |
|||
xpand=false |
|||
;; |
|||
'[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]') |
|||
echo "No tests?" |
|||
status=1 |
|||
exit $status |
|||
;; |
|||
|
|||
[0-9]*-[0-9]*) |
|||
eval `echo $r | sed -e 's/^/start=/' -e 's/-/ end=/'` |
|||
;; |
|||
|
|||
[0-9]*-) |
|||
eval `echo $r | sed -e 's/^/start=/' -e 's/-//'` |
|||
end=`echo [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] | sed -e 's/\[0-9]//g' -e 's/ *$//' -e 's/.* //'` |
|||
if [ -z "$end" ] |
|||
then |
|||
echo "No tests in range \"$r\"?" |
|||
status=1 |
|||
exit $status |
|||
fi |
|||
;; |
|||
|
|||
*) |
|||
start=$r |
|||
end=$r |
|||
;; |
|||
|
|||
esac |
|||
|
|||
# get rid of leading 0s as can be interpreted as octal |
|||
start=`echo $start | sed 's/^0*//'` |
|||
end=`echo $end | sed 's/^0*//'` |
|||
|
|||
if $xpand |
|||
then |
|||
have_test_arg=true |
|||
$AWK_PROG </dev/null ' |
|||
BEGIN { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \ |
|||
| while read id |
|||
do |
|||
if grep -s "^$id " "$source_iotests/group" >/dev/null |
|||
then |
|||
# in group file ... OK |
|||
echo $id >>$tmp.list |
|||
else |
|||
if [ -f expunged ] && $expunge && egrep "^$id([ ]|\$)" expunged >/dev/null |
|||
then |
|||
# expunged ... will be reported, but not run, later |
|||
echo $id >>$tmp.list |
|||
else |
|||
# oops |
|||
if [ "$start" == "$end" -a "$id" == "$end" ] |
|||
then |
|||
echo "$id - unknown test" |
|||
exit 1 |
|||
else |
|||
echo "$id - unknown test, ignored" |
|||
fi |
|||
fi |
|||
fi |
|||
done || exit 1 |
|||
fi |
|||
|
|||
done |
|||
|
|||
# Set qemu-io cache mode with $CACHEMODE we have |
|||
QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --cache $CACHEMODE" |
|||
|
|||
QEMU_IO_OPTIONS_NO_FMT="$QEMU_IO_OPTIONS" |
|||
if [ "$IMGOPTSSYNTAX" != "true" ]; then |
|||
QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS -f $IMGFMT" |
|||
fi |
|||
|
|||
# Set default options for qemu-img create -o if they were not specified |
|||
_set_default_imgopts |
|||
|
|||
if [ -s $tmp.list ] |
|||
then |
|||
# found some valid test numbers ... this is good |
|||
: |
|||
else |
|||
if $have_test_arg |
|||
then |
|||
# had test numbers, but none in group file ... do nothing |
|||
touch $tmp.list |
|||
else |
|||
# no test numbers, do everything from group file |
|||
sed -n -e '/^[0-9][0-9][0-9]*/s/[ ].*//p' <"$source_iotests/group" >$tmp.list |
|||
fi |
|||
fi |
|||
|
|||
# should be sort -n, but this did not work for Linux when this |
|||
# was ported from IRIX |
|||
# |
|||
list=`sort $tmp.list` |
|||
rm -f $tmp.list $tmp.tmp $tmp.sed |
|||
|
|||
if $randomize |
|||
then |
|||
list=`echo $list | awk -f randomize.awk` |
|||
fi |
|||
|
|||
[ "$QEMU" = "" ] && _fatal "qemu not found" |
|||
[ "$QEMU_IMG" = "" ] && _fatal "qemu-img not found" |
|||
[ "$QEMU_IO" = "" ] && _fatal "qemu-io not found" |
|||
|
|||
if [ "$IMGPROTO" = "nbd" ] ; then |
|||
[ "$QEMU_NBD" = "" ] && _fatal "qemu-nbd not found" |
|||
fi |
|||
Loading…
Reference in new issue