3
0
mirror of https://github.com/Qortal/Brooklyn.git synced 2025-02-14 11:15:54 +00:00
Brooklyn/lib/kunit/executor.c

44 lines
1.0 KiB
C
Raw Normal View History

2021-05-27 00:09:36 +05:00
// SPDX-License-Identifier: GPL-2.0
#include <kunit/test.h>
/*
* These symbols point to the .kunit_test_suites section and are defined in
* include/asm-generic/vmlinux.lds.h, and consequently must be extern.
*/
extern struct kunit_suite * const * const __kunit_suites_start[];
extern struct kunit_suite * const * const __kunit_suites_end[];
#if IS_BUILTIN(CONFIG_KUNIT)
2021-09-23 21:59:15 +05:00
static void kunit_print_tap_header(void)
2021-05-27 00:09:36 +05:00
{
struct kunit_suite * const * const *suites, * const *subsuite;
int num_of_suites = 0;
2021-09-23 21:59:15 +05:00
for (suites = __kunit_suites_start;
suites < __kunit_suites_end;
suites++)
2021-05-27 00:09:36 +05:00
for (subsuite = *suites; *subsuite != NULL; subsuite++)
num_of_suites++;
pr_info("TAP version 14\n");
pr_info("1..%d\n", num_of_suites);
}
int kunit_run_all_tests(void)
{
struct kunit_suite * const * const *suites;
2021-09-23 21:59:15 +05:00
kunit_print_tap_header();
2021-05-27 00:09:36 +05:00
2021-09-23 21:59:15 +05:00
for (suites = __kunit_suites_start;
suites < __kunit_suites_end;
suites++)
__kunit_test_suites_init(*suites);
2021-07-22 21:18:54 +05:00
2021-05-27 00:09:36 +05:00
return 0;
}
#endif /* IS_BUILTIN(CONFIG_KUNIT) */