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: 985034 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=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42ZWYy3TCfz9s8r for ; Wed, 17 Oct 2018 10:22:45 +1100 (AEDT) Received: from localhost ([::1]:60565 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCYfi-0001Nn-8i for incoming@patchwork.ozlabs.org; Tue, 16 Oct 2018 19:22:42 -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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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):