From nobody Mon Feb 9 04:03:25 2026 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552510090517381.3180341640044; Wed, 13 Mar 2019 13:48:10 -0700 (PDT) Received: from localhost ([127.0.0.1]:50660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4AnH-0000ol-9M for importer@patchew.org; Wed, 13 Mar 2019 16:48:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4Ala-0008Lw-Lz for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h4AlZ-0000yv-F3 for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54998) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h4AlZ-0000y9-55 for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:21 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 58526307E04C; Wed, 13 Mar 2019 20:46:20 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-121-71.rdu2.redhat.com [10.10.121.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6238D5F9D7; Wed, 13 Mar 2019 20:46:19 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 16:46:08 -0400 Message-Id: <20190313204611.21041-3-crosa@redhat.com> In-Reply-To: <20190313204611.21041-1-crosa@redhat.com> References: <20190313204611.21041-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 13 Mar 2019 20:46:20 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 2/5] Acceptance tests: keep a stable reference to the QEMU build dir X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Ortiz , Cornelia Huck , Wainer dos Santos Moschetta , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This is related to the the differences in in-tree and out-of-tree builds in QEMU. For simplification, means my build directory. Currently, by running a `make check-acceptance` one gets (in tests/acceptance/avocado_qemu/__init__.py): SRC_ROOT_DIR: /tests/acceptance/avocado_qemu/../../.. This in itself is problematic, because after the parent directories are applied, one may be left not with a pointer to the build directory as intended, but with the location of the source tree (assuming they differ). Built binaries, such as qemu-img, are of course not there and can't be found. Given that a Python '__file__' will contain the absolute path to the file backing the module, say: __file__: /tests/acceptance/avocado_qemu/__init__.py | 4 | 3 | 2 | 1 | A solution is to not "evaluate" the third parent dir (marked as 4 here) because that ends up following the "tests" directory symlink to the source tree. In fact, there's no need to keep or evaluate any of the parent directories, we can just drop the rightmost 4 components, and we'll keep a stable reference to the build directory (with no symlink being followed). This works for either a dedicated build directory or also a combined source and build tree. Signed-off-by: Cleber Rosa --- tests/acceptance/avocado_qemu/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index a66ec72daa..7b5d828584 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -14,7 +14,7 @@ import uuid =20 import avocado =20 -SRC_ROOT_DIR =3D os.path.join(os.path.dirname(__file__), '..', '..', '..') +SRC_ROOT_DIR =3D os.path.dirname(os.path.dirname(os.path.dirname(os.path.d= irname(__file__)))) sys.path.append(os.path.join(SRC_ROOT_DIR, 'python')) =20 from qemu import QEMUMachine --=20 2.20.1