* [PATCH] selftests/x86: Add <test_name>{,_32,_64} targets
@ 2018-01-18 22:19 Dmitry Safonov
2018-01-18 22:28 ` Dmitry Safonov
2018-01-18 23:10 ` Andy Lutomirski
0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Safonov @ 2018-01-18 22:19 UTC (permalink / raw)
To: linux-kernel
Cc: Dmitry Safonov, Ingo Molnar, Andy Lutomirski, Greg Kroah-Hartman,
Shuah Khan, Thomas Gleixner, linux-kselftest, x86
One can only use `make all` or `make <test_name>_<bitness>`
as make targets.
`make <test_name>` doesn't work as Ingo noticed:
x86> make test_vsyscall
gcc -O2 -g -std=gnu99 -pthread -Wall -no-pie test_vsyscall.c -o test_vsyscall
/tmp/aBaoo3nb.o: In function `init_vdso':
test_vsyscall.c:68: undefined reference to `dlopen'
test_vsyscall.c:76: undefined reference to `dlsym'
test_vsyscall.c:80: undefined reference to `dlsym'
test_vsyscall.c:84: undefined reference to `dlsym'
test_vsyscall.c:88: undefined reference to `dlsym'
test_vsyscall.c:70: undefined reference to `dlopen'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'test_vsyscall' failed
make: *** [test_vsyscall] Error 1
Makefile target substitution neither works :-/
Generate .PHONY targets per-test and fix target substitution.
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kselftest@vger.kernel.org
Cc: x86@kernel.org
Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
---
tools/testing/selftests/x86/Makefile | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
index 5d4f10ac2af2..5958654e00c6 100644
--- a/tools/testing/selftests/x86/Makefile
+++ b/tools/testing/selftests/x86/Makefile
@@ -27,14 +27,28 @@ UNAME_M := $(shell uname -m)
CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32)
CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c)
+define gen-target-rule-32
+$(1): $(OUTPUT)/$(1)_32
+$(1)_32: $(OUTPUT)/$(1)_32
+.PHONY: $(1) $(1)_32
+endef
+
+define gen-target-rule-64
+$(1): $(OUTPUT)/$(1)_64
+$(1)_64: $(OUTPUT)/$(1)_64
+.PHONY: $(1) $(1)_64
+endef
+
ifeq ($(CAN_BUILD_I386),1)
all: all_32
TEST_PROGS += $(BINARIES_32)
+$(foreach t,$(TARGETS_C_32BIT_ALL),$(eval $(call gen-target-rule-32,$(t))))
endif
ifeq ($(CAN_BUILD_X86_64),1)
all: all_64
TEST_PROGS += $(BINARIES_64)
+$(foreach t,$(TARGETS_C_64BIT_ALL),$(eval $(call gen-target-rule-64,$(t))))
endif
all_32: $(BINARIES_32)
--
2.13.6
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/x86: Add <test_name>{,_32,_64} targets
2018-01-18 22:19 [PATCH] selftests/x86: Add <test_name>{,_32,_64} targets Dmitry Safonov
@ 2018-01-18 22:28 ` Dmitry Safonov
2018-01-18 23:10 ` Andy Lutomirski
1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Safonov @ 2018-01-18 22:28 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andy Lutomirski, Greg Kroah-Hartman, Shuah Khan,
Thomas Gleixner, linux-kselftest, x86
On Thu, 2018-01-18 at 22:19 +0000, Dmitry Safonov wrote:
> One can only use `make all` or `make <test_name>_<bitness>`
> as make targets.
> `make <test_name>` doesn't work as Ingo noticed:
> x86> make test_vsyscall
> gcc -O2 -g -std=gnu99 -pthread -Wall -no-pie test_vsyscall.c -o
> test_vsyscall
> /tmp/aBaoo3nb.o: In function `init_vdso':
> test_vsyscall.c:68: undefined reference to `dlopen'
> test_vsyscall.c:76: undefined reference to `dlsym'
> test_vsyscall.c:80: undefined reference to `dlsym'
> test_vsyscall.c:84: undefined reference to `dlsym'
> test_vsyscall.c:88: undefined reference to `dlsym'
> test_vsyscall.c:70: undefined reference to `dlopen'
> collect2: error: ld returned 1 exit status
> <builtin>: recipe for target 'test_vsyscall' failed
> make: *** [test_vsyscall] Error 1
>
> Makefile target substitution neither works :-/
>
> Generate .PHONY targets per-test and fix target substitution.
>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-kselftest@vger.kernel.org
> Cc: x86@kernel.org
> Reported-by: Ingo Molnar <mingo@kernel.org>
> Signed-off-by: Dmitry Safonov <dima@arista.com>
> ---
Drop this one, please, I've sent v2 with $(1) and $(1)_{64,32}
targets specified on one line.
--
Thanks,
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/x86: Add <test_name>{,_32,_64} targets
2018-01-18 22:19 [PATCH] selftests/x86: Add <test_name>{,_32,_64} targets Dmitry Safonov
2018-01-18 22:28 ` Dmitry Safonov
@ 2018-01-18 23:10 ` Andy Lutomirski
2018-01-19 0:28 ` Shuah Khan
1 sibling, 1 reply; 4+ messages in thread
From: Andy Lutomirski @ 2018-01-18 23:10 UTC (permalink / raw)
To: Dmitry Safonov
Cc: LKML, Ingo Molnar, Andy Lutomirski, Greg Kroah-Hartman,
Shuah Khan, Thomas Gleixner, open list:KERNEL SELFTEST FRAMEWORK,
X86 ML
On Thu, Jan 18, 2018 at 2:19 PM, Dmitry Safonov <dima@arista.com> wrote:
> One can only use `make all` or `make <test_name>_<bitness>`
> as make targets.
> `make <test_name>` doesn't work as Ingo noticed:
> x86> make test_vsyscall
> gcc -O2 -g -std=gnu99 -pthread -Wall -no-pie test_vsyscall.c -o test_vsyscall
> /tmp/aBaoo3nb.o: In function `init_vdso':
> test_vsyscall.c:68: undefined reference to `dlopen'
> test_vsyscall.c:76: undefined reference to `dlsym'
> test_vsyscall.c:80: undefined reference to `dlsym'
> test_vsyscall.c:84: undefined reference to `dlsym'
> test_vsyscall.c:88: undefined reference to `dlsym'
> test_vsyscall.c:70: undefined reference to `dlopen'
> collect2: error: ld returned 1 exit status
> <builtin>: recipe for target 'test_vsyscall' failed
> make: *** [test_vsyscall] Error 1
>
> Makefile target substitution neither works :-/
>
> Generate .PHONY targets per-test and fix target substitution.
Reviewed-by: Andy Lutomirski <luto@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/x86: Add <test_name>{,_32,_64} targets
2018-01-18 23:10 ` Andy Lutomirski
@ 2018-01-19 0:28 ` Shuah Khan
0 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2018-01-19 0:28 UTC (permalink / raw)
To: Andy Lutomirski, Dmitry Safonov
Cc: LKML, Ingo Molnar, Greg Kroah-Hartman, Thomas Gleixner,
open list:KERNEL SELFTEST FRAMEWORK, X86 ML, Shuah Khan,
Shuah Khan
On 01/18/2018 04:10 PM, Andy Lutomirski wrote:
> On Thu, Jan 18, 2018 at 2:19 PM, Dmitry Safonov <dima@arista.com> wrote:
>> One can only use `make all` or `make <test_name>_<bitness>`
>> as make targets.
>> `make <test_name>` doesn't work as Ingo noticed:
>> x86> make test_vsyscall
>> gcc -O2 -g -std=gnu99 -pthread -Wall -no-pie test_vsyscall.c -o test_vsyscall
>> /tmp/aBaoo3nb.o: In function `init_vdso':
>> test_vsyscall.c:68: undefined reference to `dlopen'
>> test_vsyscall.c:76: undefined reference to `dlsym'
>> test_vsyscall.c:80: undefined reference to `dlsym'
>> test_vsyscall.c:84: undefined reference to `dlsym'
>> test_vsyscall.c:88: undefined reference to `dlsym'
>> test_vsyscall.c:70: undefined reference to `dlopen'
>> collect2: error: ld returned 1 exit status
>> <builtin>: recipe for target 'test_vsyscall' failed
>> make: *** [test_vsyscall] Error 1
>>
>> Makefile target substitution neither works :-/
>>
>> Generate .PHONY targets per-test and fix target substitution.
>
> Reviewed-by: Andy Lutomirski <luto@kernel.org>
>
>
Thanks for taking care of this. I plan to get this into 4.16-rc1
unless there is a dependency on x86 tree.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-19 0:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-18 22:19 [PATCH] selftests/x86: Add <test_name>{,_32,_64} targets Dmitry Safonov
2018-01-18 22:28 ` Dmitry Safonov
2018-01-18 23:10 ` Andy Lutomirski
2018-01-19 0:28 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome