From patchwork Tue Oct 16 23:22:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 10644313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C2F271057 for ; Tue, 16 Oct 2018 23:23:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A320C2A7A1 for ; Tue, 16 Oct 2018 23:23:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9157F2A9E2; Tue, 16 Oct 2018 23:23:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 27DAC2A7A1 for ; Tue, 16 Oct 2018 23:23:04 +0000 (UTC) Received: from localhost ([::1]:60567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCYg3-0001uG-RS for patchwork-qemu-devel@patchwork.kernel.org; Tue, 16 Oct 2018 19:23:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCYfK-0001Mc-4v for qemu-devel@nongnu.org; Tue, 16 Oct 2018 19:22:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCYfF-0007i5-6A for qemu-devel@nongnu.org; Tue, 16 Oct 2018 19:22:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56186) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gCYfE-0007aR-4O for qemu-devel@nongnu.org; Tue, 16 Oct 2018 19:22:12 -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 2FA59CD185 for ; Tue, 16 Oct 2018 23:22:11 +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 5ED5319680; Tue, 16 Oct 2018 23:22:03 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Tue, 16 Oct 2018 19:22:01 -0400 Message-Id: <20181016232201.16829-1-crosa@redhat.com> 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.38]); Tue, 16 Oct 2018 23:22:11 +0000 (UTC) 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] Acceptance tests: host arch to target arch name mapping 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: Cleber Rosa , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Wainer dos Santos Moschetta , Caio Carrara Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The host arch name is not always the target arch name, so it's necessary to have a mapping. The configure scripts contains what is the authoritative and failproof mapping, but, reusing it is not straightforward, so it's replicated in the acceptance tests supporting code. Signed-off-by: Cleber Rosa --- configure | 2 ++ tests/acceptance/avocado_qemu/__init__.py | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/configure b/configure index 8af2be959f..e029b756d4 100755 --- a/configure +++ b/configure @@ -6992,6 +6992,8 @@ TARGET_ARCH="$target_name" TARGET_BASE_ARCH="" TARGET_ABI_DIR="" +# When updating target_name => TARGET_ARCH, please also update the +# HOST_TARGET_ARCH mapping in tests/acceptance/avocado_qemu/__init__.py case "$target_name" in i386) mttcg="yes" diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 1e54fd5932..d9bc4736ec 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -19,6 +19,28 @@ sys.path.append(os.path.join(SRC_ROOT_DIR, 'scripts')) from qemu import QEMUMachine + +#: Mapping of host arch names to target arch names. It's expected that the +#: arch identification on the host, using os.uname()[4], would return the +#: key (LHS). The QEMU target name, and consequently the target binary, would +#: be based on the name on the value (RHS). +HOST_TARGET_ARCH = { + 'armeb': 'arm', + 'aarch64_be': 'aarch64', + 'microblazeel': 'microblaze', + 'mipsel': 'mips', + 'mipsn32el' : 'mips64', + 'mips64el': 'mips64', + 'or1k': 'openrisc', + 'ppc64le': 'ppc64', + 'ppc64abi32': 'ppc64', + 'riscv64': 'riscv', + 'sh4eb': 'sh4', + 'sparc32plus': 'sparc64', + 'xtensaeb': 'xtensa' + } + + def is_readable_executable_file(path): return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK) @@ -29,6 +51,7 @@ def pick_default_qemu_bin(): directory or in the source tree root directory. """ arch = os.uname()[4] + arch = HOST_TARGET_ARCH.get(arch, arch) qemu_bin_relative_path = os.path.join("%s-softmmu" % arch, "qemu-system-%s" % arch) if is_readable_executable_file(qemu_bin_relative_path):