aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2025-03-08 11:31:26 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2025-03-08 11:31:26 +0800
commite88a579392f74aa7658299f29dc43aca199e4533 (patch)
tree91b52d7cd5a8007869381e03927bddea3db5034f /tests
parentcfadd798dec85f1dc2f3db0debf139e2b92f9c4f (diff)
parentd9b5dfc7122559e5b5959ecf534788b90c3dd102 (diff)
downloadqemu-e88a579392f74aa7658299f29dc43aca199e4533.zip
qemu-e88a579392f74aa7658299f29dc43aca199e4533.tar.gz
qemu-e88a579392f74aa7658299f29dc43aca199e4533.tar.bz2
Merge tag 'pull-request-2025-03-07' of https://gitlab.com/thuth/qemu into staging
* Bug fixes and some small improvements for functional tests * Improve performance of s390x PCI passthrough devices with relaxed translation # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmfK3dsRHHRodXRoQHJl # ZGhhdC5jb20ACgkQLtnXdP5wLbUfDQ/8CopnzCKGKFhyM5skrHbhDbUVbul6yV4L # kIOo7N8OlrNcQB90bj+Udy+mUANHjkmSiBa5lJ/78ej4DFS6CxeVgrl1fSEl36xn # GjWDwSUiN8pG1O4YtnDqWVTBieGSzbkQr1jHgpeAnvv08s+TtmudP1T8IznWU2v9 # FqD78SdebZ0Kua+ksBgMxwkHd6VMw13vsu6KuT9VBhie40LcDrFOuG8RDz/qo4IO # Yg9s1Bqcy7Wa4+0ldMXS1plSdIqJBtVc/HDTg1QwH994b4Lvr7ffrFZmuVcd2dbE # XKQ5jAMOYZqWdlXszkyd8moYGhmevCkQlALhpnbHixnfakfFYX0wTiJB6oCthFQ0 # It0J/ntNsCmJiIHNbPLzsJ1pE5+ureRnGbxVe05n+zfm8MaXL6s4nSdZzHyp8n43 # UZQqVzK55Q34K9O0qoUdCdBCjMKS9v5u95jjJo8+nc8sJoeQTssOoiixwB/E4y21 # 9qSh7CbDjQK4zwuzQ7jKD603zAJH6ivvsHXlMBMXJFBiSMCAoQQ1vyou6yRHswRr # gLHDwiWUx8SX8ckbbJ/+Zo9+T8JBMvC5hNYG8VoAtlTQusG4bHSbKdPNNH0eHsEp # f7RlZPRizkcK3w0Nj+u4kXdnnex3QLLSgnyAYq7zEl6V+mho8KqaBezkO7wQDHZy # +GW5ignQ1Gs= # =CyiZ # -----END PGP SIGNATURE----- # gpg: Signature made Fri 07 Mar 2025 19:51:55 HKT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * tag 'pull-request-2025-03-07' of https://gitlab.com/thuth/qemu: s390x/pci: indicate QEMU supports relaxed translation for passthrough s390x/pci: add support for guests that request direct mapping MAINTAINERS: Add docs/devel/testing/functional.rst to the functional section doc: add missing 'Asset' type in function test doc tests/functional/test_virtio_balloon: Only use KVM for running this test tests/functional: fix race in virtio balloon test tests/functional: Increase the timeout of the mips64el_replay test tests/functional/test_mips_malta: Add a network test via the pcnet NIC tests/functional: Move the code for testing HTTP downloads to a common function tests/functional: stop output from zstd command when uncompressing tests/functional: drop unused 'get_tag' method tests/functional: skip memaddr tests on 32-bit builds tests/functional: reduce tuxrun maxmem to work on 32-bit hosts tests/functional: set 'qemu_bin' as an object level field tests/functional: remove unused 'bin_prefix' variable Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/meson.build1
-rw-r--r--tests/functional/qemu_test/linuxkernel.py26
-rw-r--r--tests/functional/qemu_test/testcase.py8
-rw-r--r--tests/functional/qemu_test/tuxruntest.py11
-rw-r--r--tests/functional/qemu_test/uncompress.py6
-rwxr-xr-xtests/functional/test_intel_iommu.py22
-rwxr-xr-xtests/functional/test_mem_addr_space.py34
-rwxr-xr-xtests/functional/test_mips_malta.py20
-rwxr-xr-xtests/functional/test_ppc64_tuxrun.py2
-rwxr-xr-xtests/functional/test_virtio_balloon.py29
10 files changed, 111 insertions, 48 deletions
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 3fd2652..97c3f4a 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -36,6 +36,7 @@ test_timeouts = {
'intel_iommu': 300,
'mips_malta' : 120,
'mipsel_replay' : 480,
+ 'mips64el_replay' : 180,
'netdev_ethtool' : 180,
'ppc_40p' : 240,
'ppc64_hv' : 1000,
diff --git a/tests/functional/qemu_test/linuxkernel.py b/tests/functional/qemu_test/linuxkernel.py
index 2c95981..2aca0ee 100644
--- a/tests/functional/qemu_test/linuxkernel.py
+++ b/tests/functional/qemu_test/linuxkernel.py
@@ -3,8 +3,12 @@
# 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 hashlib
+import urllib.request
+
+from .cmd import wait_for_console_pattern, exec_command_and_wait_for_pattern
from .testcase import QemuSystemTest
-from .cmd import wait_for_console_pattern
+from .utils import get_usernet_hostfwd_port
class LinuxKernelTest(QemuSystemTest):
@@ -26,3 +30,23 @@ class LinuxKernelTest(QemuSystemTest):
self.vm.launch()
if wait_for:
self.wait_for_console_pattern(wait_for)
+
+ def check_http_download(self, filename, hashsum, guestport=8080,
+ pythoncmd='python3 -m http.server'):
+ exec_command_and_wait_for_pattern(self,
+ f'{pythoncmd} {guestport} & sleep 1',
+ f'Serving HTTP on 0.0.0.0 port {guestport}')
+ hl = hashlib.sha256()
+ hostport = get_usernet_hostfwd_port(self.vm)
+ url = f'http://localhost:{hostport}{filename}'
+ self.log.info(f'Downloading {url} ...')
+ with urllib.request.urlopen(url) as response:
+ while True:
+ chunk = response.read(1 << 20)
+ if not chunk:
+ break
+ hl.update(chunk)
+
+ digest = hl.hexdigest()
+ self.log.info(f'sha256sum of download is {digest}.')
+ self.assertEqual(digest, hashsum)
diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu_test/testcase.py
index 869f394..058bf27 100644
--- a/tests/functional/qemu_test/testcase.py
+++ b/tests/functional/qemu_test/testcase.py
@@ -33,7 +33,6 @@ from .uncompress import uncompress
class QemuBaseTest(unittest.TestCase):
- qemu_bin = os.getenv('QEMU_TEST_QEMU_BINARY')
arch = None
workdir = None
@@ -192,7 +191,8 @@ class QemuBaseTest(unittest.TestCase):
return False
return True
- def setUp(self, bin_prefix):
+ def setUp(self):
+ self.qemu_bin = os.getenv('QEMU_TEST_QEMU_BINARY')
self.assertIsNotNone(self.qemu_bin, 'QEMU_TEST_QEMU_BINARY must be set')
self.arch = self.qemu_bin.split('-')[-1]
self.socketdir = None
@@ -254,7 +254,7 @@ class QemuBaseTest(unittest.TestCase):
class QemuUserTest(QemuBaseTest):
def setUp(self):
- super().setUp('qemu-')
+ super().setUp()
self._ldpath = []
def add_ldpath(self, ldpath):
@@ -277,7 +277,7 @@ class QemuSystemTest(QemuBaseTest):
def setUp(self):
self._vms = {}
- super().setUp('qemu-system-')
+ super().setUp()
console_log = logging.getLogger('console')
console_log.setLevel(logging.DEBUG)
diff --git a/tests/functional/qemu_test/tuxruntest.py b/tests/functional/qemu_test/tuxruntest.py
index 41a4945..ad74156 100644
--- a/tests/functional/qemu_test/tuxruntest.py
+++ b/tests/functional/qemu_test/tuxruntest.py
@@ -24,17 +24,6 @@ class TuxRunBaselineTest(QemuSystemTest):
# Tests are ~10-40s, allow for --debug/--enable-gcov overhead
timeout = 100
- def get_tag(self, tagname, default=None):
- """
- Get the metadata tag or return the default.
- """
- utag = self._get_unique_tag_val(tagname)
- print(f"{tagname}/{default} -> {utag}")
- if utag:
- return utag
-
- return default
-
def setUp(self):
super().setUp()
diff --git a/tests/functional/qemu_test/uncompress.py b/tests/functional/qemu_test/uncompress.py
index 76dcf22..ce79da1 100644
--- a/tests/functional/qemu_test/uncompress.py
+++ b/tests/functional/qemu_test/uncompress.py
@@ -13,7 +13,7 @@ import os
import stat
import shutil
from urllib.parse import urlparse
-from subprocess import check_call, CalledProcessError
+from subprocess import run, CalledProcessError, DEVNULL
from .asset import Asset
@@ -46,8 +46,8 @@ def zstd_uncompress(zstd_path, output_path):
return
try:
- check_call(['zstd', "-f", "-d", zstd_path,
- "-o", output_path])
+ run(['zstd', "-f", "-d", zstd_path,
+ "-o", output_path], capture_output=True, check=True)
except CalledProcessError as e:
os.remove(output_path)
raise Exception(
diff --git a/tests/functional/test_intel_iommu.py b/tests/functional/test_intel_iommu.py
index a9e8f82..62268d6 100755
--- a/tests/functional/test_intel_iommu.py
+++ b/tests/functional/test_intel_iommu.py
@@ -10,11 +10,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 hashlib
-import urllib.request
-
from qemu_test import LinuxKernelTest, Asset, exec_command_and_wait_for_pattern
-from qemu_test.utils import get_usernet_hostfwd_port
class IntelIOMMU(LinuxKernelTest):
@@ -125,23 +121,7 @@ class IntelIOMMU(LinuxKernelTest):
# Check virtio-net via HTTP:
exec_command_and_wait_for_pattern(self, 'dhclient eth0', prompt)
- exec_command_and_wait_for_pattern(self,
- f'python3 -m http.server {self.GUEST_PORT} & sleep 1',
- f'Serving HTTP on 0.0.0.0 port {self.GUEST_PORT}')
- hl = hashlib.sha256()
- hostport = get_usernet_hostfwd_port(self.vm)
- url = f'http://localhost:{hostport}{filename}'
- self.log.info(f'Downloading {url} ...')
- with urllib.request.urlopen(url) as response:
- while True:
- chunk = response.read(1 << 20)
- if not chunk:
- break
- hl.update(chunk)
-
- digest = hl.hexdigest()
- self.log.info(f'sha256sum of download is {digest}.')
- self.assertEqual(digest, hashsum)
+ self.check_http_download(filename, hashsum, self.GUEST_PORT)
def test_intel_iommu(self):
self.common_vm_setup()
diff --git a/tests/functional/test_mem_addr_space.py b/tests/functional/test_mem_addr_space.py
index bb0cf06..2d9d31e 100755
--- a/tests/functional/test_mem_addr_space.py
+++ b/tests/functional/test_mem_addr_space.py
@@ -20,6 +20,25 @@ class MemAddrCheck(QemuSystemTest):
# this reason.
DELAY_Q35_BOOT_SEQUENCE = 1
+ # This helper can go away when the 32-bit host deprecation
+ # turns into full & final removal of support.
+ def ensure_64bit_binary(self):
+ with open(self.qemu_bin, "rb") as fh:
+ ident = fh.read(4)
+
+ # "\x7fELF"
+ if ident != bytes([0x7f, 0x45, 0x4C, 0x46]):
+ # Non-ELF file implies macOS or Windows which
+ # we already assume to be 64-bit only
+ return
+
+ # bits == 1 -> 32-bit; bits == 2 -> 64-bit
+ bits = int.from_bytes(fh.read(1), byteorder='little')
+ if bits != 2:
+ # 32-bit ELF builds won't be able to address sufficient
+ # RAM to run the tests
+ self.skipTest("64-bit build host is required")
+
# first, lets test some 32-bit processors.
# for all 32-bit cases, pci64_hole_size is 0.
def test_phybits_low_pse36(self):
@@ -38,6 +57,7 @@ class MemAddrCheck(QemuSystemTest):
If maxmem is set to 59.5G with all other QEMU parameters identical, QEMU
should start fine.
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-S', '-machine', 'q35', '-m',
'512,slots=1,maxmem=59.6G',
'-cpu', 'pentium,pse36=on', '-display', 'none',
@@ -55,6 +75,7 @@ class MemAddrCheck(QemuSystemTest):
access up to a maximum of 64GiB of memory. Rest is the same as the case
with pse36 above.
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-S', '-machine', 'q35', '-m',
'512,slots=1,maxmem=59.6G',
'-cpu', 'pentium,pae=on', '-display', 'none',
@@ -71,6 +92,7 @@ class MemAddrCheck(QemuSystemTest):
Setting maxmem to 59.5G and making sure that QEMU can start with the
same options as the failing case above with pse36 cpu feature.
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-machine', 'q35', '-m',
'512,slots=1,maxmem=59.5G',
'-cpu', 'pentium,pse36=on', '-display', 'none',
@@ -88,6 +110,7 @@ class MemAddrCheck(QemuSystemTest):
Setting maxmem to 59.5G and making sure that QEMU can start fine
with the same options as the case above.
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-machine', 'q35', '-m',
'512,slots=1,maxmem=59.5G',
'-cpu', 'pentium,pae=on', '-display', 'none',
@@ -104,6 +127,7 @@ class MemAddrCheck(QemuSystemTest):
Pentium2 has 36 bits of addressing, so its same as pentium
with pse36 ON.
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-machine', 'q35', '-m',
'512,slots=1,maxmem=59.5G',
'-cpu', 'pentium2', '-display', 'none',
@@ -123,6 +147,7 @@ class MemAddrCheck(QemuSystemTest):
message because the region for memory hotplug is always placed
above 4 GiB due to the PCI hole and simplicity.
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-S', '-machine', 'q35', '-m',
'512,slots=1,maxmem=4G',
'-cpu', 'pentium', '-display', 'none',
@@ -150,6 +175,7 @@ class MemAddrCheck(QemuSystemTest):
which is equal to 987.5 GiB. Setting the value to 988 GiB should
make QEMU fail with the error message.
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-S', '-machine', 'pc-q35-7.0', '-m',
'512,slots=1,maxmem=988G',
'-display', 'none',
@@ -170,6 +196,7 @@ class MemAddrCheck(QemuSystemTest):
Make sure QEMU fails when maxmem size is 976 GiB (12 GiB less
than 988 GiB).
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-S', '-machine', 'pc-q35-7.1', '-m',
'512,slots=1,maxmem=976G',
'-display', 'none',
@@ -186,6 +213,7 @@ class MemAddrCheck(QemuSystemTest):
Same as q35-7.0 AMD case except that here we check that QEMU can
successfully start when maxmem is < 988G.
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-S', '-machine', 'pc-q35-7.0', '-m',
'512,slots=1,maxmem=987.5G',
'-display', 'none',
@@ -202,6 +230,7 @@ class MemAddrCheck(QemuSystemTest):
Same as q35-7.1 AMD case except that here we check that QEMU can
successfully start when maxmem is < 976G.
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-S', '-machine', 'pc-q35-7.1', '-m',
'512,slots=1,maxmem=975.5G',
'-display', 'none',
@@ -219,6 +248,7 @@ class MemAddrCheck(QemuSystemTest):
Intel cpu instead. QEMU should start fine in this case as
"above_4G" memory starts at 4G.
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-S', '-cpu', 'Skylake-Server',
'-machine', 'pc-q35-7.1', '-m',
'512,slots=1,maxmem=976G',
@@ -243,6 +273,7 @@ class MemAddrCheck(QemuSystemTest):
memory for the VM (1024 - 32 - 1 + 0.5). With 992 GiB, QEMU should
fail to start.
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-S', '-cpu', 'EPYC-v4,phys-bits=41',
'-machine', 'pc-q35-7.1', '-m',
'512,slots=1,maxmem=992G',
@@ -261,6 +292,7 @@ class MemAddrCheck(QemuSystemTest):
Same as above but by setting maxram between 976 GiB and 992 Gib,
QEMU should start fine.
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-S', '-cpu', 'EPYC-v4,phys-bits=41',
'-machine', 'pc-q35-7.1', '-m',
'512,slots=1,maxmem=990G',
@@ -281,6 +313,7 @@ class MemAddrCheck(QemuSystemTest):
So maxmem here should be at most 986 GiB considering all memory boundary
alignment constraints with 40 bits (1 TiB) of processor physical bits.
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-S', '-cpu', 'Skylake-Server,phys-bits=40',
'-machine', 'q35,cxl=on', '-m',
'512,slots=1,maxmem=987G',
@@ -299,6 +332,7 @@ class MemAddrCheck(QemuSystemTest):
with the exact same parameters as above, QEMU should start fine even
with cxl enabled.
"""
+ self.ensure_64bit_binary()
self.vm.add_args('-S', '-cpu', 'Skylake-Server,phys-bits=40',
'-machine', 'q35,cxl=on', '-m',
'512,slots=1,maxmem=987G',
diff --git a/tests/functional/test_mips_malta.py b/tests/functional/test_mips_malta.py
index eaf3722..9697c7d 100755
--- a/tests/functional/test_mips_malta.py
+++ b/tests/functional/test_mips_malta.py
@@ -45,12 +45,15 @@ class MaltaMachineConsole(LinuxKernelTest):
'dcfe3a7fe3200da3a00d176b95caaa086495eb158f2bff64afc67d7e1eb2cddc')
def test_mips_malta_cpio(self):
+ self.require_netdev('user')
+ self.set_machine('malta')
+ self.require_device('pcnet')
+
kernel_path = self.archive_extract(
self.ASSET_KERNEL_4_5_0,
member='boot/vmlinux-4.5.0-2-4kc-malta')
initrd_path = self.uncompress(self.ASSET_INITRD)
- self.set_machine('malta')
self.vm.set_console()
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
+ 'console=ttyS0 console=tty '
@@ -58,6 +61,8 @@ class MaltaMachineConsole(LinuxKernelTest):
self.vm.add_args('-kernel', kernel_path,
'-initrd', initrd_path,
'-append', kernel_command_line,
+ '-netdev', 'user,id=n1,tftp=' + self.scratch_file('boot'),
+ '-device', 'pcnet,netdev=n1',
'-no-reboot')
self.vm.launch()
self.wait_for_console_pattern('Boot successful.')
@@ -66,6 +71,19 @@ class MaltaMachineConsole(LinuxKernelTest):
'BogoMIPS')
exec_command_and_wait_for_pattern(self, 'uname -a',
'Debian')
+
+ exec_command_and_wait_for_pattern(self, 'ip link set eth0 up',
+ 'eth0: link up')
+ exec_command_and_wait_for_pattern(self,
+ 'ip addr add 10.0.2.15 dev eth0',
+ '#')
+ exec_command_and_wait_for_pattern(self, 'route add default eth0', '#')
+ exec_command_and_wait_for_pattern(self,
+ 'tftp -g -r vmlinux-4.5.0-2-4kc-malta 10.0.2.2', '#')
+ exec_command_and_wait_for_pattern(self,
+ 'md5sum vmlinux-4.5.0-2-4kc-malta',
+ 'a98218a7efbdefb2dfdf9ecd08c98318')
+
exec_command_and_wait_for_pattern(self, 'reboot',
'reboot: Restarting system')
# Wait for VM to shut down gracefully
diff --git a/tests/functional/test_ppc64_tuxrun.py b/tests/functional/test_ppc64_tuxrun.py
index 05c6162..e8f79c6 100755
--- a/tests/functional/test_ppc64_tuxrun.py
+++ b/tests/functional/test_ppc64_tuxrun.py
@@ -64,7 +64,7 @@ class TuxRunPPC64Test(TuxRunBaselineTest):
',"index":1,"id":"pci.1"}')
self.vm.add_args('-device', '{"driver":"spapr-vscsi","id":"scsi1"'
',"reg":12288}')
- self.vm.add_args('-m', '2G,slots=32,maxmem=4G',
+ self.vm.add_args('-m', '1G,slots=32,maxmem=2G',
'-object', 'memory-backend-ram,id=ram1,size=1G',
'-device', 'pc-dimm,id=dimm1,memdev=ram1')
diff --git a/tests/functional/test_virtio_balloon.py b/tests/functional/test_virtio_balloon.py
index 67b48e1..5877b6c 100755
--- a/tests/functional/test_virtio_balloon.py
+++ b/tests/functional/test_virtio_balloon.py
@@ -32,7 +32,7 @@ class VirtioBalloonx86(QemuSystemTest):
'e3c1b309d9203604922d6e255c2c5d098a309c2d46215d8fc026954f3c5c27a0')
DEFAULT_KERNEL_PARAMS = ('root=/dev/vda1 console=ttyS0 net.ifnames=0 '
- 'rd.rescue')
+ 'rd.rescue quiet')
def wait_for_console_pattern(self, success_message, vm=None):
wait_for_console_pattern(
@@ -47,6 +47,11 @@ class VirtioBalloonx86(QemuSystemTest):
prompt = '# '
self.wait_for_console_pattern(prompt)
+ # Synchronize on virtio-block driver creating the root device
+ exec_command_and_wait_for_pattern(self,
+ "while ! (dmesg -c | grep vda:) ; do sleep 1 ; done",
+ "vda1")
+
exec_command_and_wait_for_pattern(self, 'mount /dev/vda1 /sysroot',
prompt)
exec_command_and_wait_for_pattern(self, 'chroot /sysroot',
@@ -65,10 +70,21 @@ class VirtioBalloonx86(QemuSystemTest):
assert val == UNSET_STATS_VALUE
def assert_running_stats(self, then):
- ret = self.vm.qmp('qom-get',
- {'path': '/machine/peripheral/balloon',
- 'property': 'guest-stats'})['return']
- when = ret.get('last-update')
+ # We told the QEMU to refresh stats every 100ms, but
+ # there can be a delay between virtio-ballon driver
+ # being modprobed and seeing the first stats refresh
+ # Retry a few times for robustness under heavy load
+ retries = 10
+ when = 0
+ while when == 0 and retries:
+ ret = self.vm.qmp('qom-get',
+ {'path': '/machine/peripheral/balloon',
+ 'property': 'guest-stats'})['return']
+ when = ret.get('last-update')
+ if when == 0:
+ retries = retries - 1
+ time.sleep(0.5)
+
now = time.time()
assert when > then and when < now
@@ -94,6 +110,7 @@ class VirtioBalloonx86(QemuSystemTest):
def test_virtio_balloon_stats(self):
self.set_machine('q35')
+ self.require_accelerator("kvm")
kernel_path = self.ASSET_KERNEL.fetch()
initrd_path = self.ASSET_INITRD.fetch()
diskimage_path = self.ASSET_DISKIMAGE.fetch()
@@ -106,7 +123,7 @@ class VirtioBalloonx86(QemuSystemTest):
# reset, we can reliably catch the clean stats again in BIOS
# phase before the guest OS launches
self.vm.add_args("-boot", "menu=on")
- self.vm.add_args("-machine", "q35,accel=kvm:tcg")
+ self.vm.add_args("-accel", "kvm")
self.vm.add_args("-device", "virtio-balloon,id=balloon")
self.vm.add_args('-drive',
f'file={diskimage_path},if=none,id=drv0,snapshot=on')