From nobody Wed Nov 12 13:27:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.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=1570721265; cv=none; d=zoho.com; s=zohoarc; b=dUmKz/nnyr7MgOSg7TfoFwmkhxpZab73B0wesIExKLy8f7BDIyk3JHopWCil9vgP8dp597oW4N8hRp636VLyMwtp+zSGSH8gvTX6XMFFqkBXqsoqa6Ib5eBS6zHZM+wBtxlxYuzLL6IjkJm2ev7X685M11EEDYC8/sRMx2l1b7Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570721265; h=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=Al5gjY8F9UlYfBicxtxzGtH0d0dEwHuhFY6RmnOs17c=; b=Ilzs1wmS+YZM1xAmskc08WnrvlF2Zvo0CbbFHI2n5o2rwFI1rWkTnNpPYcEtTsMnXrHtlEIewLKPcUvj/2exppE5GRyV+L4GM58BHLkKsR9a9PFrf0XVUAUPrYsP05Xoc5NHSrcpvTip782Sz2lZwNSG6z+vhoc2Evk77uWtZLI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.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 1570721265210639.1310684508206; Thu, 10 Oct 2019 08:27:45 -0700 (PDT) Received: from localhost ([::1]:41110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIaLr-0007yh-3E for importer@patchew.org; Thu, 10 Oct 2019 11:27:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60489) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIaJV-0005mB-S6 for qemu-devel@nongnu.org; Thu, 10 Oct 2019 11:25:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iIaJT-0004JX-VC for qemu-devel@nongnu.org; Thu, 10 Oct 2019 11:25:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46070) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iIaJQ-0004Ge-06; Thu, 10 Oct 2019 11:25:08 -0400 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 mx1.redhat.com (Postfix) with ESMTPS id 6F2033086E22; Thu, 10 Oct 2019 15:25:06 +0000 (UTC) Received: from localhost (unknown [10.36.118.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4F7160BE1; Thu, 10 Oct 2019 15:25:05 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH 02/23] iotests.py: Store socket files in $SOCK_DIR Date: Thu, 10 Oct 2019 17:24:36 +0200 Message-Id: <20191010152457.17713-3-mreitz@redhat.com> In-Reply-To: <20191010152457.17713-1-mreitz@redhat.com> References: <20191010152457.17713-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 10 Oct 2019 15:25:06 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 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 , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" iotests.py itself does not store socket files, but it machine.py and qtest.py do. iotests.py needs to pass the respective path to them, and they need to adhere to it. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Thomas Huth --- python/qemu/machine.py | 15 ++++++++++++--- python/qemu/qtest.py | 9 ++++++--- tests/qemu-iotests/iotests.py | 4 +++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/python/qemu/machine.py b/python/qemu/machine.py index 128a3d1dc2..2024e8b1b1 100644 --- a/python/qemu/machine.py +++ b/python/qemu/machine.py @@ -71,7 +71,7 @@ class QEMUMachine(object): =20 def __init__(self, binary, args=3DNone, wrapper=3DNone, name=3DNone, test_dir=3D"/var/tmp", monitor_address=3DNone, - socket_scm_helper=3DNone): + socket_scm_helper=3DNone, sock_dir=3DNone): ''' Initialize a QEMUMachine =20 @@ -90,6 +90,8 @@ class QEMUMachine(object): wrapper =3D [] if name is None: name =3D "qemu-%d" % os.getpid() + if sock_dir is None: + sock_dir =3D test_dir self._name =3D name self._monitor_address =3D monitor_address self._vm_monitor =3D None @@ -106,12 +108,14 @@ class QEMUMachine(object): self._qemu_full_args =3D None self._test_dir =3D test_dir self._temp_dir =3D None + self._sock_dir =3D sock_dir self._launched =3D False self._machine =3D None self._console_set =3D False self._console_device_type =3D None self._console_address =3D None self._console_socket =3D None + self._remove_files =3D [] =20 # just in case logging wasn't configured by the main script: logging.basicConfig() @@ -236,8 +240,9 @@ class QEMUMachine(object): if self._machine is not None: args.extend(['-machine', self._machine]) if self._console_set: - self._console_address =3D os.path.join(self._temp_dir, + self._console_address =3D os.path.join(self._sock_dir, self._name + "-console.so= ck") + self._remove_files.append(self._console_address) chardev =3D ('socket,id=3Dconsole,path=3D%s,server,nowait' % self._console_address) args.extend(['-chardev', chardev]) @@ -253,8 +258,9 @@ class QEMUMachine(object): if self._monitor_address is not None: self._vm_monitor =3D self._monitor_address else: - self._vm_monitor =3D os.path.join(self._temp_dir, + self._vm_monitor =3D os.path.join(self._sock_dir, self._name + "-monitor.sock") + self._remove_files.append(self._vm_monitor) 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 @@ -279,6 +285,9 @@ class QEMUMachine(object): shutil.rmtree(self._temp_dir) self._temp_dir =3D None =20 + while len(self._remove_files) > 0: + self._remove_if_exists(self._remove_files.pop()) + def launch(self): """ Launch the VM and make sure we cleanup and expose the diff --git a/python/qemu/qtest.py b/python/qemu/qtest.py index 3f1d2cb325..d24ad04256 100644 --- a/python/qemu/qtest.py +++ b/python/qemu/qtest.py @@ -84,14 +84,17 @@ class QEMUQtestMachine(QEMUMachine): '''A QEMU VM''' =20 def __init__(self, binary, args=3DNone, name=3DNone, test_dir=3D"/var/= tmp", - socket_scm_helper=3DNone): + socket_scm_helper=3DNone, sock_dir=3DNone): if name is None: name =3D "qemu-%d" % os.getpid() + if sock_dir is None: + sock_dir =3D test_dir super(QEMUQtestMachine, self).__init__(binary, args, name=3Dname, test_dir=3Dtest_di= r, - socket_scm_helper=3Dsocket_scm_helper) + socket_scm_helper=3Dsocket_scm_helper, + sock_dir=3Dsock_dir) self._qtest =3D None - self._qtest_path =3D os.path.join(test_dir, name + "-qtest.sock") + self._qtest_path =3D os.path.join(sock_dir, name + "-qtest.sock") =20 def _base_args(self): args =3D super(QEMUQtestMachine, self)._base_args() diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 3a8f378f90..49cd205a97 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -57,6 +57,7 @@ qemu_opts =3D os.environ.get('QEMU_OPTIONS', '').strip().= split(' ') imgfmt =3D os.environ.get('IMGFMT', 'raw') imgproto =3D os.environ.get('IMGPROTO', 'file') test_dir =3D os.environ.get('TEST_DIR') +sock_dir =3D os.environ.get('SOCK_DIR') output_dir =3D os.environ.get('OUTPUT_DIR', '.') cachemode =3D os.environ.get('CACHEMODE') qemu_default_machine =3D os.environ.get('QEMU_DEFAULT_MACHINE') @@ -445,7 +446,8 @@ class VM(qtest.QEMUQtestMachine): name =3D "qemu%s-%d" % (path_suffix, os.getpid()) super(VM, self).__init__(qemu_prog, qemu_opts, name=3Dname, test_dir=3Dtest_dir, - socket_scm_helper=3Dsocket_scm_helper) + socket_scm_helper=3Dsocket_scm_helper, + sock_dir=3Dsock_dir) self._num_drives =3D 0 =20 def add_object(self, opts): --=20 2.21.0