]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Aug 2025 16:41:01 +0000 (18:41 +0200)
[ Upstream commit 1158220b24674edaf885433153deb4f0e5c7d331 ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/vDSO/vdso_test_getrandom.c

index 95057f7567db22226d9cb09a667a56e387a33a46..ff8d5675da2b0e6f834f40334ce0b81e479b82ae 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"))