From nobody Tue Feb 10 06:07:41 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654527540; cv=none; d=zohomail.com; s=zohoarc; b=gKxupgwQ/ELJRAktrPDb9CKCcQB9yxRvl8bS0WliPdjVIYK/SnoZ/VDVxmvBmDeCKckRlbjWEoupQlOd84cJtm9qwev9sl0tBebKlDKfQD7smH7X3lDCnp7Z2OuYBcwAJAlYw34UEorkovF2Cm+Y4gyrQIWlDT1sCMKazOrZsd4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654527540; 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=j6MAMxnLiI0ZXMoEaI2ox4+MmiSbU8k7mfpEeYwLCTE=; b=FjbpwGNMJFxG7gM6C3Qg7T77RH+kcJHxUkyD9QaCsAs/8hp/MvOojix0qGRDsq5S5AI8/XarJqVDKaQCJd3AcH0mEtdH+65jM3Z7Cyp1pJq6v904Fe8xZml/HjT1r6Y79ozWIgbJznxMbFkGFmv+Ydcm9Ogt6Nf8t0+MRI67OFQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654527540273332.1231549641552; Mon, 6 Jun 2022 07:59:00 -0700 (PDT) Received: from localhost ([::1]:39464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyEC3-0007MK-1C for importer@patchew.org; Mon, 06 Jun 2022 10:58:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyDrL-0002a0-Nt for qemu-devel@nongnu.org; Mon, 06 Jun 2022 10:37:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31434) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyDrJ-0000eI-NI for qemu-devel@nongnu.org; Mon, 06 Jun 2022 10:37:35 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-484-5DayqEyfPZ6D0vUVm1tWJA-1; Mon, 06 Jun 2022 10:37:32 -0400 Received: by mail-wr1-f72.google.com with SMTP id p8-20020a5d4588000000b0021033f1f79aso2883890wrq.5 for ; Mon, 06 Jun 2022 07:37:31 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id c9-20020adfe749000000b002108ab90e5asm15653282wrn.58.2022.06.06.07.37.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 07:37:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654526253; 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=j6MAMxnLiI0ZXMoEaI2ox4+MmiSbU8k7mfpEeYwLCTE=; b=Q56ZbiPvJsdnobAvn0eIQrBUg9ME/VwIusIUEtxcJJBQkPdTdJeDJ1Bmfx5wj6FLeG95cc vm5j27H9Sqx80sx3ekqcHp9fcRk3957sfeUjgXiSAdYt++CboTlEsZnVpiMsHOmrr0ILzz Agu2IB9nVowPC2wVfBn15PpJeZj7vuw= X-MC-Unique: 5DayqEyfPZ6D0vUVm1tWJA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=j6MAMxnLiI0ZXMoEaI2ox4+MmiSbU8k7mfpEeYwLCTE=; b=VwrbGZwdLYC+02JHI71ihrRUY3QuTjBlCJHdLh7L7MgElpngrgu8ZZNFcnnX4urW+E P/MwKeTnCQ3q4WjJZom5TLjtfF8WFIitBYE1DvcL8vQn+43f9D4lXUz/vbQpg2gzMZtL bKl5Ov1a3XeZa9MuwnO9ozsdL6sR+E6zPggpr2UX6bUzsOwpVPLa9m4yX0D6fsVhvArD QZI45Qbn3bmNz+h+3CkQcymlONYZpxX5ve2vWco2KJmUoPaybh58+p3aNNhuGwXdk/bC WiwatWZ+msw6icYdHntN/V8uZQKi6gcnVE/KXh76UBMm4C8K2BCHaItnRbEByzFDZH4f Z0ew== X-Gm-Message-State: AOAM531ZADhM9yvJvuAci0o0HPzqVCxnRXSRQ1ph4y/j4IptsuQuLZ4d c8PLz9a2UcngPuXu3xvazWEMKD0gsl25LvdJg8X1Q6A6zw9MJf9j3sgeoVvHu63K5BfDPdqJ/WB +kj0/TcVj+Eyo6MdYoKbGm2qjZzg0Hk9bY4Ws7oq07otxliDOkDSSR5vpKw5KzwPZblw= X-Received: by 2002:a5d:40c5:0:b0:216:ddde:9c2e with SMTP id b5-20020a5d40c5000000b00216ddde9c2emr10067429wrq.241.1654526250316; Mon, 06 Jun 2022 07:37:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzeoZAs5CngK7VqHNnwXy2MVz66/VNhoKvse+DecdH55rlfYSrX8lMHhsW47DyYPYnHZ5Iog== X-Received: by 2002:a5d:40c5:0:b0:216:ddde:9c2e with SMTP id b5-20020a5d40c5000000b00216ddde9c2emr10067394wrq.241.1654526249937; Mon, 06 Jun 2022 07:37:29 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: John Snow Subject: [PULL 23/29] tests: install "qemu" namespace package into venv Date: Mon, 6 Jun 2022 16:36:38 +0200 Message-Id: <20220606143644.1151112-24-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220606143644.1151112-1-pbonzini@redhat.com> References: <20220606143644.1151112-1-pbonzini@redhat.com> MIME-Version: 1.0 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=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654527541818100001 Content-Type: text/plain; charset="utf-8" From: John Snow This patch adds the "qemu" namespace package to the $build/tests/venv directory. It does so in "editable" mode, which means that changes to the source python directory will actively be reflected by the venv. This patch also then removes any sys.path hacking from the avocado test scripts directly. By doing this, the environment of where to find these packages is managed entirely by the virtual environment and not by the scripts themselves. Signed-off-by: John Snow Reviewed-by: Paolo Bonzini Message-Id: <20220526000921.1581503-7-jsnow@redhat.com> Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 1 + tests/avocado/avocado_qemu/__init__.py | 11 +++++------ tests/avocado/virtio_check_params.py | 1 - tests/avocado/virtio_version.py | 1 - tests/requirements.txt | 1 + 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index fa46c0c61b..3accb83b13 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -110,6 +110,7 @@ quiet-venv-pip =3D $(quiet-@)$(call quiet-command-run, \ =20 $(TESTS_VENV_DIR): $(TESTS_VENV_REQ) $(call quiet-command, $(PYTHON) -m venv $@, VENV, $@) + $(call quiet-venv-pip,install -e "$(SRC_PATH)/python/") $(call quiet-venv-pip,install -r $(TESTS_VENV_REQ)) $(call quiet-command, touch $@) =20 diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado= _qemu/__init__.py index 39f15c1d51..b656a70c55 100644 --- a/tests/avocado/avocado_qemu/__init__.py +++ b/tests/avocado/avocado_qemu/__init__.py @@ -21,6 +21,11 @@ from avocado.utils import cloudinit, datadrainer, process, ssh, vmimage from avocado.utils.path import find_command =20 +from qemu.machine import QEMUMachine +from qemu.utils import (get_info_usernet_hostfwd_port, kvm_available, + tcg_available) + + #: The QEMU build root directory. It may also be the source directory #: if building from the source dir, but it's safer to use BUILD_DIR for #: that purpose. Be aware that if this code is moved outside of a source @@ -35,12 +40,6 @@ else: SOURCE_DIR =3D BUILD_DIR =20 -sys.path.append(os.path.join(SOURCE_DIR, 'python')) - -from qemu.machine import QEMUMachine -from qemu.utils import (get_info_usernet_hostfwd_port, kvm_available, - tcg_available) - =20 def has_cmd(name, args=3DNone): """ diff --git a/tests/avocado/virtio_check_params.py b/tests/avocado/virtio_ch= eck_params.py index e869690473..4093da8a67 100644 --- a/tests/avocado/virtio_check_params.py +++ b/tests/avocado/virtio_check_params.py @@ -22,7 +22,6 @@ import re import logging =20 -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) from qemu.machine import QEMUMachine from avocado_qemu import QemuSystemTest from avocado import skip diff --git a/tests/avocado/virtio_version.py b/tests/avocado/virtio_version= .py index 208910bb84..c84e48813a 100644 --- a/tests/avocado/virtio_version.py +++ b/tests/avocado/virtio_version.py @@ -11,7 +11,6 @@ import sys import os =20 -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) from qemu.machine import QEMUMachine from avocado_qemu import QemuSystemTest =20 diff --git a/tests/requirements.txt b/tests/requirements.txt index a21b59b443..0ba561b6bd 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,5 +1,6 @@ # 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 +# Note that qemu.git/python/ is always implicitly installed. avocado-framework=3D=3D88.1 pycdlib=3D=3D1.11.0 --=20 2.36.1