Skip to contentSkip to conversation

selftests/x86: Add <test_name>{,_32,_64} targets

PATCH Superseded Dmitry Safonov 3 participants 4 messages Jan 18, 2018 – Jan 19, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/x86: Add <test_name>{,_32,_64} targets

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 at kernel.org>
Cc Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Cc Shuah Khan <shuah at kernel.org>
Cc Thomas Gleixner <tglx at linutronix.de>
Cc linux-kselftest at vger.kernel.org
Cc x86 at kernel.org
Reported-by Ingo Molnar <mingo at kernel.org>
Signed-off-by Dmitry Safonov <dima at arista.com>
---
 tools/testing/selftests/x86/Makefile | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
tools/testing/selftests/x86/Makefile +14 -0
index 5d4f10ac2af2..5958654e00c6 100644
@@ -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)
Signature · 6 lines
2.13.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 29 lines · Dmitry Safonov

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 at kernel.org>
Cc Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Cc Shuah Khan <shuah at kernel.org>
Cc Thomas Gleixner <tglx at linutronix.de>
Cc linux-kselftest at vger.kernel.org
Cc x86 at kernel.org
Reported-by Ingo Molnar <mingo at kernel.org>
Signed-off-by Dmitry Safonov <dima at arista.com>
Quoted 1 line

---

Drop this one, please, I've sent v2 with $(1) and $(1)_{64,32} targets specified on one line.

Signature · 6 lines
Thanks,
             Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by on v1 1/1
#2 lore raw
In reply to Dmitry Safonov
Quoted 16 lines · Dmitry Safonov

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

Quoted 3 lines

Makefile target substitution neither works :-/

Generate .PHONY targets per-test and fix target substitution.

Reviewed-by: Andy Lutomirski <luto at kernel.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#3 lore raw
Quoted 17 lines · Andy Lutomirski
Quoted 16 lines · Dmitry Safonov

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

Quoted 7 lines
Quoted 3 lines

Makefile target substitution neither works :-/

Generate .PHONY targets per-test and fix target substitution.

Reviewed-by Andy Lutomirski <luto at 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html