qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 4/7] scripts: refactor the VM class in iotests fo


From: Max Reitz
Subject: Re: [Qemu-devel] [PULL 4/7] scripts: refactor the VM class in iotests for reuse
Date: Tue, 26 Jul 2016 01:34:55 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 22.07.2016 10:00, Amit Shah wrote:
> From: "Daniel P. Berrange" <address@hidden>
> 
> The iotests module has a python class for controlling QEMU
> processes. Pull the generic functionality out of this file
> and create a scripts/qemu.py module containing a QEMUMachine
> class. Put the QTest integration support into a subclass
> QEMUQtestMachine.
> 
> Signed-off-by: Daniel P. Berrange <address@hidden>
> Message-Id: <address@hidden>
> Signed-off-by: Amit Shah <address@hidden>
> ---
>  scripts/qemu.py               | 202 
> ++++++++++++++++++++++++++++++++++++++++++
>  scripts/qtest.py              |  34 +++++++
>  tests/qemu-iotests/iotests.py | 135 +---------------------------
>  3 files changed, 240 insertions(+), 131 deletions(-)
>  create mode 100644 scripts/qemu.py

[...]

> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 1687c33..14427f4 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py

[...]

> @@ -148,27 +145,12 @@ def event_match(event, match=None):
>  
>      return True
>  
> -class VM(object):
> +class VM(qtest.QEMUMachine):

Should this not be qtest.QEMUQtestMachine?

With QEMUMachine, I get failures like this when attempting to run tests
for the wrong format (e.g. ./check -raw 30):

Traceback (most recent call last):
  File "030", line 23, in <module>
    import iotests
  File "./tests/qemu-iotests/iotests.py", line 148, in <module>
    class VM(qtest.QEMUMachine):
AttributeError: 'module' object has no attribute 'QEMUMachine

Max

>      '''A QEMU VM'''
>  
>      def __init__(self):
> -        self._monitor_path = os.path.join(test_dir, 'qemu-mon.%d' % 
> os.getpid())
> -        self._qemu_log_path = os.path.join(test_dir, 'qemu-log.%d' % 
> os.getpid())
> -        self._qtest_path = os.path.join(test_dir, 'qemu-qtest.%d' % 
> os.getpid())
> -        self._args = qemu_args + ['-chardev',
> -                     'socket,id=mon,path=' + self._monitor_path,
> -                     '-mon', 'chardev=mon,mode=control',
> -                     '-qtest', 'unix:path=' + self._qtest_path,
> -                     '-machine', 'accel=qtest',
> -                     '-display', 'none', '-vga', 'none']
> +        super(self, VM).__init__(qemu_prog, qemu_opts, test_dir)
>          self._num_drives = 0
> -        self._events = []
> -
> -    # This can be used to add an unused monitor instance.
> -    def add_monitor_telnet(self, ip, port):
> -        args = 'tcp:%s:%d,server,nowait,telnet' % (ip, port)
> -        self._args.append('-monitor')
> -        self._args.append(args)
>  
>      def add_drive_raw(self, opts):
>          self._args.append('-drive')

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]