Re: [PATCH 6/7] selftests: vDSO: vdso_test_getrandom: Always print TAP header

From: Muhammad Usama Anjum
Date: Fri May 02 2025 - 09:48:30 EST


On 5/2/25 5:40 PM, Thomas Weißschuh wrote:
> The TAP specification requires that the output begins with a header line.
> If vgetrandom_init() fails and skips the test, that header line is missing.
>
> Call vgetrandom_init() after ksft_print_header().
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx>

> ---
> tools/testing/selftests/vDSO/vdso_test_getrandom.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/vDSO/vdso_test_getrandom.c b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
> index b0e0d664508a38d6dde9df0a61ec8198ee928a17..01892d8e65d754d0353f7df2b63910d5be8cd1bc 100644
> --- a/tools/testing/selftests/vDSO/vdso_test_getrandom.c
> +++ b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
> @@ -232,6 +232,7 @@ static void kselftest(void)
> pid_t child;
>
> ksft_print_header();
> + vgetrandom_init();
> ksft_set_plan(2);
>
> for (size_t i = 0; i < 1000; ++i) {
> @@ -285,8 +286,6 @@ static void usage(const char *argv0)
>
> int main(int argc, char *argv[])
> {
> - vgetrandom_init();
> -
> if (argc == 1) {
> kselftest();
> return 0;
> @@ -296,6 +295,9 @@ int main(int argc, char *argv[])
> usage(argv[0]);
> return 1;
> }
> +
> + vgetrandom_init();
> +
> if (!strcmp(argv[1], "bench-single"))
> bench_single();
> else if (!strcmp(argv[1], "bench-multi"))
>


--
Regards,
Usama