From patchwork Fri Jun 22 00:44:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 933020 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="dIXFIYx4"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41Bfxc3DQfz9s2R for ; Fri, 22 Jun 2018 10:45:39 +1000 (AEST) Received: from localhost ([::1]:58155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWACm-0003oO-5T for incoming@patchwork.ozlabs.org; Thu, 21 Jun 2018 20:45:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWAC1-0003mR-CY for qemu-devel@nongnu.org; Thu, 21 Jun 2018 20:44:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWABy-0000Dc-Qb for qemu-devel@nongnu.org; Thu, 21 Jun 2018 20:44:49 -0400 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:36555) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fWABy-0000DU-Ki for qemu-devel@nongnu.org; Thu, 21 Jun 2018 20:44:46 -0400 Received: by mail-qk0-x243.google.com with SMTP id a195-v6so2856719qkg.3 for ; Thu, 21 Jun 2018 17:44:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GFG/Hx66WsJ3IG9o67IU+jU3A/U51YN04exXJDQzsGU=; b=dIXFIYx4/zOe/PBYsypVAcRHcsckyJ2Pdbv70HCKrPwzh9U1ft5fcXEUIwzkpmC79z MgdhLzo6gT/xrgmkJwlyXcVbPTAtJzsyCYCOJipjBSLGUrqVRX2qBYNpHg4eV1ADWzsH 5FwLhN1cEclXLMAvNeP9arddzZ8WwDJpOWaSh/ih7LfHDIaJX/2oVM7gEB2CGYzHcRSR 8pmd/Gn3r0++52Pk+KB7fY2x4wM7vIiXtXG7hUIKNkO9xsUL1wr8Zljzn5ooXsFTEIVG EeywuL+mFk18lHiJkawOY/XUAPN3260Cx2eRgOL0zp6SFgTDWmIdp6DwCZ++dNEnhLga 60nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=GFG/Hx66WsJ3IG9o67IU+jU3A/U51YN04exXJDQzsGU=; b=iyoR56MD4/8PlXKebh2Ef3/WarXC4phIeBUFHXhqSsdPHKGTUz1fUK/qzOx1a51//X NQHJnnECTfwBhCEIA1ir1XcPkrYp1TXcvbx40hVKkV1KjgMcKRR5uM0cdTUIs19O54gC W3VyYZxetins5OhRDUaKujHtDrNPHeDonIRkTJ7arhKvdE1c5noGiVmN+KoBtSCXvZch /frehRech56xTBNR0Ur4OcnaqiMD3C+Z+2e17R3eFGqXOcGHEEuu9btRNLSQMGPV65TP KgsgdCYz/C24yplihTJRXIhWBcbS3dQcgDN/y7sg4y1ZcCpEX2buQqOHGKp+49/BhdMX Bbuw== X-Gm-Message-State: APt69E04x/2IoMrBVf55DKGwlPmaPsNBzRBWHqtvf6Pk4NlE4cx1wSu7 akHQdLgT5vVIsxD1+rSxt+E= X-Google-Smtp-Source: ADUXVKL+VvVMnSSdUCZyQGf3fNsHFsZghvuthh2kG5dzZR5rtNIRel8EuwjdPmtgGqi0LyENZE06Ig== X-Received: by 2002:a37:66c5:: with SMTP id a188-v6mr23741989qkc.201.1529628286084; Thu, 21 Jun 2018 17:44:46 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id b14-v6sm3891653qtp.26.2018.06.21.17.44.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jun 2018 17:44:45 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: =?utf-8?q?Alex_Benn=C3=A9e?= , Cleber Rosa , Eduardo Habkost Date: Thu, 21 Jun 2018 21:44:30 -0300 Message-Id: <20180622004435.10291-2-f4bug@amsat.org> X-Mailer: git-send-email 2.18.0.rc2 In-Reply-To: <20180622004435.10291-1-f4bug@amsat.org> References: <20180622004435.10291-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::243 Subject: [Qemu-devel] [RFC PATCH v2 1/6] avocado: Add a Test.arch property 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: Fam Zheng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Tests can change this property to run tests in other architectures than the host one. Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/avocado_qemu/__init__.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 1e54fd5932..6e9601f5e9 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -13,6 +13,7 @@ import sys import avocado +HOST_ARCH = os.uname()[4] SRC_ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) SRC_ROOT_DIR = os.path.abspath(os.path.dirname(SRC_ROOT_DIR)) sys.path.append(os.path.join(SRC_ROOT_DIR, 'scripts')) @@ -23,12 +24,11 @@ def is_readable_executable_file(path): return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK) -def pick_default_qemu_bin(): +def pick_default_qemu_bin(arch): """ Picks the path of a QEMU binary, starting either in the current working directory or in the source tree root directory. """ - arch = os.uname()[4] qemu_bin_relative_path = os.path.join("%s-softmmu" % arch, "qemu-system-%s" % arch) if is_readable_executable_file(qemu_bin_relative_path): @@ -41,10 +41,19 @@ def pick_default_qemu_bin(): class Test(avocado.Test): + _arch = HOST_ARCH + + @property + def arch(self): + """ + Returns the architecture required to run the current test + """ + return self._arch + def setUp(self): self.vm = None - self.qemu_bin = self.params.get('qemu_bin', - default=pick_default_qemu_bin()) + qemu_bin = pick_default_qemu_bin(self.arch) + self.qemu_bin = self.params.get('qemu_bin', default=qemu_bin) if self.qemu_bin is None: self.cancel("No QEMU binary defined or found in the source tree") self.vm = QEMUMachine(self.qemu_bin)