LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2] selftests: kcmp build fails when invoked from kselftest target
@ 2015-03-11 0:08 Shuah Khan
2015-03-11 2:19 ` Michael Ellerman
0 siblings, 1 reply; 3+ messages in thread
From: Shuah Khan @ 2015-03-11 0:08 UTC (permalink / raw)
To: gorcunov, akpm, tranmanphong, mpe; +Cc: Shuah Khan, linux-kernel, linux-api
kcmp Makefile doesn't have an explicit build rule. As a result,
kcmp build fails, when it is run from top level Makefile target
kselftest. Without the explicit rule, make works only when it is
run in the current directory or from selftests directory. Add an
explicit build rule to fix the problem. In addition, build fails
as it can't find kcmp.h. Fix it by passing CFLAGS.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
v2: Added deleted pre-requisite back in to address review
comments.
tools/testing/selftests/kcmp/Makefile | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
index ff0eefd..d615e9c 100644
--- a/tools/testing/selftests/kcmp/Makefile
+++ b/tools/testing/selftests/kcmp/Makefile
@@ -1,8 +1,11 @@
CC := $(CROSS_COMPILE)$(CC)
-CFLAGS += -I../../../../usr/include/
+CFLAGS += -I../../../../include/uapi -I../../../../usr/include/
all: kcmp_test
+kcmp_test:
+ $(CC) $(CFLAGS) kcmp_test.c -o kcmp_test
+
run_tests: all
@./kcmp_test || echo "kcmp_test: [FAIL]"
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] selftests: kcmp build fails when invoked from kselftest target
2015-03-11 0:08 [PATCH v2] selftests: kcmp build fails when invoked from kselftest target Shuah Khan
@ 2015-03-11 2:19 ` Michael Ellerman
2015-03-11 13:30 ` Shuah Khan
0 siblings, 1 reply; 3+ messages in thread
From: Michael Ellerman @ 2015-03-11 2:19 UTC (permalink / raw)
To: Shuah Khan; +Cc: gorcunov, akpm, tranmanphong, linux-kernel, linux-api
On Tue, 2015-03-10 at 18:08 -0600, Shuah Khan wrote:
> kcmp Makefile doesn't have an explicit build rule. As a result,
> kcmp build fails, when it is run from top level Makefile target
> kselftest. Without the explicit rule, make works only when it is
> run in the current directory or from selftests directory. Add an
> explicit build rule to fix the problem.
This should be fixed properly using my patch to filter -rR or similar.
> In addition, build fails
> as it can't find kcmp.h. Fix it by passing CFLAGS.
That is also wrong. It should *not* be looking in include/uapi.
If it needs headers then it should be using the *exported* headers, which are
in ../../../../usr/include as the existing CFLAGS specifiy.
Those headers are installed as part of 'make headers_install'.
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] selftests: kcmp build fails when invoked from kselftest target
2015-03-11 2:19 ` Michael Ellerman
@ 2015-03-11 13:30 ` Shuah Khan
0 siblings, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2015-03-11 13:30 UTC (permalink / raw)
To: Michael Ellerman; +Cc: gorcunov, akpm, tranmanphong, linux-kernel, linux-api
On 03/10/2015 08:19 PM, Michael Ellerman wrote:
> On Tue, 2015-03-10 at 18:08 -0600, Shuah Khan wrote:
>> kcmp Makefile doesn't have an explicit build rule. As a result,
>> kcmp build fails, when it is run from top level Makefile target
>> kselftest. Without the explicit rule, make works only when it is
>> run in the current directory or from selftests directory. Add an
>> explicit build rule to fix the problem.
>
> This should be fixed properly using my patch to filter -rR or similar.
I don't agree with this. Relying on ARCH Makefiles doing the
right thing for individual tests to build makes it difficult
to maintain. We will keep running into problems for each of
the ARCH.
I would rather have this addressed in the individual Makefiles
with an explicit rule and if -rR approach works, great. So it
has to be two pronged approach with individual Makefiles being
able to work irrespective of ARCH Makefiles doing the right
thing.
>
>> In addition, build fails
>> as it can't find kcmp.h. Fix it by passing CFLAGS.
>
> That is also wrong. It should *not* be looking in include/uapi.
>
> If it needs headers then it should be using the *exported* headers, which are
> in ../../../../usr/include as the existing CFLAGS specifiy.
>
> Those headers are installed as part of 'make headers_install'.
>
Adding uapi covers both cases where the headers aren't installed yet.
Also make V=1 doesn't show CFLAGS getting passed in. They need to be
passed in explicitly even when run from the kcmp directory.
-- Shuah
--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-11 13:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-11 0:08 [PATCH v2] selftests: kcmp build fails when invoked from kselftest target Shuah Khan
2015-03-11 2:19 ` Michael Ellerman
2015-03-11 13:30 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).