[PATCH kselftest 1/3] selftests: vDSO: condition chacha build on chacha implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The chacha test can build anywhere that the vgetrandom-chacha.S file is
available, so condition it on the existence of that file, rather than a
specific arch.

There is one wrinkle, which is that x86 and x86_64 are the same ARCH,
but the code is only functional for x86_64. So filter out the test for
CONFIG_X86_32 in the same block that the other 32-bit special case
lives.

We have to define top_srcdir ourselves, because even though lib.mk
defines it later, that has to be included after TEST_GEN_PROGS is
populated. Fortunately the definition is fairly trivial.

Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>
---
 tools/testing/selftests/vDSO/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile
index af9cedbf5357..2c38c9c6d056 100644
--- a/tools/testing/selftests/vDSO/Makefile
+++ b/tools/testing/selftests/vDSO/Makefile
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 include ../../../scripts/Makefile.arch
+top_srcdir = $(realpath ../../../..)
 
 TEST_GEN_PROGS := vdso_test_gettimeofday
 TEST_GEN_PROGS += vdso_test_getcpu
@@ -11,6 +12,8 @@ endif
 TEST_GEN_PROGS += vdso_test_correctness
 ifeq ($(ARCH)$(CONFIG_X86_32),$(filter $(ARCH)$(CONFIG_X86_32),x86 x86_64 loongarch arm64 powerpc s390))
 TEST_GEN_PROGS += vdso_test_getrandom
+endif
+ifneq ($(wildcard $(top_srcdir)/tools/arch/$(SRCARCH)/vdso/vgetrandom-chacha.S),)
 TEST_GEN_PROGS += vdso_test_chacha
 endif
 
@@ -18,6 +21,7 @@ CFLAGS := -std=gnu99 -O2
 
 ifeq ($(CONFIG_X86_32),y)
 LDLIBS += -lgcc_s
+TEST_GEN_PROGS := $(filter-out vdso_test_chacha,$(TEST_GEN_PROGS))
 endif
 
 include ../lib.mk
-- 
2.46.0





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux