]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests: vDSO: vdso_test_getrandom: Always print TAP header
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>
Wed, 11 Jun 2025 10:33:58 +0000 (12:33 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 1 Jul 2025 13:50:42 +0000 (15:50 +0200)
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@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Link: https://lore.kernel.org/all/20250611-selftests-vdso-fixes-v3-8-e62e37a6bcf5@linutronix.de
tools/testing/selftests/vDSO/vdso_test_getrandom.c

index 389ead4e1fe3761f265f7b589b417b6d9f25c565..dd1132508a0db29a32ec977b30f64b20aa43e03d 100644 (file)
@@ -242,6 +242,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) {
@@ -295,8 +296,6 @@ static void usage(const char *argv0)
 
 int main(int argc, char *argv[])
 {
-       vgetrandom_init();
-
        if (argc == 1) {
                kselftest();
                return 0;
@@ -306,6 +305,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"))