From patchwork Tue Apr 14 22:52:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Baker X-Patchwork-Id: 6218441 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 295429F1C4 for ; Tue, 14 Apr 2015 22:57:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D00720351 for ; Tue, 14 Apr 2015 22:57:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 879F02034F for ; Tue, 14 Apr 2015 22:57:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yi9jJ-0007vs-J1; Tue, 14 Apr 2015 22:54:53 +0000 Received: from mail-pa0-f44.google.com ([209.85.220.44]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yi9hr-0006xR-Rg for linux-arm-kernel@lists.infradead.org; Tue, 14 Apr 2015 22:53:24 +0000 Received: by pabtp1 with SMTP id tp1so27746314pab.2 for ; Tue, 14 Apr 2015 15:53:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=y4lNGmUvtvKdXF8L8on/u1F3ayjf4Zu67KeJmzf8QRo=; b=VzmOj+YzaYKVyGR7EOCR/ly2JDKeyay6lXkwwLxOQoqMDVUFJPNVskHOAONfuRfSiq J7cZPoczhqTf1oT46Q2bzpuVaFnhHpaEZGbGJwdwe5jXO1LX84w36O+u22WzvnVYfOXo t/YmdzVXVMQZ8OchHFJo8OaaGFVY7cY3G/bkkahDwV29EiE9AmqiD0UzIofuTBeDiRV6 Dt5UWRa+Jr0HmOqah97bD4er5jgcTZAeXIIuT7i/Wiyhq3UDR8VKHTn8cio7gqHXS73W FD8DtlC/vBGRbEcccXe2VOaRLabrOnS6mUTD61jhFLmipVRF993AWwcWtoYV5kZ6KK1A 2s7Q== X-Gm-Message-State: ALoCoQkfQHhvull09f3ZJF2QSgFGNmNaVgDu4J+P0qRME+jOXw/jH/RpHjPyebYk48BZgXIqJlKE X-Received: by 10.70.29.165 with SMTP id l5mr40677940pdh.125.1429051983404; Tue, 14 Apr 2015 15:53:03 -0700 (PDT) Received: from localhost.localdomain ([173.14.250.228]) by mx.google.com with ESMTPSA id mq2sm2124820pbb.16.2015.04.14.15.53.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Apr 2015 15:53:02 -0700 (PDT) From: Tyler Baker To: Shuah Khan Subject: [PATCH 5/7] selftests/x86: fix cross build logic Date: Tue, 14 Apr 2015 15:52:58 -0700 Message-Id: <1429051978-14778-1-git-send-email-tyler.baker@linaro.org> X-Mailer: git-send-email 2.1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150414_155323_956003_07741704 X-CRM114-Status: UNSURE ( 8.82 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: Kevin Hilman , Michael Ellerman , Tyler Baker , linux-kernel@vger.kernel.org, John Stultz , David Herrmann , Darren Hart , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP x86 tests should not be built when ARCH != x86. Reused the logic from breakpoints to determine when it's appropriate to build. Signed-off-by: Tyler Baker --- tools/testing/selftests/x86/Makefile | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index f0a7918..7be67a0 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile @@ -7,31 +7,36 @@ BINARIES_64 := $(TARGETS_C_BOTHBITS:%=%_64) CFLAGS := -O2 -g -std=gnu99 -pthread -Wall -UNAME_P := $(shell uname -p) - -# Always build 32-bit tests +# Taken from perf makefile +uname_M := $(shell uname -m 2>/dev/null || echo not) +ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/) +ifeq ($(ARCH),i386) +ARCH := x86 all: all_32 - +endif +ifeq ($(ARCH),x86_64) +ARCH := x86 # If we're on a 64-bit host, build 64-bit tests as well -ifeq ($(shell uname -p),x86_64) -all: all_64 +all: all_32 all_64 endif all_32: check_build32 $(BINARIES_32) all_64: $(BINARIES_64) -clean: - $(RM) $(BINARIES_32) $(BINARIES_64) - -run_tests: - ./run_x86_tests.sh - $(TARGETS_C_BOTHBITS:%=%_32): %_32: %.c +ifeq ($(ARCH),x86) $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl +else + echo "Not an x86 target, can't build x86 tests" +endif $(TARGETS_C_BOTHBITS:%=%_64): %_64: %.c +ifeq ($(ARCH),x86) $(CC) -m64 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl +else + echo "Not an x86 target, can't build x86 tests" +endif check_build32: @if ! $(CC) -m32 -o /dev/null trivial_32bit_program.c; then \ @@ -46,3 +51,9 @@ check_build32: echo " yum install glibc-devel.*i686"; \ exit 1; \ fi + +run_tests: + ./run_x86_tests.sh + +clean: + $(RM) $(BINARIES_32) $(BINARIES_64)