aboutsummaryrefslogtreecommitdiff
path: root/tests/avocado/avocado_qemu/__init__.py
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2022-03-16 10:43:58 +0000
committerPeter Maydell <peter.maydell@linaro.org>2022-03-16 10:43:58 +0000
commit1d60bb4b14601e38ed17384277aa4c30c57925d3 (patch)
treef7c029e8be6f0f884203b16e2dc1cda28f431a03 /tests/avocado/avocado_qemu/__init__.py
parentd6f229f9a0592c4d5beb0a5c4e024231c27680d3 (diff)
parent377bf6f37da11d14641a0e973c4ed272259cca9c (diff)
Merge tag 'pull-request-2022-03-15v2' of https://gitlab.com/thuth/qemu into staging
* Fixes for s390x branch instruction emulation * Fixes for the tests/avocado/boot_linux.py:BootLinuxS390X test * Re-enable the "-cpu help" output # gpg: Signature made Wed 16 Mar 2022 08:01:14 GMT # 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-2022-03-15v2' of https://gitlab.com/thuth/qemu: softmmu: List CPU types again accel/tcg: Fix cpu_ldq_be_mmu typo tests/avocado: start PhoneServer upfront tests/tcg/s390x: Test BRASL and BRCL with large negative offsets s390x/tcg: Fix BRCL with a large negative offset s390x/tcg: Fix BRASL with a large negative offset tests/tcg: drop -cpu max from s390x sha512-mvx invocation Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/avocado/avocado_qemu/__init__.py')
-rw-r--r--tests/avocado/avocado_qemu/__init__.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
index 9b056b5ce5..ac85e36a4d 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -18,7 +18,7 @@ import time
import uuid
import avocado
-from avocado.utils import cloudinit, datadrainer, network, process, ssh, vmimage
+from avocado.utils import cloudinit, datadrainer, process, ssh, vmimage
from avocado.utils.path import find_command
#: The QEMU build root directory. It may also be the source directory
@@ -602,9 +602,6 @@ class LinuxTest(LinuxSSHMixIn, QemuSystemTest):
self.log.info('Preparing cloudinit image')
try:
cloudinit_iso = os.path.join(self.workdir, 'cloudinit.iso')
- self.phone_home_port = network.find_free_port()
- if not self.phone_home_port:
- self.cancel('Failed to get a free port')
pubkey_content = None
if ssh_pubkey:
with open(ssh_pubkey) as pubkey:
@@ -614,7 +611,7 @@ class LinuxTest(LinuxSSHMixIn, QemuSystemTest):
password=self.password,
# QEMU's hard coded usermode router address
phone_home_host='10.0.2.2',
- phone_home_port=self.phone_home_port,
+ phone_home_port=self.phone_server.server_port,
authorized_key=pubkey_content)
except Exception:
self.cancel('Failed to prepare the cloudinit image')
@@ -625,6 +622,8 @@ class LinuxTest(LinuxSSHMixIn, QemuSystemTest):
self.vm.add_args('-drive', 'file=%s' % path)
def set_up_cloudinit(self, ssh_pubkey=None):
+ self.phone_server = cloudinit.PhoneHomeServer(('0.0.0.0', 0),
+ self.name)
cloudinit_iso = self.prepare_cloudinit(ssh_pubkey)
self.vm.add_args('-drive', 'file=%s,format=raw' % cloudinit_iso)
@@ -635,7 +634,9 @@ class LinuxTest(LinuxSSHMixIn, QemuSystemTest):
logger=self.log.getChild('console'))
console_drainer.start()
self.log.info('VM launched, waiting for boot confirmation from guest')
- cloudinit.wait_for_phone_home(('0.0.0.0', self.phone_home_port), self.name)
+ while not self.phone_server.instance_phoned_back:
+ self.phone_server.handle_request()
+
if set_up_ssh_connection:
self.log.info('Setting up the SSH connection')
self.ssh_connect(self.username, self.ssh_key)