提交 4db9c980 编写于 作者: F Fam Zheng 提交者: Kevin Wolf

qemu-iotests: add test for backing file overriding

Test that backing.file.filename option can be parsed and override the
backing file from image (backing file reflected with "info block").
Signed-off-by: NFam Zheng <famz@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 dbecebdd
...@@ -45,7 +45,14 @@ _supported_os Linux ...@@ -45,7 +45,14 @@ _supported_os Linux
function do_run_qemu() function do_run_qemu()
{ {
echo Testing: "$@" echo Testing: "$@"
echo quit | $QEMU -nographic -monitor stdio -serial none "$@" (
if ! test -t 0; then
while read cmd; do
echo $cmd
done
fi
echo quit
) | $QEMU -nographic -monitor stdio -serial none "$@"
echo echo
} }
...@@ -57,6 +64,9 @@ function run_qemu() ...@@ -57,6 +64,9 @@ function run_qemu()
size=128M size=128M
_make_test_img $size _make_test_img $size
cp $TEST_IMG $TEST_IMG.orig
mv $TEST_IMG $TEST_IMG.base
_make_test_img -b $TEST_IMG.base $size
echo echo
echo === Unknown option === echo === Unknown option ===
...@@ -67,6 +77,11 @@ run_qemu -drive file=$TEST_IMG,format=qcow2,unknown_opt=on ...@@ -67,6 +77,11 @@ run_qemu -drive file=$TEST_IMG,format=qcow2,unknown_opt=on
run_qemu -drive file=$TEST_IMG,format=qcow2,unknown_opt=1234 run_qemu -drive file=$TEST_IMG,format=qcow2,unknown_opt=1234
run_qemu -drive file=$TEST_IMG,format=qcow2,unknown_opt=foo run_qemu -drive file=$TEST_IMG,format=qcow2,unknown_opt=foo
echo
echo === Overriding backing file ===
echo
echo "info block" | run_qemu -drive file=$TEST_IMG,driver=qcow2,backing.file.filename=$TEST_IMG.orig -nodefaults
echo echo
echo === Enable and disable lazy refcounting on the command line, plus some invalid values === echo === Enable and disable lazy refcounting on the command line, plus some invalid values ===
......
QA output created by 051 QA output created by 051
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file='TEST_DIR/t.IMGFMT.base'
=== Unknown option === === Unknown option ===
...@@ -16,6 +17,16 @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=foo ...@@ -16,6 +17,16 @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=foo
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=foo: could not open disk image TEST_DIR/t.qcow2: Block format 'qcow2' used by device 'ide0-hd0' doesn't support the option 'unknown_opt' QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=foo: could not open disk image TEST_DIR/t.qcow2: Block format 'qcow2' used by device 'ide0-hd0' doesn't support the option 'unknown_opt'
=== Overriding backing file ===
Testing: -drive file=TEST_DIR/t.qcow2,driver=qcow2,backing.file.filename=TEST_DIR/t.qcow2.orig -nodefaults
QEMU X.Y.Z monitor - type 'help' for more information
(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo block
ide0-hd0: TEST_DIR/t.qcow2 (qcow2)
Backing file: TEST_DIR/t.qcow2.orig (chain depth: 1)
[not inserted](qemu) qququiquit
=== Enable and disable lazy refcounting on the command line, plus some invalid values === === Enable and disable lazy refcounting on the command line, plus some invalid values ===
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册