[PATCH v6 3/3] selftests/vDSO: Enable vdso getrandom tests for LoongArch

From: Xi Ruoyao
Date: Sun Sep 01 2024 - 02:14:35 EST


Create the symlink to the arch/loongarch/vdso directory, and correctly
set the ARCH variable for LoongArch.

Signed-off-by: Xi Ruoyao <xry111@xxxxxxxxxxx>
---
tools/arch/loongarch/vdso | 1 +
tools/testing/selftests/vDSO/Makefile | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
create mode 120000 tools/arch/loongarch/vdso

diff --git a/tools/arch/loongarch/vdso b/tools/arch/loongarch/vdso
new file mode 120000
index 000000000000..ebda43a82db7
--- /dev/null
+++ b/tools/arch/loongarch/vdso
@@ -0,0 +1 @@
+../../../arch/loongarch/vdso
\ No newline at end of file
diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile
index 5ead6b1f0478..c992fe8dbf55 100644
--- a/tools/testing/selftests/vDSO/Makefile
+++ b/tools/testing/selftests/vDSO/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
-ARCH ?= $(shell uname -m | sed -e s/i.86/x86/)
+ARCH ?= $(shell uname -m | sed -e s/i.86/x86/ -e /loongarch/s/[0-9]//g)
SRCARCH := $(subst x86_64,x86,$(ARCH))

TEST_GEN_PROGS := vdso_test_gettimeofday
@@ -10,7 +10,7 @@ ifeq ($(ARCH),$(filter $(ARCH),x86 x86_64))
TEST_GEN_PROGS += vdso_standalone_test_x86
endif
TEST_GEN_PROGS += vdso_test_correctness
-ifeq ($(ARCH),$(filter $(ARCH),x86_64))
+ifeq ($(ARCH),$(filter $(ARCH),x86_64 loongarch))
TEST_GEN_PROGS += vdso_test_getrandom
TEST_GEN_PROGS += vdso_test_chacha
endif
--
2.46.0