Merge tag 'linux-kselftest-kunit-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull more Kunit updates from Shuah Khan: - add Kunit to kernel_init() and remove KUnit from init calls entirely. This addresses the concern that Kunit would not work correctly during late init phase. - add a linker section where KUnit can put references to its test suites. This is the first step in transitioning to dispatching all KUnit tests from a centralized executor rather than having each as its own separate late_initcall. - add a centralized executor to dispatch tests rather than relying on late_initcall to schedule each test suite separately. Centralized execution is for built-in tests only; modules will execute tests when loaded. - convert bitfield test to use KUnit framework - Documentation updates for naming guidelines and how kunit_test_suite() works. - add test plan to KUnit TAP format * tag 'linux-kselftest-kunit-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: lib: kunit: Fix compilation test when using TEST_BIT_FIELD_COMPILE lib: kunit: add bitfield test conversion to KUnit Documentation: kunit: add a brief blurb about kunit_test_suite kunit: test: add test plan to KUnit TAP format init: main: add KUnit to kernel init kunit: test: create a single centralized executor for all tests vmlinux.lds.h: add linker section for KUnit test suites Documentation: kunit: Add naming guidelines
Šī revīzija ir iekļauta:
@@ -3,7 +3,8 @@ obj-$(CONFIG_KUNIT) += kunit.o
|
||||
kunit-objs += test.o \
|
||||
string-stream.o \
|
||||
assert.o \
|
||||
try-catch.o
|
||||
try-catch.o \
|
||||
executor.o
|
||||
|
||||
ifeq ($(CONFIG_KUNIT_DEBUGFS),y)
|
||||
kunit-objs += debugfs.o
|
||||
|
43
lib/kunit/executor.c
Parasts fails
43
lib/kunit/executor.c
Parasts fails
@@ -0,0 +1,43 @@
|
||||
// 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)
|
||||
|
||||
static void kunit_print_tap_header(void)
|
||||
{
|
||||
struct kunit_suite * const * const *suites, * const *subsuite;
|
||||
int num_of_suites = 0;
|
||||
|
||||
for (suites = __kunit_suites_start;
|
||||
suites < __kunit_suites_end;
|
||||
suites++)
|
||||
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;
|
||||
|
||||
kunit_print_tap_header();
|
||||
|
||||
for (suites = __kunit_suites_start;
|
||||
suites < __kunit_suites_end;
|
||||
suites++)
|
||||
__kunit_test_suites_init(*suites);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* IS_BUILTIN(CONFIG_KUNIT) */
|
@@ -16,16 +16,6 @@
|
||||
#include "string-stream.h"
|
||||
#include "try-catch-impl.h"
|
||||
|
||||
static void kunit_print_tap_version(void)
|
||||
{
|
||||
static bool kunit_has_printed_tap_version;
|
||||
|
||||
if (!kunit_has_printed_tap_version) {
|
||||
pr_info("TAP version 14\n");
|
||||
kunit_has_printed_tap_version = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Append formatted message to log, size of which is limited to
|
||||
* KUNIT_LOG_SIZE bytes (including null terminating byte).
|
||||
@@ -65,7 +55,6 @@ EXPORT_SYMBOL_GPL(kunit_suite_num_test_cases);
|
||||
|
||||
static void kunit_print_subtest_start(struct kunit_suite *suite)
|
||||
{
|
||||
kunit_print_tap_version();
|
||||
kunit_log(KERN_INFO, suite, KUNIT_SUBTEST_INDENT "# Subtest: %s",
|
||||
suite->name);
|
||||
kunit_log(KERN_INFO, suite, KUNIT_SUBTEST_INDENT "1..%zd",
|
||||
@@ -381,7 +370,7 @@ static void kunit_init_suite(struct kunit_suite *suite)
|
||||
kunit_debugfs_create_suite(suite);
|
||||
}
|
||||
|
||||
int __kunit_test_suites_init(struct kunit_suite **suites)
|
||||
int __kunit_test_suites_init(struct kunit_suite * const * const suites)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
Atsaukties uz šo jaunā problēmā
Block a user