From nobody Tue Nov 18 22:49:05 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613081613; cv=none; d=zohomail.com; s=zohoarc; b=YOYGMlppM43lYzhxh6cNbepWN+GLakoGh1Ym4YyPVB3tRW+zmiihP0PpkNR9/XLAHqNiT7HTFxaQnxAS9causQd3O6wAVtor0pgWLVpTmZ1anjVluPmXmsjfjQcXzmWnFlorV8h7GahHR8k0Q8VOCuYR6Hng04M6NUgEliwPGag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613081613; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yE/LntIwowJP/AvdhZnvELNHjMASPOH1uXK0gHpi4vs=; b=cqZjiVXjIS4Z+dm0zpNNhSMg66SBS33qALXkOyxAGXirnlEDE7N1NU1ZrRZJ86jWChEhBPZvKzwaAlG+NOy6qST5uEWZlySaqs53wvaT/fUJHkdTb1i103J/pPRrBJKYGeOLTrNZ3lnRTgKlsUwTM+FU7rWP23ykd/wmy7a8490= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1613081613357427.2508278996579; Thu, 11 Feb 2021 14:13:33 -0800 (PST) Received: from localhost ([::1]:37644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAKDG-00012l-V4 for importer@patchew.org; Thu, 11 Feb 2021 17:13:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAK2F-0000JJ-FW for qemu-devel@nongnu.org; Thu, 11 Feb 2021 17:02:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29026) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAK2C-0005rY-74 for qemu-devel@nongnu.org; Thu, 11 Feb 2021 17:02:03 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-23-88koqT26MmytA2GfX1UvUw-1; Thu, 11 Feb 2021 17:01:55 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8D71C85B664; Thu, 11 Feb 2021 22:01:54 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-89.rdu2.redhat.com [10.10.116.89]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 443C860BF1; Thu, 11 Feb 2021 22:01:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613080919; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yE/LntIwowJP/AvdhZnvELNHjMASPOH1uXK0gHpi4vs=; b=Egr6CgQWRJ/0rE0HQ2Ev9PBYXKuTEFjos7yRWWa7DB2/4TBSPp56/Uzl3S52d6WT4iWl4U cCmkAqnNdBu9L1Vda3Pn04xFDeYZmuMl3Oc58STI3sJ3YXtPZlW143BjoJoAt+PkOTIsAA 3iU1GjuUNKVIakG76LBXEjY3HvAwrbI= X-MC-Unique: 88koqT26MmytA2GfX1UvUw-1 From: Cleber Rosa To: qemu-devel@nongnu.org Subject: [PATCH 1/6] Python: close the log file kept by QEMUMachine before reading it Date: Thu, 11 Feb 2021 17:01:41 -0500 Message-Id: <20210211220146.2525771-2-crosa@redhat.com> In-Reply-To: <20210211220146.2525771-1-crosa@redhat.com> References: <20210211220146.2525771-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=crosa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=crosa@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Thomas Huth , Eduardo Habkost , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Max Reitz , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Willian Rampazzo , Cleber Rosa , John Snow , Beraldo Leal Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Closing a file that is open for writing, and then reading from it sounds like a better idea than the opposite, given that the content will be flushed. Reference: https://docs.python.org/3/library/io.html#io.IOBase.close Signed-off-by: Cleber Rosa Acked-by: Wainer dos Santos Moschetta Reviewed-by: John Snow --- python/qemu/machine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/qemu/machine.py b/python/qemu/machine.py index 7a40f4604b..6e44bda337 100644 --- a/python/qemu/machine.py +++ b/python/qemu/machine.py @@ -337,12 +337,12 @@ class QEMUMachine: self._qmp.close() self._qmp_connection =3D None =20 - self._load_io_log() - if self._qemu_log_file is not None: self._qemu_log_file.close() self._qemu_log_file =3D None =20 + self._load_io_log() + self._qemu_log_path =3D None =20 if self._temp_dir is not None: --=20 2.25.4 From nobody Tue Nov 18 22:49:05 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613081921; cv=none; d=zohomail.com; s=zohoarc; b=JVCScKqridpVfpvdIhZ3pdZ7n/8+1d0iAxXtcbbAabuwr9uxdMOyDsaYKqVQ/LN3adl0oxPm0RGneRj3Ch6DNRMozyZrzPoGJmOfTJvfQ+IudIyZFJXCy8O0Mlh9TYJ6hsHQgoOAjd6JhlJG3lzma45DRcxXdW341SQKi5ICTyc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613081921; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=y2hvibq9qOY9t7tRlKusvRT2KSYUM2Z2KjXnneBL7KQ=; b=hb29ML8/P6N1gJtpGiO9Ha0IkMmbxSGNhJwjoCzpIbrYexsjGJyioq7U1IZVy/J07OgLyTAilG6NW+Z1/u2ffFXlDpcmt4RfpUlaj5kvE3ptW85FCVO424dqiqANnYzHUPcTSDI0A9JLIijN136KXZdK9YIeQEc2G/pcYR3Olqg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1613081920746386.75662206152117; Thu, 11 Feb 2021 14:18:40 -0800 (PST) Received: from localhost ([::1]:46214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAKIJ-0005Bm-OY for importer@patchew.org; Thu, 11 Feb 2021 17:18:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAK2G-0000Ky-4u for qemu-devel@nongnu.org; Thu, 11 Feb 2021 17:02:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52078) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAK2D-0005tn-Fs for qemu-devel@nongnu.org; Thu, 11 Feb 2021 17:02:03 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-25-N9mEZOxZNTG9mQzr4OPW-g-1; Thu, 11 Feb 2021 17:01:57 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0E9A0C7402; Thu, 11 Feb 2021 22:01:56 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-89.rdu2.redhat.com [10.10.116.89]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B213D60BF1; Thu, 11 Feb 2021 22:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613080920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y2hvibq9qOY9t7tRlKusvRT2KSYUM2Z2KjXnneBL7KQ=; b=JlwdDYmOFw9tV/9TuA5Ukb6uyMApCPR1fq4S55nn5SSE9Pd7Gg72TJqpVeDrFLPUhoaRrt ze2JJD7zgIKZ6jVoK6wEGpZLnWguuE+W3p6n07a5yQOX6EIVTpYwjFez0nkaMBgd20jgwq mNZb9rd86hUx+PRcnS/5oVaRMQxpzlA= X-MC-Unique: N9mEZOxZNTG9mQzr4OPW-g-1 From: Cleber Rosa To: qemu-devel@nongnu.org Subject: [PATCH 2/6] Python: expose QEMUMachine's temporary directory Date: Thu, 11 Feb 2021 17:01:42 -0500 Message-Id: <20210211220146.2525771-3-crosa@redhat.com> In-Reply-To: <20210211220146.2525771-1-crosa@redhat.com> References: <20210211220146.2525771-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=crosa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=crosa@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Thomas Huth , Eduardo Habkost , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Max Reitz , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Willian Rampazzo , Cleber Rosa , John Snow , Beraldo Leal Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Each instance of qemu.machine.QEMUMachine currently has a "test directory", which may not have any relation to a "test", and it's really a temporary directory. Users instantiating the QEMUMachine class will be able to set the location of the directory that will *contain* the QEMUMachine unique temporary directory, so that parameter name has been changed from test_dir to base_temp_dir. A property has been added to allow users to access it without using private attributes, and with that, the directory is created on first use of the property. Signed-off-by: Cleber Rosa Reviewed-by: Wainer dos Santos Moschetta --- python/qemu/machine.py | 24 ++++++++++++++++-------- python/qemu/qtest.py | 6 +++--- tests/acceptance/virtio-gpu.py | 2 +- tests/qemu-iotests/iotests.py | 2 +- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/python/qemu/machine.py b/python/qemu/machine.py index 6e44bda337..b379fcbe72 100644 --- a/python/qemu/machine.py +++ b/python/qemu/machine.py @@ -84,7 +84,7 @@ class QEMUMachine: args: Sequence[str] =3D (), wrapper: Sequence[str] =3D (), name: Optional[str] =3D None, - test_dir: str =3D "/var/tmp", + base_temp_dir: str =3D "/var/tmp", monitor_address: Optional[SocketAddrT] =3D None, socket_scm_helper: Optional[str] =3D None, sock_dir: Optional[str] =3D None, @@ -97,10 +97,10 @@ class QEMUMachine: @param args: list of extra arguments @param wrapper: list of arguments used as prefix to qemu binary @param name: prefix for socket and log file names (default: qemu-P= ID) - @param test_dir: where to create socket and log file + @param base_temp_dir: default location where temporary files are c= reated @param monitor_address: address for QMP monitor @param socket_scm_helper: helper program, required for send_fd_scm= () - @param sock_dir: where to create socket (overrides test_dir for so= ck) + @param sock_dir: where to create socket (defaults to base_temp_dir) @param drain_console: (optional) True to drain console socket to b= uffer @param console_log: (optional) path to console log file @note: Qemu process is not started until launch() is used. @@ -112,8 +112,8 @@ class QEMUMachine: self._wrapper =3D wrapper =20 self._name =3D name or "qemu-%d" % os.getpid() - self._test_dir =3D test_dir - self._sock_dir =3D sock_dir or self._test_dir + self._base_temp_dir =3D base_temp_dir + self._sock_dir =3D sock_dir or self._base_temp_dir self._socket_scm_helper =3D socket_scm_helper =20 if monitor_address is not None: @@ -303,9 +303,7 @@ class QEMUMachine: return args =20 def _pre_launch(self) -> None: - self._temp_dir =3D tempfile.mkdtemp(prefix=3D"qemu-machine-", - dir=3Dself._test_dir) - self._qemu_log_path =3D os.path.join(self._temp_dir, self._name + = ".log") + self._qemu_log_path =3D os.path.join(self.temp_dir, self._name + "= .log") self._qemu_log_file =3D open(self._qemu_log_path, 'wb') =20 if self._console_set: @@ -744,3 +742,13 @@ class QEMUMachine: file=3Dself._console_log_path, drain=3Dself._drain_console) return self._console_socket + + @property + def temp_dir(self) -> str: + """ + Returns a temporary directory to be used for this machine + """ + if self._temp_dir is None: + self._temp_dir =3D tempfile.mkdtemp(prefix=3D"qemu-machine-", + dir=3Dself._base_temp_dir) + return self._temp_dir diff --git a/python/qemu/qtest.py b/python/qemu/qtest.py index 39a0cf62fe..78b97d13cf 100644 --- a/python/qemu/qtest.py +++ b/python/qemu/qtest.py @@ -112,14 +112,14 @@ class QEMUQtestMachine(QEMUMachine): binary: str, args: Sequence[str] =3D (), name: Optional[str] =3D None, - test_dir: str =3D "/var/tmp", + base_temp_dir: str =3D "/var/tmp", socket_scm_helper: Optional[str] =3D None, sock_dir: Optional[str] =3D None): if name is None: name =3D "qemu-%d" % os.getpid() if sock_dir is None: - sock_dir =3D test_dir - super().__init__(binary, args, name=3Dname, test_dir=3Dtest_dir, + sock_dir =3D base_temp_dir + super().__init__(binary, args, name=3Dname, base_temp_dir=3Dbase_t= emp_dir, socket_scm_helper=3Dsocket_scm_helper, sock_dir=3Dsock_dir) self._qtest: Optional[QEMUQtestProtocol] =3D None diff --git a/tests/acceptance/virtio-gpu.py b/tests/acceptance/virtio-gpu.py index 211f02932f..8d689eb820 100644 --- a/tests/acceptance/virtio-gpu.py +++ b/tests/acceptance/virtio-gpu.py @@ -119,7 +119,7 @@ class VirtioGPUx86(Test): os.set_inheritable(vug_sock.fileno(), True) =20 self._vug_log_path =3D os.path.join( - self.vm._test_dir, "vhost-user-gpu.log" + self.vm.temp_dir, "vhost-user-gpu.log" ) self._vug_log_file =3D open(self._vug_log_path, "wb") print(self._vug_log_path) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 00be68eca3..b02a3dc092 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -562,7 +562,7 @@ class VM(qtest.QEMUQtestMachine): def __init__(self, path_suffix=3D''): name =3D "qemu%s-%d" % (path_suffix, os.getpid()) super().__init__(qemu_prog, qemu_opts, name=3Dname, - test_dir=3Dtest_dir, + base_temp_dir=3Dtest_dir, socket_scm_helper=3Dsocket_scm_helper, sock_dir=3Dsock_dir) self._num_drives =3D 0 --=20 2.25.4 From nobody Tue Nov 18 22:49:05 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613081379; cv=none; d=zohomail.com; s=zohoarc; b=OBE2g3A93haD0Hu2ZV+P1vO0ogUe/5p0j1dK4CRS48dEDic0edSLUcQpzLwnGJTTLxcRcoDW3RtwS7+t8Nuul/fumvprHGXeaTk5Kku0aarZ7g1pT9JX8wRLllHAxERMjOpZosQwf3bJcTKDV+juBHiTVyHnzBFwFwq3Dxm/Ek8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613081379; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aF2eAF/U3Hl6txFKCJ55o1FqBx6NVChHyPObSWBl5cQ=; b=mQb39+B+0HpKFtL6D/2rYMYQA4TZeDO6P+DhVszynnsGveJrRo8NVnS2X7j0vUpEUY44rFNkz3d/0LjsjyhCxR9l68kvGWQzQxyeYvFFVRGI8+cQuX+RoyhZWJ2NPoKkGxiwxwruU22f41/mhoJJBmakOYSpJ61cyAfZTv++Nz0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1613081378727871.1528692030329; Thu, 11 Feb 2021 14:09:38 -0800 (PST) Received: from localhost ([::1]:59374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAK9Z-0006XF-Kp for importer@patchew.org; Thu, 11 Feb 2021 17:09:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAK2G-0000MP-Pb for qemu-devel@nongnu.org; Thu, 11 Feb 2021 17:02:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60640) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAK2D-0005uA-OK for qemu-devel@nongnu.org; Thu, 11 Feb 2021 17:02:04 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-9-RQsZ8cDTMoaUpjG649u_Tg-1; Thu, 11 Feb 2021 17:01:58 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7C740107ACF2; Thu, 11 Feb 2021 22:01:57 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-89.rdu2.redhat.com [10.10.116.89]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 33EC960BF1; Thu, 11 Feb 2021 22:01:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613080921; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aF2eAF/U3Hl6txFKCJ55o1FqBx6NVChHyPObSWBl5cQ=; b=ONeJN+ZvHRskbTyhB433xKrvVC19p5v5QS3F/LmE6hjLalwsGFCyeBtQuzJkNvJRDkQG+v K5dwG1Quemtwl9p2itLxjtUdNzRIosZ4e3eBKphFjFfRUYBfl+Pw8mnZDSbZGxhFl5EmVy SrnAF3DmSvN2jzeR7OTsguawZ7WGWak= X-MC-Unique: RQsZ8cDTMoaUpjG649u_Tg-1 From: Cleber Rosa To: qemu-devel@nongnu.org Subject: [PATCH 3/6] Acceptance Tests: use the job work directory for created VMs Date: Thu, 11 Feb 2021 17:01:43 -0500 Message-Id: <20210211220146.2525771-4-crosa@redhat.com> In-Reply-To: <20210211220146.2525771-1-crosa@redhat.com> References: <20210211220146.2525771-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=crosa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=crosa@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Thomas Huth , Eduardo Habkost , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Max Reitz , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Willian Rampazzo , Cleber Rosa , John Snow , Beraldo Leal Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The QEMUMachine uses a base temporary directory for all temporary needs. By setting it to the Avocado's workdir, it's possible to keep the temporary files during debugging sessions much more easily by setting the "--keep-tmp" command line option. Reference: https://avocado-framework.readthedocs.io/en/85.0/api/test/avocad= o.html#avocado.Test.workdir Reference: https://avocado-framework.readthedocs.io/en/85.0/config/index.ht= ml#run-keep-tmp Signed-off-by: Cleber Rosa Reviewed-by: John Snow Reviewed-by: Wainer dos Santos Moschetta --- tests/acceptance/avocado_qemu/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index bf54e419da..b7ab836455 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -172,7 +172,8 @@ class Test(avocado.Test): =20 def _new_vm(self, *args): self._sd =3D tempfile.TemporaryDirectory(prefix=3D"avo_qemu_sock_") - vm =3D QEMUMachine(self.qemu_bin, sock_dir=3Dself._sd.name) + vm =3D QEMUMachine(self.qemu_bin, base_temp_dir=3Dself.workdir, + sock_dir=3Dself._sd.name) if args: vm.add_args(*args) return vm --=20 2.25.4 From nobody Tue Nov 18 22:49:05 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613081672; cv=none; d=zohomail.com; s=zohoarc; b=Cn2BkHx1xjpjuuppaoSLFoVUm/sQnff6w53Lg47GP6Htu+r+xSmXOlkHqV6nCsadN9wiewGC4tiJOCQnt09qhoRpCX3c/Pmwou876l1ukmvRsDKlTge0/z2KLTV2/wLFv1Z/fdb3Lrsctc5DVgLI+xEqWDDNjhiA7eD80MkD2nY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613081672; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=z51YylU3RERj8QTy4DL4D4N0F420V85NDWymj/2W+BM=; b=EOuekaSIbKkeXEIlC66sg8G6H/XxnhY7Dtl1KTH2JEejLiD/n2BovwufTRdhf8HEVyN0GDC8HdMfyHsfVY/A/E5cKbh5tbSe8cvNU3xVuUwPuiNHKKGH2Qh5hY2McKsWtxzi55jLBXw3nxKhmOddor8DFF13rAzKM87DWPeSTVU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1613081672468566.733409208054; Thu, 11 Feb 2021 14:14:32 -0800 (PST) Received: from localhost ([::1]:40096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAKEJ-0002Dt-AR for importer@patchew.org; Thu, 11 Feb 2021 17:14:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAK2H-0000Nb-6J for qemu-devel@nongnu.org; Thu, 11 Feb 2021 17:02:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:21024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAK2F-0005uU-1P for qemu-devel@nongnu.org; Thu, 11 Feb 2021 17:02:04 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-288-jRF9rQ4POKGHeNn1jcqkSA-1; Thu, 11 Feb 2021 17:02:00 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ECF40801982; Thu, 11 Feb 2021 22:01:58 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-89.rdu2.redhat.com [10.10.116.89]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A1EF060BF1; Thu, 11 Feb 2021 22:01:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613080921; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z51YylU3RERj8QTy4DL4D4N0F420V85NDWymj/2W+BM=; b=e2cKWR8FWiyUjLvBVa1DdBny7EdmPLX5xDvMXC+iDFAvEY9lZ5FROtd6B96SJtNtwG1UVb KhAQ+EZQ40HYPvWKeeuimWB7ZFVoTUxor0EFFw57WraKHnOWb98Lk/KPw3uZMx1k/OGzol 6YF/f/NinAVSw9KS0RyGdaDo8ByB38M= X-MC-Unique: jRF9rQ4POKGHeNn1jcqkSA-1 From: Cleber Rosa To: qemu-devel@nongnu.org Subject: [PATCH 4/6] Acceptance Tests: log information when creating QEMUMachine Date: Thu, 11 Feb 2021 17:01:44 -0500 Message-Id: <20210211220146.2525771-5-crosa@redhat.com> In-Reply-To: <20210211220146.2525771-1-crosa@redhat.com> References: <20210211220146.2525771-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=crosa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=crosa@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Thomas Huth , Eduardo Habkost , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Max Reitz , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Willian Rampazzo , Cleber Rosa , John Snow , Beraldo Leal Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Including its base temporary directory, given that information useful for debugging can be put there. Signed-off-by: Cleber Rosa Reviewed-by: Wainer dos Santos Moschetta --- tests/acceptance/avocado_qemu/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index b7ab836455..94b78fd7c8 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -170,10 +170,12 @@ class Test(avocado.Test): if self.qemu_bin is None: self.cancel("No QEMU binary defined or found in the build tree= ") =20 - def _new_vm(self, *args): + def _new_vm(self, name, *args): self._sd =3D tempfile.TemporaryDirectory(prefix=3D"avo_qemu_sock_") vm =3D QEMUMachine(self.qemu_bin, base_temp_dir=3Dself.workdir, sock_dir=3Dself._sd.name) + self.log.debug('QEMUMachine "%s" created', name) + self.log.debug('QEMUMachine "%s" temp_dir: %s', name, vm.temp_dir) if args: vm.add_args(*args) return vm @@ -186,7 +188,7 @@ class Test(avocado.Test): if not name: name =3D str(uuid.uuid4()) if self._vms.get(name) is None: - self._vms[name] =3D self._new_vm(*args) + self._vms[name] =3D self._new_vm(name, *args) if self.machine is not None: self._vms[name].set_machine(self.machine) return self._vms[name] --=20 2.25.4 From nobody Tue Nov 18 22:49:05 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613081650; cv=none; d=zohomail.com; s=zohoarc; b=dS4co3sv4hlj7eJ2GvtrBPqCNEAVJVyhkCyMgzW+RQTjr2byHqn1JYl/NIlw1QrYbABbK7DyTL6RLeFcflcImLRkZHQubRNg0a+aty6fj8sdLd66S1uTY/FQXat0vfHqBx17a5OiHAxslV6n2mpZrVZciD7zZByVHb/hfRuEMYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613081650; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TjEC9/TWTifhRBKcNMnScuvudzgCc5d9yFgX3n1Q9QE=; b=gCIXn5bQIW/jPrFwe/BOTPSuJpBA0/ko+OO2hNctsLC+K4jy3WMg8mKXxTTL77u5qcCbBFSHruU6QAd/4h5CUohzRi4KsmX1Jjs0omZoFI6hc3ect/wdXAGfQCnRtz15iISzQtrzZF8sEkm4Fso3J1CSwSPaZH+epQPH5PNIrHo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1613081649994118.89919270574671; Thu, 11 Feb 2021 14:14:09 -0800 (PST) Received: from localhost ([::1]:38562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAKDx-0001Sa-0F for importer@patchew.org; Thu, 11 Feb 2021 17:14:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAK2K-0000Uf-Fj for qemu-devel@nongnu.org; Thu, 11 Feb 2021 17:02:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:37003) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAK2I-0005x4-3B for qemu-devel@nongnu.org; Thu, 11 Feb 2021 17:02:08 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-510-GO4QCnm9PL2NI7HSUIkaZw-1; Thu, 11 Feb 2021 17:02:01 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 677201005501; Thu, 11 Feb 2021 22:02:00 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-89.rdu2.redhat.com [10.10.116.89]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E5EB60BF1; Thu, 11 Feb 2021 22:01:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613080925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TjEC9/TWTifhRBKcNMnScuvudzgCc5d9yFgX3n1Q9QE=; b=RIwX7Von4G3Hzx86EtwdSprIOR3LHdH6e8ANtWsqwhI5kX/lJvfqxSt1RIkIdN12UIOtMM AWYgOjgyW+jHKf1RlJDrkG7//pNQoq5cqZiri1yGsLDk1JSXBLWcSTDHhDIzI/sd8iI+a1 FjGl6j/ViHd0hwf9SJXvdw3MBwMNOp8= X-MC-Unique: GO4QCnm9PL2NI7HSUIkaZw-1 From: Cleber Rosa To: qemu-devel@nongnu.org Subject: [PATCH 5/6] Acceptance Tests: distinguish between temp and logs dir Date: Thu, 11 Feb 2021 17:01:45 -0500 Message-Id: <20210211220146.2525771-6-crosa@redhat.com> In-Reply-To: <20210211220146.2525771-1-crosa@redhat.com> References: <20210211220146.2525771-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=crosa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=crosa@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Thomas Huth , Eduardo Habkost , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Max Reitz , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Willian Rampazzo , Cleber Rosa , John Snow , Beraldo Leal Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Logs can be very important to debug issues, and currently QEMUMachine instances will remove logs that are created under the temporary directories. With this change, the stdout and stderr generated by the QEMU process started by QEMUMachine will always be kept along the test results directory. Signed-off-by: Cleber Rosa Reviewed-by: Wainer dos Santos Moschetta --- python/qemu/machine.py | 16 ++++++++++++++-- tests/acceptance/avocado_qemu/__init__.py | 3 ++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/python/qemu/machine.py b/python/qemu/machine.py index b379fcbe72..1f4119e2b4 100644 --- a/python/qemu/machine.py +++ b/python/qemu/machine.py @@ -89,7 +89,8 @@ class QEMUMachine: socket_scm_helper: Optional[str] =3D None, sock_dir: Optional[str] =3D None, drain_console: bool =3D False, - console_log: Optional[str] =3D None): + console_log: Optional[str] =3D None, + log_dir: Optional[str] =3D None): ''' Initialize a QEMUMachine =20 @@ -103,6 +104,7 @@ class QEMUMachine: @param sock_dir: where to create socket (defaults to base_temp_dir) @param drain_console: (optional) True to drain console socket to b= uffer @param console_log: (optional) path to console log file + @param log_dir: where to create and keep log files @note: Qemu process is not started until launch() is used. ''' # Direct user configuration @@ -114,6 +116,7 @@ class QEMUMachine: self._name =3D name or "qemu-%d" % os.getpid() self._base_temp_dir =3D base_temp_dir self._sock_dir =3D sock_dir or self._base_temp_dir + self._log_dir =3D log_dir self._socket_scm_helper =3D socket_scm_helper =20 if monitor_address is not None: @@ -303,7 +306,7 @@ class QEMUMachine: return args =20 def _pre_launch(self) -> None: - self._qemu_log_path =3D os.path.join(self.temp_dir, self._name + "= .log") + self._qemu_log_path =3D os.path.join(self.log_dir, self._name + ".= log") self._qemu_log_file =3D open(self._qemu_log_path, 'wb') =20 if self._console_set: @@ -752,3 +755,12 @@ class QEMUMachine: self._temp_dir =3D tempfile.mkdtemp(prefix=3D"qemu-machine-", dir=3Dself._base_temp_dir) return self._temp_dir + + @property + def log_dir(self) -> str: + """ + Returns a directory to be used for writing logs + """ + if self._log_dir is None: + return self.temp_dir + return self._log_dir diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index 94b78fd7c8..ac9be1eb66 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -173,9 +173,10 @@ class Test(avocado.Test): def _new_vm(self, name, *args): self._sd =3D tempfile.TemporaryDirectory(prefix=3D"avo_qemu_sock_") vm =3D QEMUMachine(self.qemu_bin, base_temp_dir=3Dself.workdir, - sock_dir=3Dself._sd.name) + sock_dir=3Dself._sd.name, log_dir=3Dself.logdir) self.log.debug('QEMUMachine "%s" created', name) self.log.debug('QEMUMachine "%s" temp_dir: %s', name, vm.temp_dir) + self.log.debug('QEMUMachine "%s" log_dir: %s', name, vm.log_dir) if args: vm.add_args(*args) return vm --=20 2.25.4 From nobody Tue Nov 18 22:49:05 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613081153; cv=none; d=zohomail.com; s=zohoarc; b=iCgG7MU6WcgSBJ104zzmG2X7mqbwx7fp/q43aJ8joU0h566d19nu3RL6DzZl0shcYFZPt7zZWzS7c2DwfQxvfeulxvOZUJcm9zfuct7ZcsTX3fUgFhvTe5yPTrYKHzH8CMva9TrBSqMY9TIY9cenB1zGY0XXBa4t4qdJWP0tP4Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613081153; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SlhHStAinmCUFo//cctDevALFMpnYh+X/wYNb7Rpf5s=; b=LZT6ajNntlfOKac5FrxFUBWNFO8TuH5hs55rY56p2hAab1Pv8wfybP8GBfYdP09KD2zEHlEP2Ur4FY4NQdxhtnie2Icrosd8qhE+GsLUt5+9vL66LMjVM7RrgwFx6lIPaIkcZZGU/yj5QbH7wqoJz5rrK9b+aCuP3apj+xeAPhA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16130811526931012.7017965399914; Thu, 11 Feb 2021 14:05:52 -0800 (PST) Received: from localhost ([::1]:50882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAK5v-0002ii-JH for importer@patchew.org; Thu, 11 Feb 2021 17:05:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAK2K-0000W0-VB for qemu-devel@nongnu.org; Thu, 11 Feb 2021 17:02:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:27216) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAK2H-0005wu-La for qemu-devel@nongnu.org; Thu, 11 Feb 2021 17:02:08 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-220-oaTV2QEONb2azJIeVdswtQ-1; Thu, 11 Feb 2021 17:02:02 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D9248100CCCC; Thu, 11 Feb 2021 22:02:01 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-89.rdu2.redhat.com [10.10.116.89]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C8F860BF1; Thu, 11 Feb 2021 22:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613080924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SlhHStAinmCUFo//cctDevALFMpnYh+X/wYNb7Rpf5s=; b=ZtNKLB9kIOFqEOtjOAvtJXlcByu3CnMZgrvacfAAtdpPisExJaHECQfDjGpTmK4cGVTLJ/ jtEReeQ8br7Y1ih5hc6QPC5HTTrS/wODe+pO+tXSgQfAnLBrEgo1WjDcwNabPYu1VNuyMU 2X5+uj54YyG+TtmuAvaRM2XEnoqYFVo= X-MC-Unique: oaTV2QEONb2azJIeVdswtQ-1 From: Cleber Rosa To: qemu-devel@nongnu.org Subject: [PATCH 6/6] tests/acceptance/virtio-gpu.py: preserve virtio-user-gpu log Date: Thu, 11 Feb 2021 17:01:46 -0500 Message-Id: <20210211220146.2525771-7-crosa@redhat.com> In-Reply-To: <20210211220146.2525771-1-crosa@redhat.com> References: <20210211220146.2525771-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=crosa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=crosa@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Thomas Huth , Eduardo Habkost , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Max Reitz , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Willian Rampazzo , Cleber Rosa , John Snow , Beraldo Leal Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" At location already prepared for keeping the test's log files. While at it, log info about its location (in the main test log file), instead of printing it out. Reference: https://avocado-framework.readthedocs.io/en/85.0/api/test/avocad= o.html#avocado.Test.logdir Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Wainer dos Santos Moschetta --- tests/acceptance/virtio-gpu.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/virtio-gpu.py b/tests/acceptance/virtio-gpu.py index 8d689eb820..ab1a4c1a71 100644 --- a/tests/acceptance/virtio-gpu.py +++ b/tests/acceptance/virtio-gpu.py @@ -119,10 +119,11 @@ class VirtioGPUx86(Test): os.set_inheritable(vug_sock.fileno(), True) =20 self._vug_log_path =3D os.path.join( - self.vm.temp_dir, "vhost-user-gpu.log" + self.logdir, "vhost-user-gpu.log" ) self._vug_log_file =3D open(self._vug_log_path, "wb") - print(self._vug_log_path) + self.log.info('Complete vhost-user-gpu.log file can be ' + 'found at %s', self._vug_log_path) =20 vugp =3D subprocess.Popen( [vug, "--virgl", "--fd=3D%d" % vug_sock.fileno()], --=20 2.25.4