Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: skhan@linuxfoundation.org, greg@kroah.com,
	linux-kselftest@vger.kernel.org
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Subject: [PATCH kselftest 1/3] selftests: vDSO: condition chacha build on chacha implementation
Date: Thu,  3 Oct 2024 05:13:05 +0200	[thread overview]
Message-ID: <20241003031307.2236454-2-Jason@zx2c4.com> (raw)
In-Reply-To: <20241003031307.2236454-1-Jason@zx2c4.com>

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@zx2c4.com>
---
 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


  reply	other threads:[~2024-10-03  3:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Zv20olVBlnxL9UnS@zx2c4.com>
2024-10-03  3:13 ` [PATCH kselftest 0/3] getrandom & chacha cleanups Jason A. Donenfeld
2024-10-03  3:13   ` Jason A. Donenfeld [this message]
2024-10-03  3:13   ` [PATCH kselftest 2/3] selftests: vDSO: unconditionally build getrandom test Jason A. Donenfeld
2024-10-03  3:13   ` [PATCH kselftest 3/3] selftests: vDSO: improve getrandom and chacha error messages Jason A. Donenfeld
2024-10-06  3:35     ` kernel test robot
2024-10-06  4:35       ` Jason A. Donenfeld
2024-10-06  4:40         ` [PATCH kselftest v2 1/4] selftests: vDSO: condition chacha build on chacha implementation Jason A. Donenfeld
2024-10-06  4:40           ` [PATCH kselftest v2 2/4] selftests: vDSO: unconditionally build getrandom test Jason A. Donenfeld
2024-10-06  4:40           ` [PATCH kselftest v2 3/4] selftests: vDSO: improve getrandom and chacha error messages Jason A. Donenfeld
2024-10-06  4:40           ` [PATCH kselftest v2 4/4] selftests: vDSO: unconditionally build chacha test Jason A. Donenfeld
2024-10-07 20:53             ` Shuah Khan
2024-10-07 21:45               ` [PATCH kselftest v3 1/3] " Jason A. Donenfeld
2024-10-07 21:45                 ` [PATCH kselftest v3 2/3] selftests: vDSO: unconditionally build getrandom test Jason A. Donenfeld
2024-10-07 21:45                 ` [PATCH kselftest v3 3/3] selftests: vDSO: improve getrandom and chacha error messages Jason A. Donenfeld
2024-10-08 21:36                 ` [PATCH kselftest v3 1/3] selftests: vDSO: unconditionally build chacha test Shuah Khan
2024-10-03 17:18   ` [PATCH kselftest 4/3] " Jason A. Donenfeld
2024-10-03 22:42   ` [PATCH kselftest 0/3] getrandom & chacha cleanups Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241003031307.2236454-2-Jason@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=greg@kroah.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox