From patchwork Mon Jan 11 14:22:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 59544 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2140961lbb; Mon, 11 Jan 2016 06:23:06 -0800 (PST) X-Received: by 10.98.79.140 with SMTP id f12mr26805474pfj.102.1452522186657; Mon, 11 Jan 2016 06:23:06 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xi3si33488630pab.123.2016.01.11.06.23.06; Mon, 11 Jan 2016 06:23:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933162AbcAKOXD (ORCPT + 29 others); Mon, 11 Jan 2016 09:23:03 -0500 Received: from foss.arm.com ([217.140.101.70]:55654 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933015AbcAKOXA (ORCPT ); Mon, 11 Jan 2016 09:23:00 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C47F53A8; Mon, 11 Jan 2016 06:22:25 -0800 (PST) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B55B43F246; Mon, 11 Jan 2016 06:22:59 -0800 (PST) From: Sudeep Holla To: Shuah Khan , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla Subject: [RFC PATCH] selftests: use INSTALL_HDR_PATH instead of relative paths Date: Mon, 11 Jan 2016 14:22:52 +0000 Message-Id: <1452522172-16650-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The selftests build fails or picks up wrong headers when cross-compiling and build directory is different from source as the headers are referred using the relative paths. This patch use $INSTALL_HDR_PATH to fix the compilation. It also removes installing the headers. Cc: Shuah Khan Signed-off-by: Sudeep Holla --- tools/testing/selftests/membarrier/Makefile | 2 +- tools/testing/selftests/memfd/Makefile | 2 +- tools/testing/selftests/net/Makefile | 2 +- tools/testing/selftests/vm/Makefile | 7 ++----- 4 files changed, 5 insertions(+), 8 deletions(-) Hi, When I was cross-compiling these tests for arm{32,64}, I faced issues. With limited knowledge I have on this build system, I came up with this patch. Please treat this as bug report if this approach makes no-sense and suggest on how to fix it. Regards, Sudeep -- 1.9.1 diff --git a/tools/testing/selftests/membarrier/Makefile b/tools/testing/selftests/membarrier/Makefile index a1a97085847d..0a033d39cc10 100644 --- a/tools/testing/selftests/membarrier/Makefile +++ b/tools/testing/selftests/membarrier/Makefile @@ -1,4 +1,4 @@ -CFLAGS += -g -I../../../../usr/include/ +CFLAGS += -g -I$(INSTALL_HDR_PATH)/include/ TEST_PROGS := membarrier_test diff --git a/tools/testing/selftests/memfd/Makefile b/tools/testing/selftests/memfd/Makefile index fd396ac811b6..704249ba24ea 100644 --- a/tools/testing/selftests/memfd/Makefile +++ b/tools/testing/selftests/memfd/Makefile @@ -2,7 +2,7 @@ CC = $(CROSS_COMPILE)gcc CFLAGS += -D_FILE_OFFSET_BITS=64 CFLAGS += -I../../../../include/uapi/ CFLAGS += -I../../../../include/ -CFLAGS += -I../../../../usr/include/ +CFLAGS += -I$(INSTALL_HDR_PATH)/include/ TEST_PROGS := memfd_test diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index fac4782c51d8..40cf11375c15 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -2,7 +2,7 @@ CFLAGS = -Wall -O2 -g -CFLAGS += -I../../../../usr/include/ +CFLAGS += -I$(INSTALL_HDR_PATH)/include/ NET_PROGS = socket psock_fanout psock_tpacket diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile index e4bb1de1d526..ad343d00d131 100644 --- a/tools/testing/selftests/vm/Makefile +++ b/tools/testing/selftests/vm/Makefile @@ -1,6 +1,6 @@ # Makefile for vm selftests -CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) +CFLAGS = -Wall -I $(INSTALL_HDR_PATH)/include $(EXTRA_CFLAGS) BINARIES = compaction_test BINARIES += hugepage-mmap BINARIES += hugepage-shm @@ -14,12 +14,9 @@ BINARIES += userfaultfd all: $(BINARIES) %: %.c $(CC) $(CFLAGS) -o $@ $^ -lrt -userfaultfd: userfaultfd.c ../../../../usr/include/linux/kernel.h +userfaultfd: userfaultfd.c $(INSTALL_HDR_PATH)/include/linux/kernel.h $(CC) $(CFLAGS) -O2 -o $@ $< -lpthread -../../../../usr/include/linux/kernel.h: - make -C ../../../.. headers_install - TEST_PROGS := run_vmtests TEST_FILES := $(BINARIES)