* [Qemu-devel] [PULL 1/7] Acceptance tests: drop usage of ":avocado: enable"
2019-02-22 19:41 [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22 Cleber Rosa
@ 2019-02-22 19:41 ` Cleber Rosa
2019-02-22 19:41 ` [Qemu-devel] [PULL 2/7] Introduce a Python module structure Cleber Rosa
` (7 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Cleber Rosa @ 2019-02-22 19:41 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Eduardo Habkost, Fam Zheng, qemu-block, Kevin Wolf, Max Reitz,
Philippe Mathieu-Daudé,
Alex Bennée, Cleber Rosa, Markus Armbruster, Caio Carrara,
Wainer dos Santos Moschetta
The Avocado test runner attemps to find its INSTRUMENTED (that is,
Python based tests) in a manner that is as safe as possible to the
user. Different from plain Python unittest, it won't load or
execute test code on an operation such as:
$ avocado list tests/acceptance/
Before version 68.0, the logic implemented to identify INSTRUMENTED
tests would require either the ":avocado: enable" or ":avocado:
recursive" statement as a flag for tests that would not inherit
directly from "avocado.Test". This is not necessary anymore,
and because of that the boiler plate statements can now be removed.
Reference: https://avocado-framework.readthedocs.io/en/68.0/release_notes/68_0.html#users-test-writers
Signed-off-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Caio Carrara <ccarrara@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20190218173723.26120-1-crosa@redhat.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
docs/devel/testing.rst | 1 -
tests/acceptance/boot_linux_console.py | 1 -
tests/acceptance/linux_initrd.py | 1 -
tests/acceptance/version.py | 1 -
tests/acceptance/virtio_version.py | 1 -
tests/acceptance/vnc.py | 1 -
tests/requirements.txt | 2 +-
7 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
index 135743a2bf..3ce171829d 100644
--- a/docs/devel/testing.rst
+++ b/docs/devel/testing.rst
@@ -600,7 +600,6 @@ the ``avocado_qemu.Test`` class. Here's a simple usage example:
class Version(Test):
"""
- :avocado: enable
:avocado: tags=quick
"""
def test_qmp_human_info_version(self):
diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 98324f7591..beeb1e59e8 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -18,7 +18,6 @@ class BootLinuxConsole(Test):
Boots a x86_64 Linux kernel and checks that the console is operational
and the kernel command line is properly passed from QEMU to the kernel
- :avocado: enable
:avocado: tags=x86_64
"""
diff --git a/tests/acceptance/linux_initrd.py b/tests/acceptance/linux_initrd.py
index 737355c2ef..5a15fc4347 100644
--- a/tests/acceptance/linux_initrd.py
+++ b/tests/acceptance/linux_initrd.py
@@ -18,7 +18,6 @@ class LinuxInitrd(Test):
"""
Checks QEMU evaluates correctly the initrd file passed as -initrd option.
- :avocado: enable
:avocado: tags=x86_64
"""
diff --git a/tests/acceptance/version.py b/tests/acceptance/version.py
index 13b0a7440d..67c2192c93 100644
--- a/tests/acceptance/version.py
+++ b/tests/acceptance/version.py
@@ -14,7 +14,6 @@ from avocado_qemu import Test
class Version(Test):
"""
- :avocado: enable
:avocado: tags=quick
"""
def test_qmp_human_info_version(self):
diff --git a/tests/acceptance/virtio_version.py b/tests/acceptance/virtio_version.py
index ce990250d8..464d75aa4e 100644
--- a/tests/acceptance/virtio_version.py
+++ b/tests/acceptance/virtio_version.py
@@ -61,7 +61,6 @@ class VirtioVersionCheck(Test):
same device tree created by `disable-modern` and
`disable-legacy`.
- :avocado: enable
:avocado: tags=x86_64
"""
diff --git a/tests/acceptance/vnc.py b/tests/acceptance/vnc.py
index b1ef9d71b1..064ceabcc1 100644
--- a/tests/acceptance/vnc.py
+++ b/tests/acceptance/vnc.py
@@ -13,7 +13,6 @@ from avocado_qemu import Test
class Vnc(Test):
"""
- :avocado: enable
:avocado: tags=vnc,quick
"""
def test_no_vnc(self):
diff --git a/tests/requirements.txt b/tests/requirements.txt
index 64c6e27a94..002ded6a22 100644
--- a/tests/requirements.txt
+++ b/tests/requirements.txt
@@ -1,4 +1,4 @@
# Add Python module requirements, one per line, to be installed
# in the tests/venv Python virtual environment. For more info,
# refer to: https://pip.pypa.io/en/stable/user_guide/#id1
-avocado-framework==65.0
+avocado-framework==68.0
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PULL 2/7] Introduce a Python module structure
2019-02-22 19:41 [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22 Cleber Rosa
2019-02-22 19:41 ` [Qemu-devel] [PULL 1/7] Acceptance tests: drop usage of ":avocado: enable" Cleber Rosa
@ 2019-02-22 19:41 ` Cleber Rosa
2019-02-22 19:41 ` [Qemu-devel] [PULL 3/7] scripts/qemu.py: log QEMU launch command line Cleber Rosa
` (6 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Cleber Rosa @ 2019-02-22 19:41 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Eduardo Habkost, Fam Zheng, qemu-block, Kevin Wolf, Max Reitz,
Philippe Mathieu-Daudé,
Alex Bennée, Cleber Rosa, Markus Armbruster, Caio Carrara,
Stefan Hajnoczi
This is a simple move of Python code that wraps common QEMU
functionality, and are used by a number of different tests
and scripts.
By treating that code as a real Python module, we can more easily:
* reuse code
* have a proper place for the module's own unittests
* apply a more consistent style
* generate documentation
Signed-off-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Caio Carrara <ccarrara@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20190206162901.19082-2-crosa@redhat.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
configure | 1 +
scripts/qemu.py => python/qemu/__init__.py | 11 ++++++-----
{scripts/qmp => python/qemu}/qmp.py | 0
{scripts => python/qemu}/qtest.py | 5 +++--
scripts/device-crash-test | 2 ++
scripts/qmp/__init__.py | 0
scripts/qmp/qemu-ga-client | 5 ++++-
scripts/qmp/qmp-shell | 4 +++-
scripts/render_block_graph.py | 2 ++
tests/acceptance/avocado_qemu/__init__.py | 5 ++---
tests/acceptance/virtio_version.py | 2 +-
tests/migration/guestperf/engine.py | 7 ++++---
tests/qemu-iotests/235 | 2 +-
tests/qemu-iotests/238 | 2 +-
tests/qemu-iotests/iotests.py | 4 ++--
tests/vm/basevm.py | 2 +-
16 files changed, 33 insertions(+), 21 deletions(-)
rename scripts/qemu.py => python/qemu/__init__.py (98%)
rename {scripts/qmp => python/qemu}/qmp.py (100%)
rename {scripts => python/qemu}/qtest.py (98%)
delete mode 100644 scripts/qmp/__init__.py
diff --git a/configure b/configure
index a61682c3c7..343dd004e9 100755
--- a/configure
+++ b/configure
@@ -7604,6 +7604,7 @@ LINKS="$LINKS pc-bios/qemu-icon.bmp"
LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
LINKS="$LINKS tests/acceptance tests/data"
LINKS="$LINKS tests/qemu-iotests/check"
+LINKS="$LINKS python"
for bios_file in \
$source_path/pc-bios/*.bin \
$source_path/pc-bios/*.lid \
diff --git a/scripts/qemu.py b/python/qemu/__init__.py
similarity index 98%
rename from scripts/qemu.py
rename to python/qemu/__init__.py
index 32b00af5cc..38de3e9177 100644
--- a/scripts/qemu.py
+++ b/python/qemu/__init__.py
@@ -16,12 +16,13 @@ import errno
import logging
import os
import subprocess
-import qmp.qmp
import re
import shutil
import socket
import tempfile
+from . import qmp
+
LOG = logging.getLogger(__name__)
@@ -66,7 +67,7 @@ class QEMUMachineAddDeviceError(QEMUMachineError):
failures reported by the QEMU binary itself.
"""
-class MonitorResponseError(qmp.qmp.QMPError):
+class MonitorResponseError(qmp.QMPError):
"""
Represents erroneous QMP monitor reply
"""
@@ -267,8 +268,8 @@ class QEMUMachine(object):
self._qemu_log_path = os.path.join(self._temp_dir, self._name + ".log")
self._qemu_log_file = open(self._qemu_log_path, 'wb')
- self._qmp = qmp.qmp.QEMUMonitorProtocol(self._vm_monitor,
- server=True)
+ self._qmp = qmp.QEMUMonitorProtocol(self._vm_monitor,
+ server=True)
def _post_launch(self):
self._qmp.accept()
@@ -384,7 +385,7 @@ class QEMUMachine(object):
"""
reply = self.qmp(cmd, conv_keys, **args)
if reply is None:
- raise qmp.qmp.QMPError("Monitor is closed")
+ raise qmp.QMPError("Monitor is closed")
if "error" in reply:
raise MonitorResponseError(reply)
return reply["return"]
diff --git a/scripts/qmp/qmp.py b/python/qemu/qmp.py
similarity index 100%
rename from scripts/qmp/qmp.py
rename to python/qemu/qmp.py
diff --git a/scripts/qtest.py b/python/qemu/qtest.py
similarity index 98%
rename from scripts/qtest.py
rename to python/qemu/qtest.py
index afac3fe900..eb45824dd0 100644
--- a/scripts/qtest.py
+++ b/python/qemu/qtest.py
@@ -13,7 +13,8 @@
import socket
import os
-import qemu
+
+from . import QEMUMachine
class QEMUQtestProtocol(object):
@@ -79,7 +80,7 @@ class QEMUQtestProtocol(object):
self._sock.settimeout(timeout)
-class QEMUQtestMachine(qemu.QEMUMachine):
+class QEMUQtestMachine(QEMUMachine):
'''A QEMU VM'''
def __init__(self, binary, args=None, name=None, test_dir="/var/tmp",
diff --git a/scripts/device-crash-test b/scripts/device-crash-test
index 2a13fa4f84..a6748910ad 100755
--- a/scripts/device-crash-test
+++ b/scripts/device-crash-test
@@ -25,6 +25,7 @@ check for crashes and unexpected errors.
"""
from __future__ import print_function
+import os
import sys
import glob
import logging
@@ -34,6 +35,7 @@ import random
import argparse
from itertools import chain
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
from qemu import QEMUMachine
logger = logging.getLogger('device-crash-test')
diff --git a/scripts/qmp/__init__.py b/scripts/qmp/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/scripts/qmp/qemu-ga-client b/scripts/qmp/qemu-ga-client
index e8cb7646a0..30cf8a9a0d 100755
--- a/scripts/qmp/qemu-ga-client
+++ b/scripts/qmp/qemu-ga-client
@@ -37,10 +37,13 @@
#
from __future__ import print_function
+import os
+import sys
import base64
import random
-import qmp
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
+from qemu import qmp
class QemuGuestAgent(qmp.QEMUMonitorProtocol):
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index 770140772d..9fec46e2ed 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -66,7 +66,6 @@
# sent to QEMU, which is useful for debugging and documentation generation.
from __future__ import print_function
-import qmp
import json
import ast
import readline
@@ -76,6 +75,9 @@ import errno
import atexit
import shlex
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
+from qemu import qmp
+
class QMPCompleter(list):
def complete(self, text, state):
for cmd in self:
diff --git a/scripts/render_block_graph.py b/scripts/render_block_graph.py
index ed7e581b4f..3e9d282a49 100755
--- a/scripts/render_block_graph.py
+++ b/scripts/render_block_graph.py
@@ -23,6 +23,8 @@ import sys
import subprocess
import json
from graphviz import Digraph
+
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
from qemu import MonitorResponseError
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index 1e54fd5932..28bfb8e9d3 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -13,9 +13,8 @@ import sys
import avocado
-SRC_ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
-SRC_ROOT_DIR = os.path.abspath(os.path.dirname(SRC_ROOT_DIR))
-sys.path.append(os.path.join(SRC_ROOT_DIR, 'scripts'))
+SRC_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..', '..', '..')
+sys.path.append(os.path.join(SRC_ROOT_DIR, 'python'))
from qemu import QEMUMachine
diff --git a/tests/acceptance/virtio_version.py b/tests/acceptance/virtio_version.py
index 464d75aa4e..37fc01ea18 100644
--- a/tests/acceptance/virtio_version.py
+++ b/tests/acceptance/virtio_version.py
@@ -11,7 +11,7 @@ Check compatibility of virtio device types
import sys
import os
-sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "scripts"))
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
from qemu import QEMUMachine
from avocado_qemu import Test
diff --git a/tests/migration/guestperf/engine.py b/tests/migration/guestperf/engine.py
index 398e3f2706..0e304660b8 100644
--- a/tests/migration/guestperf/engine.py
+++ b/tests/migration/guestperf/engine.py
@@ -24,13 +24,14 @@ import re
import sys
import time
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'scripts'))
-import qemu
-import qmp.qmp
from guestperf.progress import Progress, ProgressStats
from guestperf.report import Report
from guestperf.timings import TimingRecord, Timings
+sys.path.append(os.path.join(os.path.dirname(__file__),
+ '..', '..', '..', 'python'))
+import qemu
+
class Engine(object):
diff --git a/tests/qemu-iotests/235 b/tests/qemu-iotests/235
index d6edd97ab4..75c203b30c 100755
--- a/tests/qemu-iotests/235
+++ b/tests/qemu-iotests/235
@@ -23,7 +23,7 @@ import os
import iotests
from iotests import qemu_img_create, qemu_io, file_path, log
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'scripts'))
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
from qemu import QEMUMachine
diff --git a/tests/qemu-iotests/238 b/tests/qemu-iotests/238
index f81ee1112f..688abc9acb 100755
--- a/tests/qemu-iotests/238
+++ b/tests/qemu-iotests/238
@@ -23,7 +23,7 @@ import os
import iotests
from iotests import log
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'scripts'))
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
from qemu import QEMUMachine
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index b461f53abf..54a31044b4 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -32,8 +32,8 @@ import atexit
import io
from collections import OrderedDict
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'scripts'))
-import qtest
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
+from qemu import qtest
# This will not work if arguments contain spaces but is necessary if we
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index bdca6cb2fc..0556bdcf9e 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -17,7 +17,7 @@ import sys
import logging
import time
import datetime
-sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "scripts"))
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
from qemu import QEMUMachine, kvm_available
import subprocess
import hashlib
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PULL 3/7] scripts/qemu.py: log QEMU launch command line
2019-02-22 19:41 [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22 Cleber Rosa
2019-02-22 19:41 ` [Qemu-devel] [PULL 1/7] Acceptance tests: drop usage of ":avocado: enable" Cleber Rosa
2019-02-22 19:41 ` [Qemu-devel] [PULL 2/7] Introduce a Python module structure Cleber Rosa
@ 2019-02-22 19:41 ` Cleber Rosa
2019-02-22 19:41 ` [Qemu-devel] [PULL 4/7] tests.acceptance: adds multi vm capability for acceptance tests Cleber Rosa
` (5 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Cleber Rosa @ 2019-02-22 19:41 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Eduardo Habkost, Fam Zheng, qemu-block, Kevin Wolf, Max Reitz,
Philippe Mathieu-Daudé,
Alex Bennée, Cleber Rosa, Markus Armbruster, Caio Carrara
Even when the launch of QEMU succeeds, it's useful to have the command
line recorded.
Reviewed-by: Caio Carrara <ccarrara@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20190202005610.24048-2-crosa@redhat.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
python/qemu/__init__.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/python/qemu/__init__.py b/python/qemu/__init__.py
index 38de3e9177..585cd2a1a3 100644
--- a/python/qemu/__init__.py
+++ b/python/qemu/__init__.py
@@ -321,6 +321,7 @@ class QEMUMachine(object):
self._pre_launch()
self._qemu_full_args = (self._wrapper + [self._binary] +
self._base_args() + self._args)
+ LOG.debug('VM launch command: %r', ' '.join(self._qemu_full_args))
self._popen = subprocess.Popen(self._qemu_full_args,
stdin=devnull,
stdout=self._qemu_log_file,
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PULL 4/7] tests.acceptance: adds multi vm capability for acceptance tests
2019-02-22 19:41 [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22 Cleber Rosa
` (2 preceding siblings ...)
2019-02-22 19:41 ` [Qemu-devel] [PULL 3/7] scripts/qemu.py: log QEMU launch command line Cleber Rosa
@ 2019-02-22 19:41 ` Cleber Rosa
2019-02-22 19:41 ` [Qemu-devel] [PULL 5/7] tests.acceptance: adds simple migration test Cleber Rosa
` (4 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Cleber Rosa @ 2019-02-22 19:41 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Eduardo Habkost, Fam Zheng, qemu-block, Kevin Wolf, Max Reitz,
Philippe Mathieu-Daudé,
Alex Bennée, Cleber Rosa, Markus Armbruster, Caio Carrara,
Wainer dos Santos Moschetta
From: Caio Carrara <ccarrara@redhat.com>
This change adds the possibility to write acceptance tests with multi
virtual machine support. It's done keeping the virtual machines objects
stored in a test attribute (dictionary). This dictionary shouldn't be
accessed directly but through the new method added `get_vm`. This new
method accept a list of args (that will be added as virtual machine
arguments) and an optional name argument. The name is the key that
identify a single virtual machine along the test machines available. If
a name without a machine is informed a new machine will be instantiated.
The current usage of vm in tests will not be broken by this change since
it keeps a property called vm in the base test class. This property only
calls the new method `get_vm` with default parameters (no args and
'default' as machine name).
Signed-off-by: Caio Carrara <ccarrara@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20190212193855.13223-2-ccarrara@redhat.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
docs/devel/testing.rst | 41 ++++++++++++++++++++++-
tests/acceptance/avocado_qemu/__init__.py | 25 +++++++++++---
2 files changed, 61 insertions(+), 5 deletions(-)
diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
index 3ce171829d..60f897d915 100644
--- a/docs/devel/testing.rst
+++ b/docs/devel/testing.rst
@@ -633,7 +633,46 @@ instance, available at ``self.vm``. Because many tests will tweak the
QEMU command line, launching the QEMUMachine (by using ``self.vm.launch()``)
is left to the test writer.
-At test "tear down", ``avocado_qemu.Test`` handles the QEMUMachine
+The base test class has also support for tests with more than one
+QEMUMachine. The way to get machines is through the ``self.get_vm()``
+method which will return a QEMUMachine instance. The ``self.get_vm()``
+method accepts arguments that will be passed to the QEMUMachine creation
+and also an optional `name` attribute so you can identify a specific
+machine and get it more than once through the tests methods. A simple
+and hypothetical example follows:
+
+.. code::
+
+ from avocado_qemu import Test
+
+
+ class MultipleMachines(Test):
+ """
+ :avocado: enable
+ """
+ def test_multiple_machines(self):
+ first_machine = self.get_vm()
+ second_machine = self.get_vm()
+ self.get_vm(name='third_machine').launch()
+
+ first_machine.launch()
+ second_machine.launch()
+
+ first_res = first_machine.command(
+ 'human-monitor-command',
+ command_line='info version')
+
+ second_res = second_machine.command(
+ 'human-monitor-command',
+ command_line='info version')
+
+ third_res = self.get_vm(name='third_machine').command(
+ 'human-monitor-command',
+ command_line='info version')
+
+ self.assertEquals(first_res, second_res, third_res)
+
+At test "tear down", ``avocado_qemu.Test`` handles all the QEMUMachines
shutdown.
QEMUMachine
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index 28bfb8e9d3..a66ec72daa 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -10,6 +10,7 @@
import os
import sys
+import uuid
import avocado
@@ -41,13 +42,29 @@ def pick_default_qemu_bin():
class Test(avocado.Test):
def setUp(self):
- self.vm = None
+ self._vms = {}
self.qemu_bin = self.params.get('qemu_bin',
default=pick_default_qemu_bin())
if self.qemu_bin is None:
self.cancel("No QEMU binary defined or found in the source tree")
- self.vm = QEMUMachine(self.qemu_bin)
+
+ def _new_vm(self, *args):
+ vm = QEMUMachine(self.qemu_bin)
+ if args:
+ vm.add_args(*args)
+ return vm
+
+ @property
+ def vm(self):
+ return self.get_vm(name='default')
+
+ def get_vm(self, *args, name=None):
+ if not name:
+ name = str(uuid.uuid4())
+ if self._vms.get(name) is None:
+ self._vms[name] = self._new_vm(*args)
+ return self._vms[name]
def tearDown(self):
- if self.vm is not None:
- self.vm.shutdown()
+ for vm in self._vms.values():
+ vm.shutdown()
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PULL 5/7] tests.acceptance: adds simple migration test
2019-02-22 19:41 [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22 Cleber Rosa
` (3 preceding siblings ...)
2019-02-22 19:41 ` [Qemu-devel] [PULL 4/7] tests.acceptance: adds multi vm capability for acceptance tests Cleber Rosa
@ 2019-02-22 19:41 ` Cleber Rosa
2020-11-03 10:40 ` Philippe Mathieu-Daudé
2019-02-22 19:41 ` [Qemu-devel] [PULL 6/7] Acceptance tests: use linux-3.6 and set vm memory to 4GiB Cleber Rosa
` (3 subsequent siblings)
8 siblings, 1 reply; 14+ messages in thread
From: Cleber Rosa @ 2019-02-22 19:41 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Eduardo Habkost, Fam Zheng, qemu-block, Kevin Wolf, Max Reitz,
Philippe Mathieu-Daudé,
Alex Bennée, Cleber Rosa, Markus Armbruster, Caio Carrara,
Wainer dos Santos Moschetta
From: Caio Carrara <ccarrara@redhat.com>
This change adds the simplest possible migration test. Beyond the test
purpose itself it's also useful to exercise the multi virtual machines
capabilities from base avocado qemu test class.
Signed-off-by: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Caio Carrara <ccarrara@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20190212193855.13223-3-ccarrara@redhat.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
tests/acceptance/migration.py | 53 +++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
create mode 100644 tests/acceptance/migration.py
diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
new file mode 100644
index 0000000000..6115cf6c24
--- /dev/null
+++ b/tests/acceptance/migration.py
@@ -0,0 +1,53 @@
+# Migration test
+#
+# Copyright (c) 2019 Red Hat, Inc.
+#
+# Authors:
+# Cleber Rosa <crosa@redhat.com>
+# Caio Carrara <ccarrara@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later. See the COPYING file in the top-level directory.
+
+
+from avocado_qemu import Test
+
+from avocado.utils import network
+from avocado.utils import wait
+
+
+class Migration(Test):
+ """
+ :avocado: enable
+ """
+
+ timeout = 10
+
+ @staticmethod
+ def migration_finished(vm):
+ return vm.command('query-migrate')['status'] in ('completed', 'failed')
+
+ def _get_free_port(self):
+ port = network.find_free_port()
+ if port is None:
+ self.cancel('Failed to find a free port')
+ return port
+
+
+ def test_migration_with_tcp_localhost(self):
+ source_vm = self.get_vm()
+ dest_uri = 'tcp:localhost:%u' % self._get_free_port()
+ dest_vm = self.get_vm('-incoming', dest_uri)
+ dest_vm.launch()
+ source_vm.launch()
+ source_vm.qmp('migrate', uri=dest_uri)
+ wait.wait_for(
+ self.migration_finished,
+ timeout=self.timeout,
+ step=0.1,
+ args=(source_vm,)
+ )
+ self.assertEqual(dest_vm.command('query-migrate')['status'], 'completed')
+ self.assertEqual(source_vm.command('query-migrate')['status'], 'completed')
+ self.assertEqual(dest_vm.command('query-status')['status'], 'running')
+ self.assertEqual(source_vm.command('query-status')['status'], 'postmigrate')
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PULL 5/7] tests.acceptance: adds simple migration test
2019-02-22 19:41 ` [Qemu-devel] [PULL 5/7] tests.acceptance: adds simple migration test Cleber Rosa
@ 2020-11-03 10:40 ` Philippe Mathieu-Daudé
2020-11-03 15:27 ` Cleber Rosa
0 siblings, 1 reply; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-03 10:40 UTC (permalink / raw)
To: Cleber Rosa, Eduardo Habkost, Wainer Moschetta
Cc: Fam Zheng, Peter Maydell, Qemu-block, Markus Armbruster,
QEMU Developers, Max Reitz, Caio Carrara, Kevin Wolf,
Alex Bennée
Hi,
On Fri, Feb 22, 2019 at 8:42 PM Cleber Rosa <crosa@redhat.com> wrote:
>
> From: Caio Carrara <ccarrara@redhat.com>
>
> This change adds the simplest possible migration test. Beyond the test
> purpose itself it's also useful to exercise the multi virtual machines
> capabilities from base avocado qemu test class.
>
> Signed-off-by: Cleber Rosa <crosa@redhat.com>
> Signed-off-by: Caio Carrara <ccarrara@redhat.com>
> Reviewed-by: Cleber Rosa <crosa@redhat.com>
> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> Message-Id: <20190212193855.13223-3-ccarrara@redhat.com>
> Signed-off-by: Cleber Rosa <crosa@redhat.com>
> ---
> tests/acceptance/migration.py | 53 +++++++++++++++++++++++++++++++++++
> 1 file changed, 53 insertions(+)
> create mode 100644 tests/acceptance/migration.py
>
> diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
> new file mode 100644
> index 0000000000..6115cf6c24
> --- /dev/null
> +++ b/tests/acceptance/migration.py
> @@ -0,0 +1,53 @@
> +# Migration test
> +#
> +# Copyright (c) 2019 Red Hat, Inc.
> +#
> +# Authors:
> +# Cleber Rosa <crosa@redhat.com>
> +# Caio Carrara <ccarrara@redhat.com>
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2 or
> +# later. See the COPYING file in the top-level directory.
> +
> +
> +from avocado_qemu import Test
> +
> +from avocado.utils import network
> +from avocado.utils import wait
> +
> +
> +class Migration(Test):
> + """
> + :avocado: enable
> + """
> +
> + timeout = 10
> +
> + @staticmethod
> + def migration_finished(vm):
> + return vm.command('query-migrate')['status'] in ('completed', 'failed')
> +
> + def _get_free_port(self):
> + port = network.find_free_port()
> + if port is None:
> + self.cancel('Failed to find a free port')
> + return port
This method doesn't seem to work when running with -j2: 2 tests started
with different arch configurations get the same port... Is this a known issue?
> +
> +
> + def test_migration_with_tcp_localhost(self):
> + source_vm = self.get_vm()
> + dest_uri = 'tcp:localhost:%u' % self._get_free_port()
> + dest_vm = self.get_vm('-incoming', dest_uri)
> + dest_vm.launch()
> + source_vm.launch()
> + source_vm.qmp('migrate', uri=dest_uri)
> + wait.wait_for(
> + self.migration_finished,
> + timeout=self.timeout,
> + step=0.1,
> + args=(source_vm,)
> + )
> + self.assertEqual(dest_vm.command('query-migrate')['status'], 'completed')
> + self.assertEqual(source_vm.command('query-migrate')['status'], 'completed')
> + self.assertEqual(dest_vm.command('query-status')['status'], 'running')
> + self.assertEqual(source_vm.command('query-status')['status'], 'postmigrate')
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PULL 5/7] tests.acceptance: adds simple migration test
2020-11-03 10:40 ` Philippe Mathieu-Daudé
@ 2020-11-03 15:27 ` Cleber Rosa
2020-11-03 18:10 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 14+ messages in thread
From: Cleber Rosa @ 2020-11-03 15:27 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Fam Zheng, Peter Maydell, Eduardo Habkost, Qemu-block,
Markus Armbruster, Wainer Moschetta, QEMU Developers, Kevin Wolf,
Max Reitz, Alex Bennée
[-- Attachment #1: Type: text/plain, Size: 5341 bytes --]
On Tue, Nov 03, 2020 at 11:40:30AM +0100, Philippe Mathieu-Daudé wrote:
> Hi,
>
> On Fri, Feb 22, 2019 at 8:42 PM Cleber Rosa <crosa@redhat.com> wrote:
> >
> > From: Caio Carrara <ccarrara@redhat.com>
> >
> > This change adds the simplest possible migration test. Beyond the test
> > purpose itself it's also useful to exercise the multi virtual machines
> > capabilities from base avocado qemu test class.
> >
> > Signed-off-by: Cleber Rosa <crosa@redhat.com>
> > Signed-off-by: Caio Carrara <ccarrara@redhat.com>
> > Reviewed-by: Cleber Rosa <crosa@redhat.com>
> > Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> > Message-Id: <20190212193855.13223-3-ccarrara@redhat.com>
> > Signed-off-by: Cleber Rosa <crosa@redhat.com>
> > ---
> > tests/acceptance/migration.py | 53 +++++++++++++++++++++++++++++++++++
> > 1 file changed, 53 insertions(+)
> > create mode 100644 tests/acceptance/migration.py
> >
> > diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
> > new file mode 100644
> > index 0000000000..6115cf6c24
> > --- /dev/null
> > +++ b/tests/acceptance/migration.py
> > @@ -0,0 +1,53 @@
> > +# Migration test
> > +#
> > +# Copyright (c) 2019 Red Hat, Inc.
> > +#
> > +# Authors:
> > +# Cleber Rosa <crosa@redhat.com>
> > +# Caio Carrara <ccarrara@redhat.com>
> > +#
> > +# This work is licensed under the terms of the GNU GPL, version 2 or
> > +# later. See the COPYING file in the top-level directory.
> > +
> > +
> > +from avocado_qemu import Test
> > +
> > +from avocado.utils import network
> > +from avocado.utils import wait
> > +
> > +
> > +class Migration(Test):
> > + """
> > + :avocado: enable
> > + """
> > +
> > + timeout = 10
> > +
> > + @staticmethod
> > + def migration_finished(vm):
> > + return vm.command('query-migrate')['status'] in ('completed', 'failed')
> > +
> > + def _get_free_port(self):
> > + port = network.find_free_port()
> > + if port is None:
> > + self.cancel('Failed to find a free port')
> > + return port
>
> This method doesn't seem to work when running with -j2: 2 tests started
> with different arch configurations get the same port... Is this a known issue?
>
It's not bullet proof, but it seems to be quite safe... This is what I've tried:
$ ./tests/venv/bin/avocado run --test-runner=nrunner --nrunner-max-parallel-tasks=10 tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost{,,,,,,,,,,,,,,,,,,,}
JOB ID : 377957f4a16fbc2c6a6f6d9ae225c61af86bd570
JOB LOG : /home/cleber/avocado/job-results/job-2020-11-03T10.24-377957f/job.log
(02/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
(06/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
(01/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
(05/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
(03/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
(10/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
(07/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
(09/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
(04/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
(08/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
(02/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.46 s)
(06/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.60 s)
(01/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.51 s)
(03/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.49 s)
(05/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.52 s)
(10/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.51 s)
(07/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.52 s)
(09/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.53 s)
(04/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.49 s)
(08/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.56 s)
...
RESULTS : PASS 20 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML : /home/cleber/avocado/job-results/job-2020-11-03T10.24-377957f/results.html
JOB TIME : 3.82 s
If this is about the issue you posted on IRC, it's about s390x and migration instead:
2020-11-03 10:06:33,124 qmp L0255 DEBUG| >>> {'execute': 'query-migrate'}
2020-11-03 10:06:33,124 qmp L0148 DEBUG| <<< {'timestamp': {'seconds': 1604415993, 'microseconds': 124382}, 'event': 'GUEST_PANICKED', 'data': {'action': 'pause', 'info': {'core': 0, 'psw-addr': 0, 'reason': 'disabled-wait', 'psw-mask':
I ran across this on Friday, and will properly report it.
Let me know if that helps,
- Cleber.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PULL 5/7] tests.acceptance: adds simple migration test
2020-11-03 15:27 ` Cleber Rosa
@ 2020-11-03 18:10 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-03 18:10 UTC (permalink / raw)
To: Cleber Rosa
Cc: Fam Zheng, Peter Maydell, Eduardo Habkost, Qemu-block,
Markus Armbruster, Wainer Moschetta, QEMU Developers, Kevin Wolf,
Max Reitz, Alex Bennée
On 11/3/20 4:27 PM, Cleber Rosa wrote:
> On Tue, Nov 03, 2020 at 11:40:30AM +0100, Philippe Mathieu-Daudé wrote:
>> Hi,
>>
>> On Fri, Feb 22, 2019 at 8:42 PM Cleber Rosa <crosa@redhat.com> wrote:
>>>
>>> From: Caio Carrara <ccarrara@redhat.com>
>>>
>>> This change adds the simplest possible migration test. Beyond the test
>>> purpose itself it's also useful to exercise the multi virtual machines
>>> capabilities from base avocado qemu test class.
>>>
>>> Signed-off-by: Cleber Rosa <crosa@redhat.com>
>>> Signed-off-by: Caio Carrara <ccarrara@redhat.com>
>>> Reviewed-by: Cleber Rosa <crosa@redhat.com>
>>> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
>>> Message-Id: <20190212193855.13223-3-ccarrara@redhat.com>
>>> Signed-off-by: Cleber Rosa <crosa@redhat.com>
>>> ---
>>> tests/acceptance/migration.py | 53 +++++++++++++++++++++++++++++++++++
>>> 1 file changed, 53 insertions(+)
>>> create mode 100644 tests/acceptance/migration.py
>>>
>>> diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
>>> new file mode 100644
>>> index 0000000000..6115cf6c24
>>> --- /dev/null
>>> +++ b/tests/acceptance/migration.py
>>> @@ -0,0 +1,53 @@
>>> +# Migration test
>>> +#
>>> +# Copyright (c) 2019 Red Hat, Inc.
>>> +#
>>> +# Authors:
>>> +# Cleber Rosa <crosa@redhat.com>
>>> +# Caio Carrara <ccarrara@redhat.com>
>>> +#
>>> +# This work is licensed under the terms of the GNU GPL, version 2 or
>>> +# later. See the COPYING file in the top-level directory.
>>> +
>>> +
>>> +from avocado_qemu import Test
>>> +
>>> +from avocado.utils import network
>>> +from avocado.utils import wait
>>> +
>>> +
>>> +class Migration(Test):
>>> + """
>>> + :avocado: enable
>>> + """
>>> +
>>> + timeout = 10
>>> +
>>> + @staticmethod
>>> + def migration_finished(vm):
>>> + return vm.command('query-migrate')['status'] in ('completed', 'failed')
>>> +
>>> + def _get_free_port(self):
>>> + port = network.find_free_port()
>>> + if port is None:
>>> + self.cancel('Failed to find a free port')
>>> + return port
>>
>> This method doesn't seem to work when running with -j2: 2 tests started
>> with different arch configurations get the same port... Is this a known issue?
>>
>
> It's not bullet proof, but it seems to be quite safe... This is what I've tried:
>
> $ ./tests/venv/bin/avocado run --test-runner=nrunner --nrunner-max-parallel-tasks=10 tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost{,,,,,,,,,,,,,,,,,,,}
> JOB ID : 377957f4a16fbc2c6a6f6d9ae225c61af86bd570
> JOB LOG : /home/cleber/avocado/job-results/job-2020-11-03T10.24-377957f/job.log
> (02/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
> (06/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
> (01/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
> (05/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
> (03/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
> (10/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
> (07/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
> (09/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
> (04/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
> (08/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: STARTED
> (02/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.46 s)
> (06/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.60 s)
> (01/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.51 s)
> (03/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.49 s)
> (05/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.52 s)
> (10/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.51 s)
> (07/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.52 s)
> (09/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.53 s)
> (04/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.49 s)
> (08/20) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.56 s)
> ...
> RESULTS : PASS 20 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
> JOB HTML : /home/cleber/avocado/job-results/job-2020-11-03T10.24-377957f/results.html
> JOB TIME : 3.82 s
Thanks for the testing.
> If this is about the issue you posted on IRC, it's about s390x and migration instead:
>
> 2020-11-03 10:06:33,124 qmp L0255 DEBUG| >>> {'execute': 'query-migrate'}
> 2020-11-03 10:06:33,124 qmp L0148 DEBUG| <<< {'timestamp': {'seconds': 1604415993, 'microseconds': 124382}, 'event': 'GUEST_PANICKED', 'data': {'action': 'pause', 'info': {'core': 0, 'psw-addr': 0, 'reason': 'disabled-wait', 'psw-mask':
>
> I ran across this on Friday, and will properly report it.
Ah I missed that *sigh* thanks.
>
> Let me know if that helps,
> - Cleber.
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Qemu-devel] [PULL 6/7] Acceptance tests: use linux-3.6 and set vm memory to 4GiB
2019-02-22 19:41 [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22 Cleber Rosa
` (4 preceding siblings ...)
2019-02-22 19:41 ` [Qemu-devel] [PULL 5/7] tests.acceptance: adds simple migration test Cleber Rosa
@ 2019-02-22 19:41 ` Cleber Rosa
2019-02-22 19:41 ` [Qemu-devel] [PULL 7/7] Acceptance tests: expect boot to extract 2GiB+ initrd with linux-v4.16 Cleber Rosa
` (2 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Cleber Rosa @ 2019-02-22 19:41 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Eduardo Habkost, Fam Zheng, qemu-block, Kevin Wolf, Max Reitz,
Philippe Mathieu-Daudé,
Alex Bennée, Cleber Rosa, Markus Armbruster, Li Zhijian,
Wainer dos Santos Moschetta, Caio Carrara
From: Li Zhijian <lizhijian@cn.fujitsu.com>
QEMU have already supported to load up to 4G initrd if the sepcified memory is
enough and XLF_CAN_BE_LOADED_ABOVE_4G is set by guest kernel
linux-3.6 kernel shipped by Fedora-18 cannot support xldflags so that it
cannot support loading more than 2GiB initrd
CC: Wainer dos Santos Moschetta <wainersm@redhat.com>
CC: Caio Carrara <ccarrara@redhat.com>
CC: Cleber Rosa <crosa@redhat.com>
CC: Eduardo Habkost <ehabkost@redhat.com>
CC: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <1548638112-31101-1-git-send-email-lizhijian@cn.fujitsu.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
tests/acceptance/linux_initrd.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/tests/acceptance/linux_initrd.py b/tests/acceptance/linux_initrd.py
index 5a15fc4347..e33b5dcec0 100644
--- a/tests/acceptance/linux_initrd.py
+++ b/tests/acceptance/linux_initrd.py
@@ -23,14 +23,16 @@ class LinuxInitrd(Test):
timeout = 60
- def test_with_2gib_file_should_exit_error_msg(self):
+ def test_with_2gib_file_should_exit_error_msg_with_linux_v3_6(self):
"""
Pretends to boot QEMU with an initrd file with size of 2GiB
and expect it exits with error message.
+ Fedora-18 shipped with linux-3.6 which have not supported xloadflags
+ cannot support more than 2GiB initrd.
"""
- kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/'
- 'Everything/x86_64/os/images/pxeboot/vmlinuz')
- kernel_hash = '238e083e114c48200f80d889f7e32eeb2793e02a'
+ kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora/li'
+ 'nux/releases/18/Fedora/x86_64/os/images/pxeboot/vmlinuz')
+ kernel_hash = '41464f68efe42b9991250bed86c7081d2ccdbb21'
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
max_size = 2 * (1024 ** 3) - 1
@@ -38,8 +40,8 @@ class LinuxInitrd(Test):
initrd.seek(max_size)
initrd.write(b'\0')
initrd.flush()
- cmd = "%s -kernel %s -initrd %s" % (self.qemu_bin, kernel_path,
- initrd.name)
+ cmd = "%s -kernel %s -initrd %s -m 4096" % (
+ self.qemu_bin, kernel_path, initrd.name)
res = run(cmd, ignore_status=True)
self.assertEqual(res.exit_status, 1)
expected_msg = r'.*initrd is too large.*max: \d+, need %s.*' % (
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PULL 7/7] Acceptance tests: expect boot to extract 2GiB+ initrd with linux-v4.16
2019-02-22 19:41 [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22 Cleber Rosa
` (5 preceding siblings ...)
2019-02-22 19:41 ` [Qemu-devel] [PULL 6/7] Acceptance tests: use linux-3.6 and set vm memory to 4GiB Cleber Rosa
@ 2019-02-22 19:41 ` Cleber Rosa
2019-03-01 14:38 ` [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22 Peter Maydell
2019-03-07 16:58 ` Peter Maydell
8 siblings, 0 replies; 14+ messages in thread
From: Cleber Rosa @ 2019-02-22 19:41 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Eduardo Habkost, Fam Zheng, qemu-block, Kevin Wolf, Max Reitz,
Philippe Mathieu-Daudé,
Alex Bennée, Cleber Rosa, Markus Armbruster, Li Zhijian,
Wainer dos Santos Moschetta, Caio Carrara
From: Li Zhijian <lizhijian@cn.fujitsu.com>
XLF_CAN_BE_LOADED_ABOVE_4G is set on vmlinuz shipped by Fedora-28 so that
it's allowed to be loaded below 4 GB address.
timeout is updated to 5 minutes as well since we need more time to load a
large initrd to the guest
CC: Wainer dos Santos Moschetta <wainersm@redhat.com>
CC: Caio Carrara <ccarrara@redhat.com>
CC: Cleber Rosa <crosa@redhat.com>
CC: Eduardo Habkost <ehabkost@redhat.com>
CC: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <1548638112-31101-2-git-send-email-lizhijian@cn.fujitsu.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
tests/acceptance/linux_initrd.py | 37 +++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/tests/acceptance/linux_initrd.py b/tests/acceptance/linux_initrd.py
index e33b5dcec0..fbdb48e43f 100644
--- a/tests/acceptance/linux_initrd.py
+++ b/tests/acceptance/linux_initrd.py
@@ -8,6 +8,7 @@
# This work is licensed under the terms of the GNU GPL, version 2 or
# later. See the COPYING file in the top-level directory.
+import logging
import tempfile
from avocado.utils.process import run
@@ -21,7 +22,7 @@ class LinuxInitrd(Test):
:avocado: tags=x86_64
"""
- timeout = 60
+ timeout = 300
def test_with_2gib_file_should_exit_error_msg_with_linux_v3_6(self):
"""
@@ -47,3 +48,37 @@ class LinuxInitrd(Test):
expected_msg = r'.*initrd is too large.*max: \d+, need %s.*' % (
max_size + 1)
self.assertRegex(res.stderr_text, expected_msg)
+
+ def test_with_2gib_file_should_work_with_linux_v4_16(self):
+ """
+ QEMU has supported up to 4 GiB initrd for recent kernel
+ Expect guest can reach 'Unpacking initramfs...'
+ """
+ kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/'
+ 'Everything/x86_64/os/images/pxeboot/vmlinuz')
+ kernel_hash = '238e083e114c48200f80d889f7e32eeb2793e02a'
+ kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
+ max_size = 2 * (1024 ** 3) + 1
+
+ with tempfile.NamedTemporaryFile() as initrd:
+ initrd.seek(max_size)
+ initrd.write(b'\0')
+ initrd.flush()
+
+ self.vm.set_machine('pc')
+ self.vm.set_console()
+ kernel_command_line = 'console=ttyS0'
+ self.vm.add_args('-kernel', kernel_path,
+ '-append', kernel_command_line,
+ '-initrd', initrd.name,
+ '-m', '5120')
+ self.vm.launch()
+ console = self.vm.console_socket.makefile()
+ console_logger = logging.getLogger('console')
+ while True:
+ msg = console.readline()
+ console_logger.debug(msg.strip())
+ if 'Unpacking initramfs...' in msg:
+ break
+ if 'Kernel panic - not syncing' in msg:
+ self.fail("Kernel panic reached")
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22
2019-02-22 19:41 [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22 Cleber Rosa
` (6 preceding siblings ...)
2019-02-22 19:41 ` [Qemu-devel] [PULL 7/7] Acceptance tests: expect boot to extract 2GiB+ initrd with linux-v4.16 Cleber Rosa
@ 2019-03-01 14:38 ` Peter Maydell
2019-03-06 20:34 ` Cleber Rosa
2019-03-07 16:58 ` Peter Maydell
8 siblings, 1 reply; 14+ messages in thread
From: Peter Maydell @ 2019-03-01 14:38 UTC (permalink / raw)
To: Cleber Rosa
Cc: QEMU Developers, Eduardo Habkost, Fam Zheng, Qemu-block,
Kevin Wolf, Max Reitz, Philippe Mathieu-Daudé,
Alex Bennée, Markus Armbruster
On Fri, 22 Feb 2019 at 19:41, Cleber Rosa <crosa@redhat.com> wrote:
>
> The following changes since commit 8eb29f1bf5a974dc4c11d2d1f5e7c7f7a62be116:
>
> Merge remote-tracking branch 'remotes/awilliam/tags/vfio-updates-20190221.0' into staging (2019-02-22 15:48:04 +0000)
>
> are available in the Git repository at:
>
> git://github.com/clebergnu/qemu.git tags/python-next-pull-request
>
> for you to fetch changes up to 8f1c89ec7443e4fa2cf106d8fa1c1c97b6ddeffb:
>
> Acceptance tests: expect boot to extract 2GiB+ initrd with linux-v4.16 (2019-02-22 14:07:01 -0500)
>
> ----------------------------------------------------------------
> Python queue, 2019-02-22
>
> Python:
> * introduce "python" directory with module namespace
> * log QEMU launch command line on qemu.QEMUMachine
>
> Acceptance Tests:
> * initrd 4GiB+ test
> * migration test
> * multi vm support in test class
> * bump Avocado version and drop ":avocado: enable"
Hi -- this pull request appears to be signed with a GPG key that
I've never seen before and which is signed only by itself.
Could you arrange to get some more signatures on it, please ?
thanks
-- PMM
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22
2019-03-01 14:38 ` [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22 Peter Maydell
@ 2019-03-06 20:34 ` Cleber Rosa
0 siblings, 0 replies; 14+ messages in thread
From: Cleber Rosa @ 2019-03-06 20:34 UTC (permalink / raw)
To: Peter Maydell
Cc: QEMU Developers, Eduardo Habkost, Fam Zheng, Qemu-block,
Kevin Wolf, Max Reitz, Philippe Mathieu-Daudé,
Alex Bennée, Markus Armbruster
On Fri, Mar 01, 2019 at 02:38:45PM +0000, Peter Maydell wrote:
> On Fri, 22 Feb 2019 at 19:41, Cleber Rosa <crosa@redhat.com> wrote:
> >
> > The following changes since commit 8eb29f1bf5a974dc4c11d2d1f5e7c7f7a62be116:
> >
> > Merge remote-tracking branch 'remotes/awilliam/tags/vfio-updates-20190221.0' into staging (2019-02-22 15:48:04 +0000)
> >
> > are available in the Git repository at:
> >
> > git://github.com/clebergnu/qemu.git tags/python-next-pull-request
> >
> > for you to fetch changes up to 8f1c89ec7443e4fa2cf106d8fa1c1c97b6ddeffb:
> >
> > Acceptance tests: expect boot to extract 2GiB+ initrd with linux-v4.16 (2019-02-22 14:07:01 -0500)
> >
> > ----------------------------------------------------------------
> > Python queue, 2019-02-22
> >
> > Python:
> > * introduce "python" directory with module namespace
> > * log QEMU launch command line on qemu.QEMUMachine
> >
> > Acceptance Tests:
> > * initrd 4GiB+ test
> > * migration test
> > * multi vm support in test class
> > * bump Avocado version and drop ":avocado: enable"
>
>
> Hi -- this pull request appears to be signed with a GPG key that
> I've never seen before and which is signed only by itself.
> Could you arrange to get some more signatures on it, please ?
>
Hi Peter,
I've got 3 new signatures on that key. Let me know if that's enough,
and if you have any other issues with that key or the PR.
> thanks
> -- PMM
Thank you!
- Cleber.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22
2019-02-22 19:41 [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22 Cleber Rosa
` (7 preceding siblings ...)
2019-03-01 14:38 ` [Qemu-devel] [PULL 0/7] Python queue, 2019-02-22 Peter Maydell
@ 2019-03-07 16:58 ` Peter Maydell
8 siblings, 0 replies; 14+ messages in thread
From: Peter Maydell @ 2019-03-07 16:58 UTC (permalink / raw)
To: Cleber Rosa
Cc: QEMU Developers, Eduardo Habkost, Fam Zheng, Qemu-block,
Kevin Wolf, Max Reitz, Philippe Mathieu-Daudé,
Alex Bennée, Markus Armbruster
On Fri, 22 Feb 2019 at 19:41, Cleber Rosa <crosa@redhat.com> wrote:
>
> The following changes since commit 8eb29f1bf5a974dc4c11d2d1f5e7c7f7a62be116:
>
> Merge remote-tracking branch 'remotes/awilliam/tags/vfio-updates-20190221.0' into staging (2019-02-22 15:48:04 +0000)
>
> are available in the Git repository at:
>
> git://github.com/clebergnu/qemu.git tags/python-next-pull-request
>
> for you to fetch changes up to 8f1c89ec7443e4fa2cf106d8fa1c1c97b6ddeffb:
>
> Acceptance tests: expect boot to extract 2GiB+ initrd with linux-v4.16 (2019-02-22 14:07:01 -0500)
>
> ----------------------------------------------------------------
> Python queue, 2019-02-22
>
> Python:
> * introduce "python" directory with module namespace
> * log QEMU launch command line on qemu.QEMUMachine
>
> Acceptance Tests:
> * initrd 4GiB+ test
> * migration test
> * multi vm support in test class
> * bump Avocado version and drop ":avocado: enable"
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/4.0
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 14+ messages in thread