diff --git a/tests/qemu-iotests/206 b/tests/qemu-iotests/206 index 0a18b2b19a..b8cf2e7dca 100755 --- a/tests/qemu-iotests/206 +++ b/tests/qemu-iotests/206 @@ -1,9 +1,11 @@ -#!/bin/bash +#!/usr/bin/env python # # Test qcow2 and file image creation # # Copyright (C) 2018 Red Hat, Inc. # +# Creator/Owner: Kevin Wolf +# # 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 @@ -18,419 +20,263 @@ # along with this program. If not, see . # -# creator -owner=kwolf@redhat.com +import iotests +from iotests import imgfmt -seq=`basename $0` -echo "QA output created by $seq" +iotests.verify_image_format(supported_fmts=['qcow2']) -here=`pwd` -status=1 # failure is the default! +def blockdev_create(vm, options): + result = vm.qmp_log('x-blockdev-create', job_id='job0', options=options) -# get standard environment, filters and checks -. ./common.rc -. ./common.filter + if 'return' in result: + assert result['return'] == {} + vm.run_job('job0') + iotests.log("") -_supported_fmt qcow2 -_supported_proto file -_supported_os Linux +with iotests.FilePath('t.qcow2') as disk_path, \ + iotests.FilePath('t.qcow2.base') as backing_path, \ + iotests.VM() as vm: -function do_run_qemu() -{ - echo Testing: "$@" - $QEMU -nographic -qmp stdio -serial none "$@" - echo -} + vm.add_object('secret,id=keysec0,data=foo') -function run_qemu() -{ - do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \ - | _filter_qemu | _filter_imgfmt \ - | _filter_actual_image_size -} + # + # Successful image creation (defaults) + # + iotests.log("=== Successful image creation (defaults) ===") + iotests.log("") -echo -echo "=== Successful image creation (defaults) ===" -echo + size = 128 * 1024 * 1024 -size=$((128 * 1024 * 1024)) + vm.launch() + blockdev_create(vm, { 'driver': 'file', + 'filename': disk_path, + 'size': 0 }) -run_qemu <