提交 bd91ecbf 编写于 作者: K Kevin Wolf 提交者: Stefan Hajnoczi

qemu-iotests: Try creating huge qcow2 image

It's supposed to fail gracefully instead of segfaulting.
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 c93331c9
#!/bin/bash
#
# Test huge qcow2 images
#
# Copyright (C) 2013 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`
tmp=/tmp/$$
status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_supported_fmt qcow2
_supported_proto generic
_supported_os Linux
echo
echo "creating too large image (1 EB)"
_make_test_img $((1024*1024))T
echo
echo "creating too large image (1 EB) using qcow2.py"
_make_test_img 4G
./qcow2.py $TEST_IMG set-header size $((1024 ** 6))
_check_test_img
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 054
creating too large image (1 EB)
qemu-img: The image size is too large for file format 'qcow2'
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1152921504606846976
creating too large image (1 EB) using qcow2.py
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4294967296
qemu-img: Could not open 'TEST_DIR/t.qcow2': File too large
*** done
......@@ -167,7 +167,7 @@ _cleanup_test_img()
_check_test_img()
{
$QEMU_IMG check "$@" -f $IMGFMT $TEST_IMG 2>&1 | \
$QEMU_IMG check "$@" -f $IMGFMT $TEST_IMG 2>&1 | _filter_testdir | \
sed -e '/allocated.*fragmented.*compressed clusters/d' \
-e 's/qemu-img: This image format does not support checks/No errors were found on the image./' \
-e '/Image end offset: [0-9]\+/d'
......
......@@ -60,3 +60,4 @@
#051 rw auto
052 rw auto backing
053 rw auto
054 rw auto
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册