Re: [Qemu-block] [PATCH 12/14] qemu-iotests: Rewrite 212 for blockdev-create job

2018-05-29 Thread Max Reitz
On 2018-05-25 18:33, Kevin Wolf wrote:
> This rewrites the test case 212 to work with the new x-blockdev-create
> job rather than the old synchronous version of the command.
> 
> All of the test cases stay the same as before, but in order to be able
> to implement proper job handling, the test case is rewritten in Python.
> 
> Signed-off-by: Kevin Wolf 
> ---
>  tests/qemu-iotests/212 | 483 
> +
>  tests/qemu-iotests/212.out | 181 ++---
>  tests/qemu-iotests/group   |   2 +-
>  3 files changed, 290 insertions(+), 376 deletions(-)
> 
> diff --git a/tests/qemu-iotests/212 b/tests/qemu-iotests/212
> index e5a1ba77ce..5ac4947b82 100755
> --- a/tests/qemu-iotests/212
> +++ b/tests/qemu-iotests/212

[...]

> +import iotests
> +from iotests import imgfmt
> +
> +iotests.verify_image_format(supported_fmts=['parallels'])
> +iotests.verify_protocol(supported=['file'])
> +
> +def blockdev_create(vm, options):
> +result = vm.qmp_log('x-blockdev-create', job_id='job0', options=options)
> +
> +if 'return' in result:
> +assert result['return'] == {}
> +vm.run_job('job0')
> +iotests.log("")
> +
> +with iotests.FilePath('t.vdi') as disk_path, \

't.vdi', are you sure about that? ;-)

(You thought I wouldn't read the boiler plate anymore, didn't you?  Ha!)

With that fixed:

Reviewed-by: Max Reitz 



signature.asc
Description: OpenPGP digital signature


[Qemu-block] [PATCH 12/14] qemu-iotests: Rewrite 212 for blockdev-create job

2018-05-25 Thread Kevin Wolf
This rewrites the test case 212 to work with the new x-blockdev-create
job rather than the old synchronous version of the command.

All of the test cases stay the same as before, but in order to be able
to implement proper job handling, the test case is rewritten in Python.

Signed-off-by: Kevin Wolf 
---
 tests/qemu-iotests/212 | 483 +
 tests/qemu-iotests/212.out | 181 ++---
 tests/qemu-iotests/group   |   2 +-
 3 files changed, 290 insertions(+), 376 deletions(-)

diff --git a/tests/qemu-iotests/212 b/tests/qemu-iotests/212
index e5a1ba77ce..5ac4947b82 100755
--- a/tests/qemu-iotests/212
+++ b/tests/qemu-iotests/212
@@ -1,9 +1,11 @@
-#!/bin/bash
+#!/usr/bin/env python
 #
 # Test parallels 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,309 +20,176 @@
 # along with this program.  If not, see .
 #
 
-# creator
-owner=kw...@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
-
-_supported_fmt parallels
-_supported_proto file
-_supported_os Linux
-
-function do_run_qemu()
-{
-echo Testing: "$@"
-$QEMU -nographic -qmp stdio -serial none "$@"
-echo
-}
-
-function run_qemu()
-{
-do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
-  | _filter_qemu | _filter_imgfmt \
-  | _filter_actual_image_size
-}
-
-echo
-echo "=== Successful image creation (defaults) ==="
-echo
-
-size=$((128 * 1024 * 1024))
-
-run_qemu <