mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: Shuah Khan <shuahkh@osg.samsung.com>,
	linux-api@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Sudeep Holla <sudeep.holla@arm.com>
Subject: [RFC PATCH] selftests: use INSTALL_HDR_PATH instead of relative paths
Date: Mon, 11 Jan 2016 14:22:52 +0000	[thread overview]
Message-ID: <1452522172-16650-1-git-send-email-sudeep.holla@arm.com> (raw)

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 <shuahkh@osg.samsung.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 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

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)
 
-- 
1.9.1

             reply	other threads:[~2016-01-11 14:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11 14:22 Sudeep Holla [this message]
2016-01-14  3:37 ` Michael Ellerman
2016-01-14 11:17   ` Sudeep Holla
2016-01-26 11:57     ` Sudeep Holla
2016-01-28 21:19       ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452522172-16650-1-git-send-email-sudeep.holla@arm.com \
    --to=sudeep.holla@arm.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shuahkh@osg.samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®