From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: linux-kernel@vger.kernel.org
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>,
Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Subject: [PATCH] selftests/vDSO: skip getrandom test if architecture is unsupported
Date: Thu, 29 Aug 2024 20:25:31 +0200 [thread overview]
Message-ID: <20240829182531.250502-1-Jason@zx2c4.com> (raw)
If the getrandom test compiles for an arch, don't exit fatally if the
actual cpu it's running on is unsupported.
Suggested-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
tools/testing/selftests/vDSO/vdso_test_getrandom.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/vDSO/vdso_test_getrandom.c b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
index 20bbef992c48..5db8ac8999cd 100644
--- a/tools/testing/selftests/vDSO/vdso_test_getrandom.c
+++ b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
@@ -104,6 +104,7 @@ static void vgetrandom_init(void)
const char *version = versions[VDSO_VERSION];
const char *name = names[VDSO_NAMES][6];
unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR);
+ size_t ret;
if (!sysinfo_ehdr) {
printf("AT_SYSINFO_EHDR is not present!\n");
@@ -115,7 +116,11 @@ static void vgetrandom_init(void)
printf("%s is missing!\n", name);
exit(KSFT_FAIL);
}
- if (vgrnd.fn(NULL, 0, 0, &vgrnd.params, ~0UL) != 0) {
+ ret = vgrnd.fn(NULL, 0, 0, &vgrnd.params, ~0UL);
+ if (ret == -ENOSYS) {
+ printf("unsupported architecture\n");
+ exit(KSFT_SKIP);
+ } else if (ret) {
printf("failed to fetch vgetrandom params!\n");
exit(KSFT_FAIL);
}
--
2.46.0
reply other threads:[~2024-08-29 18:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240829182531.250502-1-Jason@zx2c4.com \
--to=jason@zx2c4.com \
--cc=adhemerval.zanella@linaro.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®