Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1590861 > unrolled thread

[PATCH] selftests: lib.mk Fix individual test builds

Started byShuah Khan <shuahkh@osg.samsung.com>
First post2017-03-02 07:40 +0100
Last post2017-03-03 07:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] selftests: lib.mk Fix individual test builds Shuah Khan <shuahkh@osg.samsung.com> - 2017-03-02 07:40 +0100
    Re: [PATCH] selftests: lib.mk Fix individual test builds Michael Ellerman <mpe@ellerman.id.au> - 2017-03-03 07:40 +0100

#1590861 — [PATCH] selftests: lib.mk Fix individual test builds

FromShuah Khan <shuahkh@osg.samsung.com>
Date2017-03-02 07:40 +0100
Subject[PATCH] selftests: lib.mk Fix individual test builds
Message-ID<tgsz7-6IB-3@gated-at.bofh.it>
In commit a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT"), added
support to generate compile targets in a user specified directory. OUTPUT
variable controls the location which is undefined when tests are built in
the test directory or with "make -C tools/testing/selftests/x86".

make -C tools/testing/selftests/x86/
make: Entering directory '/lkml/linux_4.11/tools/testing/selftests/x86'
Makefile:44: warning: overriding recipe for target 'clean'
../lib.mk:51: warning: ignoring old recipe for target 'clean'
gcc -m64 -o /single_step_syscall_64 -O2 -g -std=gnu99 -pthread -Wall  single_step_syscall.c -lrt -ldl
/usr/bin/ld: cannot open output file /single_step_syscall_64: Permission denied
collect2: error: ld returned 1 exit status
Makefile:50: recipe for target '/single_step_syscall_64' failed
make: *** [/single_step_syscall_64] Error 1
make: Leaving directory '/lkml/linux_4.11/tools/testing/selftests/x86'

Same failure with "cd tools/testing/selftests/x86/;make" run.

Fix this with a change to lib.mk to define OUTPUT to be the pwd when
MAKELEVEL is 0. This covers both cases mentioned above.

Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 tools/testing/selftests/lib.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index ce96d80..775c589 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -2,6 +2,10 @@
 # Makefile can operate with or without the kbuild infrastructure.
 CC := $(CROSS_COMPILE)gcc
 
+ifeq (0,$(MAKELEVEL))
+OUTPUT := $(shell pwd)
+endif
+
 TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS))
 TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1591686

FromMichael Ellerman <mpe@ellerman.id.au>
Date2017-03-03 07:40 +0100
Message-ID<tgP2F-5wE-11@gated-at.bofh.it>
In reply to#1590861
Shuah Khan <shuahkh@osg.samsung.com> writes:
> In commit a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT"), added
> support to generate compile targets in a user specified directory. OUTPUT
> variable controls the location which is undefined when tests are built in
> the test directory or with "make -C tools/testing/selftests/x86".
>
> make -C tools/testing/selftests/x86/
> make: Entering directory '/lkml/linux_4.11/tools/testing/selftests/x86'
> Makefile:44: warning: overriding recipe for target 'clean'
> ../lib.mk:51: warning: ignoring old recipe for target 'clean'
> gcc -m64 -o /single_step_syscall_64 -O2 -g -std=gnu99 -pthread -Wall  single_step_syscall.c -lrt -ldl
> /usr/bin/ld: cannot open output file /single_step_syscall_64: Permission denied
> collect2: error: ld returned 1 exit status
> Makefile:50: recipe for target '/single_step_syscall_64' failed
> make: *** [/single_step_syscall_64] Error 1
> make: Leaving directory '/lkml/linux_4.11/tools/testing/selftests/x86'
>
> Same failure with "cd tools/testing/selftests/x86/;make" run.
>
> Fix this with a change to lib.mk to define OUTPUT to be the pwd when
> MAKELEVEL is 0. This covers both cases mentioned above.
>
> Reported-by: Ingo Molnar <mingo@kernel.org>
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  tools/testing/selftests/lib.mk | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> index ce96d80..775c589 100644
> --- a/tools/testing/selftests/lib.mk
> +++ b/tools/testing/selftests/lib.mk
> @@ -2,6 +2,10 @@
>  # Makefile can operate with or without the kbuild infrastructure.
>  CC := $(CROSS_COMPILE)gcc
>  
> +ifeq (0,$(MAKELEVEL))
> +OUTPUT := $(shell pwd)
> +endif

I preferred my version which just used =? rather than checking
MAKELEVEL, but I don't mind that much.

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

cheers

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web