From patchwork Mon Nov 4 15:13:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 1188992 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="DYlwsZzP"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 476GgL15Nyz9sPL for ; Tue, 5 Nov 2019 02:19:42 +1100 (AEDT) Received: from localhost ([::1]:34444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRe8p-00005E-L5 for incoming@patchwork.ozlabs.org; Mon, 04 Nov 2019 10:19:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40481) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRe3K-0002ma-7E for qemu-devel@nongnu.org; Mon, 04 Nov 2019 10:13:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iRe3J-0002ik-36 for qemu-devel@nongnu.org; Mon, 04 Nov 2019 10:13:58 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:27315 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iRe3I-0002iH-Vt for qemu-devel@nongnu.org; Mon, 04 Nov 2019 10:13:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572880436; 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=U0xLuW7dxW0/vpxUgGUMzkeq0r++XbA8BvBA+hcvGFM=; b=DYlwsZzPHJ4+/DB0gg5/hT52GAlk6f6E80iQJbyz1nAu1XsB23irOZy4cKKZ3KGNaIHqsa QEw5o8qzz7RWNCD+MotKnWGTGCugSHzUTaTPvCNXIrhIuAyUmWUvBrNLMJO5cX2K5xUciV tGffse8BjhBVPAPbV2WVCSp80wcWL5E= 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-390-anljG6vVMFGhNcd2sWOuRQ-1; Mon, 04 Nov 2019 10:13:53 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D7136107ACC2; Mon, 4 Nov 2019 15:13:51 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-123-183.rdu2.redhat.com [10.10.123.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BCAC05D6C5; Mon, 4 Nov 2019 15:13:44 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Subject: [PATCH v7 5/8] Acceptance tests: keep a stable reference to the QEMU build dir Date: Mon, 4 Nov 2019 10:13:20 -0500 Message-Id: <20191104151323.9883-6-crosa@redhat.com> In-Reply-To: <20191104151323.9883-1-crosa@redhat.com> References: <20191104151323.9883-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: anljG6vVMFGhNcd2sWOuRQ-1 X-Mimecast-Spam-Score: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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: Beraldo Leal , Fabien Chouteau , KONRAD Frederic , =?utf-8?b?SGVydsOpIFBv?= =?utf-8?q?ussineau?= , Wainer dos Santos Moschetta , Willian Rampazzo , Cleber Rosa , qemu-ppc@nongnu.org, Aleksandar Rikalo , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Aurelien Jarno , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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/avocado_qemu/__init__.py index 6618ea67c1..17ce583c87 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -16,7 +16,7 @@ import tempfile import avocado -SRC_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..', '..', '..') +SRC_ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(SRC_ROOT_DIR, 'python')) from qemu.machine import QEMUMachine