1 // SPDX-License-Identifier: GPL-2.0
3 #include <kunit/test.h>
6 * These symbols point to the .kunit_test_suites section and are defined in
7 * include/asm-generic/vmlinux.lds.h, and consequently must be extern.
9 extern struct kunit_suite * const * const __kunit_suites_start[];
10 extern struct kunit_suite * const * const __kunit_suites_end[];
12 #if IS_BUILTIN(CONFIG_KUNIT)
14 static void kunit_print_tap_header(void)
16 struct kunit_suite * const * const *suites, * const *subsuite;
17 int num_of_suites = 0;
19 for (suites = __kunit_suites_start;
20 suites < __kunit_suites_end;
22 for (subsuite = *suites; *subsuite != NULL; subsuite++)
25 pr_info("TAP version 14\n");
26 pr_info("1..%d\n", num_of_suites);
29 int kunit_run_all_tests(void)
31 struct kunit_suite * const * const *suites;
33 kunit_print_tap_header();
35 for (suites = __kunit_suites_start;
36 suites < __kunit_suites_end;
38 __kunit_test_suites_init(*suites);
43 #endif /* IS_BUILTIN(CONFIG_KUNIT) */