summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-03-16 11:50:48 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-03-16 11:50:48 +0100
commitde6c925db978004703944585e9dd57d58aba0fac (patch)
tree64aa124199d1121dd8aa103f28f3a76f34435486 /lib
parent322a81d35ecdf9997c3bbf676e3547d75f38935a (diff)
parentf338e77383789c0cae23ca3d48adcc5e9e137e3c (diff)
Merge 7.0-rc4 into usb-next
We need the USB fixes in this branch as well to build on top of Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig.debug32
-rw-r--r--lib/bootconfig.c6
-rw-r--r--lib/crypto/.kunitconfig34
-rw-r--r--lib/crypto/tests/Kconfig35
-rw-r--r--lib/debugobjects.c19
-rw-r--r--lib/kunit/test.c231
6 files changed, 195 insertions, 162 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 4e2dfbbd3d78..93f356d2b3d9 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -630,7 +630,7 @@ config DEBUG_FORCE_WEAK_PER_CPU
config WARN_CONTEXT_ANALYSIS
bool "Compiler context-analysis warnings"
- depends on CC_IS_CLANG && CLANG_VERSION >= 220000
+ depends on CC_IS_CLANG && CLANG_VERSION >= 220100
# Branch profiling re-defines "if", which messes with the compiler's
# ability to analyze __cond_acquires(..), resulting in false positives.
depends on !TRACE_BRANCH_PROFILING
@@ -641,7 +641,7 @@ config WARN_CONTEXT_ANALYSIS
and releasing user-definable "context locks".
Clang's name of the feature is "Thread Safety Analysis". Requires
- Clang 22 or later.
+ Clang 22.1.0 or later.
Produces warnings by default. Select CONFIG_WERROR if you wish to
turn these warnings into errors.
@@ -760,6 +760,7 @@ source "mm/Kconfig.debug"
config DEBUG_OBJECTS
bool "Debug object operations"
+ depends on PREEMPT_COUNT || !DEFERRED_STRUCT_PAGE_INIT
depends on DEBUG_KERNEL
help
If you say Y here, additional code will be inserted into the
@@ -1766,33 +1767,6 @@ config STACKTRACE
It is also used by various kernel debugging features that require
stack trace generation.
-config WARN_ALL_UNSEEDED_RANDOM
- bool "Warn for all uses of unseeded randomness"
- default n
- help
- Some parts of the kernel contain bugs relating to their use of
- cryptographically secure random numbers before it's actually possible
- to generate those numbers securely. This setting ensures that these
- flaws don't go unnoticed, by enabling a message, should this ever
- occur. This will allow people with obscure setups to know when things
- are going wrong, so that they might contact developers about fixing
- it.
-
- Unfortunately, on some models of some architectures getting
- a fully seeded CRNG is extremely difficult, and so this can
- result in dmesg getting spammed for a surprisingly long
- time. This is really bad from a security perspective, and
- so architecture maintainers really need to do what they can
- to get the CRNG seeded sooner after the system is booted.
- However, since users cannot do anything actionable to
- address this, by default this option is disabled.
-
- Say Y here if you want to receive warnings for all uses of
- unseeded randomness. This will be of use primarily for
- those developers interested in improving the security of
- Linux kernels running on their architecture (or
- subarchitecture).
-
config DEBUG_KOBJECT
bool "kobject debugging"
depends on DEBUG_KERNEL
diff --git a/lib/bootconfig.c b/lib/bootconfig.c
index 449369a60846..2da049216fe0 100644
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@ -316,7 +316,7 @@ int __init xbc_node_compose_key_after(struct xbc_node *root,
depth ? "." : "");
if (ret < 0)
return ret;
- if (ret > size) {
+ if (ret >= size) {
size = 0;
} else {
size -= ret;
@@ -532,9 +532,9 @@ static char *skip_spaces_until_newline(char *p)
static int __init __xbc_open_brace(char *p)
{
/* Push the last key as open brace */
- open_brace[brace_index++] = xbc_node_index(last_parent);
if (brace_index >= XBC_DEPTH_MAX)
return xbc_parse_error("Exceed max depth of braces", p);
+ open_brace[brace_index++] = xbc_node_index(last_parent);
return 0;
}
@@ -802,7 +802,7 @@ static int __init xbc_verify_tree(void)
/* Brace closing */
if (brace_index) {
- n = &xbc_nodes[open_brace[brace_index]];
+ n = &xbc_nodes[open_brace[brace_index - 1]];
return xbc_parse_error("Brace is not closed",
xbc_node_get_data(n));
}
diff --git a/lib/crypto/.kunitconfig b/lib/crypto/.kunitconfig
new file mode 100644
index 000000000000..6b2ce28ae509
--- /dev/null
+++ b/lib/crypto/.kunitconfig
@@ -0,0 +1,34 @@
+CONFIG_KUNIT=y
+
+# These kconfig options select all the CONFIG_CRYPTO_LIB_* symbols that have a
+# corresponding KUnit test. Those symbols cannot be directly enabled here,
+# since they are hidden symbols.
+CONFIG_CRYPTO=y
+CONFIG_CRYPTO_ADIANTUM=y
+CONFIG_CRYPTO_BLAKE2B=y
+CONFIG_CRYPTO_CHACHA20POLY1305=y
+CONFIG_CRYPTO_HCTR2=y
+CONFIG_CRYPTO_MD5=y
+CONFIG_CRYPTO_MLDSA=y
+CONFIG_CRYPTO_SHA1=y
+CONFIG_CRYPTO_SHA256=y
+CONFIG_CRYPTO_SHA512=y
+CONFIG_CRYPTO_SHA3=y
+CONFIG_INET=y
+CONFIG_IPV6=y
+CONFIG_NET=y
+CONFIG_NETDEVICES=y
+CONFIG_WIREGUARD=y
+
+CONFIG_CRYPTO_LIB_BLAKE2B_KUNIT_TEST=y
+CONFIG_CRYPTO_LIB_BLAKE2S_KUNIT_TEST=y
+CONFIG_CRYPTO_LIB_CURVE25519_KUNIT_TEST=y
+CONFIG_CRYPTO_LIB_MD5_KUNIT_TEST=y
+CONFIG_CRYPTO_LIB_MLDSA_KUNIT_TEST=y
+CONFIG_CRYPTO_LIB_NH_KUNIT_TEST=y
+CONFIG_CRYPTO_LIB_POLY1305_KUNIT_TEST=y
+CONFIG_CRYPTO_LIB_POLYVAL_KUNIT_TEST=y
+CONFIG_CRYPTO_LIB_SHA1_KUNIT_TEST=y
+CONFIG_CRYPTO_LIB_SHA256_KUNIT_TEST=y
+CONFIG_CRYPTO_LIB_SHA512_KUNIT_TEST=y
+CONFIG_CRYPTO_LIB_SHA3_KUNIT_TEST=y
diff --git a/lib/crypto/tests/Kconfig b/lib/crypto/tests/Kconfig
index 4970463ea0aa..0de289b429a9 100644
--- a/lib/crypto/tests/Kconfig
+++ b/lib/crypto/tests/Kconfig
@@ -2,10 +2,9 @@
config CRYPTO_LIB_BLAKE2B_KUNIT_TEST
tristate "KUnit tests for BLAKE2b" if !KUNIT_ALL_TESTS
- depends on KUNIT
+ depends on KUNIT && CRYPTO_LIB_BLAKE2B
default KUNIT_ALL_TESTS || CRYPTO_SELFTESTS
select CRYPTO_LIB_BENCHMARK_VISIBLE
- select CRYPTO_LIB_BLAKE2B
help
KUnit tests for the BLAKE2b cryptographic hash function.
@@ -14,71 +13,64 @@ config CRYPTO_LIB_BLAKE2S_KUNIT_TEST
depends on KUNIT
default KUNIT_ALL_TESTS || CRYPTO_SELFTESTS
select CRYPTO_LIB_BENCHMARK_VISIBLE
- # No need to select CRYPTO_LIB_BLAKE2S here, as that option doesn't
+ # No need to depend on CRYPTO_LIB_BLAKE2S here, as that option doesn't
# exist; the BLAKE2s code is always built-in for the /dev/random driver.
help
KUnit tests for the BLAKE2s cryptographic hash function.
config CRYPTO_LIB_CURVE25519_KUNIT_TEST
tristate "KUnit tests for Curve25519" if !KUNIT_ALL_TESTS
- depends on KUNIT
+ depends on KUNIT && CRYPTO_LIB_CURVE25519
default KUNIT_ALL_TESTS || CRYPTO_SELFTESTS
select CRYPTO_LIB_BENCHMARK_VISIBLE
- select CRYPTO_LIB_CURVE25519
help
KUnit tests for the Curve25519 Diffie-Hellman function.
config CRYPTO_LIB_MD5_KUNIT_TEST
tristate "KUnit tests for MD5" if !KUNIT_ALL_TESTS
- depends on KUNIT
+ depends on KUNIT && CRYPTO_LIB_MD5
default KUNIT_ALL_TESTS || CRYPTO_SELFTESTS
select CRYPTO_LIB_BENCHMARK_VISIBLE
- select CRYPTO_LIB_MD5
help
KUnit tests for the MD5 cryptographic hash function and its
corresponding HMAC.
config CRYPTO_LIB_MLDSA_KUNIT_TEST
tristate "KUnit tests for ML-DSA" if !KUNIT_ALL_TESTS
- depends on KUNIT
+ depends on KUNIT && CRYPTO_LIB_MLDSA
default KUNIT_ALL_TESTS || CRYPTO_SELFTESTS
select CRYPTO_LIB_BENCHMARK_VISIBLE
- select CRYPTO_LIB_MLDSA
help
KUnit tests for the ML-DSA digital signature algorithm.
config CRYPTO_LIB_NH_KUNIT_TEST
tristate "KUnit tests for NH" if !KUNIT_ALL_TESTS
- depends on KUNIT
+ depends on KUNIT && CRYPTO_LIB_NH
default KUNIT_ALL_TESTS || CRYPTO_SELFTESTS
- select CRYPTO_LIB_NH
help
KUnit tests for the NH almost-universal hash function.
config CRYPTO_LIB_POLY1305_KUNIT_TEST
tristate "KUnit tests for Poly1305" if !KUNIT_ALL_TESTS
- depends on KUNIT
+ depends on KUNIT && CRYPTO_LIB_POLY1305
default KUNIT_ALL_TESTS || CRYPTO_SELFTESTS
select CRYPTO_LIB_BENCHMARK_VISIBLE
- select CRYPTO_LIB_POLY1305
help
KUnit tests for the Poly1305 library functions.
config CRYPTO_LIB_POLYVAL_KUNIT_TEST
tristate "KUnit tests for POLYVAL" if !KUNIT_ALL_TESTS
- depends on KUNIT
+ depends on KUNIT && CRYPTO_LIB_POLYVAL
default KUNIT_ALL_TESTS || CRYPTO_SELFTESTS
select CRYPTO_LIB_BENCHMARK_VISIBLE
- select CRYPTO_LIB_POLYVAL
help
KUnit tests for the POLYVAL library functions.
config CRYPTO_LIB_SHA1_KUNIT_TEST
tristate "KUnit tests for SHA-1" if !KUNIT_ALL_TESTS
- depends on KUNIT
+ depends on KUNIT && CRYPTO_LIB_SHA1
default KUNIT_ALL_TESTS || CRYPTO_SELFTESTS
select CRYPTO_LIB_BENCHMARK_VISIBLE
- select CRYPTO_LIB_SHA1
help
KUnit tests for the SHA-1 cryptographic hash function and its
corresponding HMAC.
@@ -87,10 +79,9 @@ config CRYPTO_LIB_SHA1_KUNIT_TEST
# included, for consistency with the naming used elsewhere (e.g. CRYPTO_SHA256).
config CRYPTO_LIB_SHA256_KUNIT_TEST
tristate "KUnit tests for SHA-224 and SHA-256" if !KUNIT_ALL_TESTS
- depends on KUNIT
+ depends on KUNIT && CRYPTO_LIB_SHA256
default KUNIT_ALL_TESTS || CRYPTO_SELFTESTS
select CRYPTO_LIB_BENCHMARK_VISIBLE
- select CRYPTO_LIB_SHA256
help
KUnit tests for the SHA-224 and SHA-256 cryptographic hash functions
and their corresponding HMACs.
@@ -99,20 +90,18 @@ config CRYPTO_LIB_SHA256_KUNIT_TEST
# included, for consistency with the naming used elsewhere (e.g. CRYPTO_SHA512).
config CRYPTO_LIB_SHA512_KUNIT_TEST
tristate "KUnit tests for SHA-384 and SHA-512" if !KUNIT_ALL_TESTS
- depends on KUNIT
+ depends on KUNIT && CRYPTO_LIB_SHA512
default KUNIT_ALL_TESTS || CRYPTO_SELFTESTS
select CRYPTO_LIB_BENCHMARK_VISIBLE
- select CRYPTO_LIB_SHA512
help
KUnit tests for the SHA-384 and SHA-512 cryptographic hash functions
and their corresponding HMACs.
config CRYPTO_LIB_SHA3_KUNIT_TEST
tristate "KUnit tests for SHA-3" if !KUNIT_ALL_TESTS
- depends on KUNIT
+ depends on KUNIT && CRYPTO_LIB_SHA3
default KUNIT_ALL_TESTS || CRYPTO_SELFTESTS
select CRYPTO_LIB_BENCHMARK_VISIBLE
- select CRYPTO_LIB_SHA3
help
KUnit tests for the SHA3 cryptographic hash and XOF functions,
including SHA3-224, SHA3-256, SHA3-384, SHA3-512, SHAKE128 and
diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 89a1d6745dc2..12f50de85b62 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -398,9 +398,26 @@ static void fill_pool(void)
atomic_inc(&cpus_allocating);
while (pool_should_refill(&pool_global)) {
+ gfp_t gfp = __GFP_HIGH | __GFP_NOWARN;
HLIST_HEAD(head);
- if (!kmem_alloc_batch(&head, obj_cache, __GFP_HIGH | __GFP_NOWARN))
+ /*
+ * Allow reclaim only in preemptible context and during
+ * early boot. If not preemptible, the caller might hold
+ * locks causing a deadlock in the allocator.
+ *
+ * If the reclaim flag is not set during early boot then
+ * allocations, which happen before deferred page
+ * initialization has completed, will fail.
+ *
+ * In preemptible context the flag is harmless and not a
+ * performance issue as that's usually invoked from slow
+ * path initialization context.
+ */
+ if (preemptible() || system_state < SYSTEM_SCHEDULING)
+ gfp |= __GFP_KSWAPD_RECLAIM;
+
+ if (!kmem_alloc_batch(&head, obj_cache, gfp))
break;
guard(raw_spinlock_irqsave)(&pool_lock);
diff --git a/lib/kunit/test.c b/lib/kunit/test.c
index 62eb529824c6..41e1c89799b6 100644
--- a/lib/kunit/test.c
+++ b/lib/kunit/test.c
@@ -94,7 +94,7 @@ struct kunit_result_stats {
unsigned long total;
};
-static bool kunit_should_print_stats(struct kunit_result_stats stats)
+static bool kunit_should_print_stats(struct kunit_result_stats *stats)
{
if (kunit_stats_enabled == 0)
return false;
@@ -102,11 +102,11 @@ static bool kunit_should_print_stats(struct kunit_result_stats stats)
if (kunit_stats_enabled == 2)
return true;
- return (stats.total > 1);
+ return (stats->total > 1);
}
static void kunit_print_test_stats(struct kunit *test,
- struct kunit_result_stats stats)
+ struct kunit_result_stats *stats)
{
if (!kunit_should_print_stats(stats))
return;
@@ -115,10 +115,10 @@ static void kunit_print_test_stats(struct kunit *test,
KUNIT_SUBTEST_INDENT
"# %s: pass:%lu fail:%lu skip:%lu total:%lu",
test->name,
- stats.passed,
- stats.failed,
- stats.skipped,
- stats.total);
+ stats->passed,
+ stats->failed,
+ stats->skipped,
+ stats->total);
}
/* Append formatted message to log. */
@@ -600,26 +600,26 @@ static void kunit_run_case_catch_errors(struct kunit_suite *suite,
}
static void kunit_print_suite_stats(struct kunit_suite *suite,
- struct kunit_result_stats suite_stats,
- struct kunit_result_stats param_stats)
+ struct kunit_result_stats *suite_stats,
+ struct kunit_result_stats *param_stats)
{
if (kunit_should_print_stats(suite_stats)) {
kunit_log(KERN_INFO, suite,
"# %s: pass:%lu fail:%lu skip:%lu total:%lu",
suite->name,
- suite_stats.passed,
- suite_stats.failed,
- suite_stats.skipped,
- suite_stats.total);
+ suite_stats->passed,
+ suite_stats->failed,
+ suite_stats->skipped,
+ suite_stats->total);
}
if (kunit_should_print_stats(param_stats)) {
kunit_log(KERN_INFO, suite,
"# Totals: pass:%lu fail:%lu skip:%lu total:%lu",
- param_stats.passed,
- param_stats.failed,
- param_stats.skipped,
- param_stats.total);
+ param_stats->passed,
+ param_stats->failed,
+ param_stats->skipped,
+ param_stats->total);
}
}
@@ -681,13 +681,116 @@ static void kunit_init_parent_param_test(struct kunit_case *test_case, struct ku
}
}
-int kunit_run_tests(struct kunit_suite *suite)
+static noinline_for_stack void
+kunit_run_param_test(struct kunit_suite *suite, struct kunit_case *test_case,
+ struct kunit *test,
+ struct kunit_result_stats *suite_stats,
+ struct kunit_result_stats *total_stats,
+ struct kunit_result_stats *param_stats)
{
char param_desc[KUNIT_PARAM_DESC_SIZE];
+ const void *curr_param;
+
+ kunit_init_parent_param_test(test_case, test);
+ if (test_case->status == KUNIT_FAILURE) {
+ kunit_update_stats(param_stats, test->status);
+ return;
+ }
+ /* Get initial param. */
+ param_desc[0] = '\0';
+ /* TODO: Make generate_params try-catch */
+ curr_param = test_case->generate_params(test, NULL, param_desc);
+ test_case->status = KUNIT_SKIPPED;
+ kunit_log(KERN_INFO, test, KUNIT_SUBTEST_INDENT KUNIT_SUBTEST_INDENT
+ "KTAP version 1\n");
+ kunit_log(KERN_INFO, test, KUNIT_SUBTEST_INDENT KUNIT_SUBTEST_INDENT
+ "# Subtest: %s", test_case->name);
+ if (test->params_array.params &&
+ test_case->generate_params == kunit_array_gen_params) {
+ kunit_log(KERN_INFO, test, KUNIT_SUBTEST_INDENT
+ KUNIT_SUBTEST_INDENT "1..%zd\n",
+ test->params_array.num_params);
+ }
+
+ while (curr_param) {
+ struct kunit param_test = {
+ .param_value = curr_param,
+ .param_index = ++test->param_index,
+ .parent = test,
+ };
+ kunit_init_test(&param_test, test_case->name, NULL);
+ param_test.log = test_case->log;
+ kunit_run_case_catch_errors(suite, test_case, &param_test);
+
+ if (param_desc[0] == '\0') {
+ snprintf(param_desc, sizeof(param_desc),
+ "param-%d", param_test.param_index);
+ }
+
+ kunit_print_ok_not_ok(&param_test, KUNIT_LEVEL_CASE_PARAM,
+ param_test.status,
+ param_test.param_index,
+ param_desc,
+ param_test.status_comment);
+
+ kunit_update_stats(param_stats, param_test.status);
+
+ /* Get next param. */
+ param_desc[0] = '\0';
+ curr_param = test_case->generate_params(test, curr_param,
+ param_desc);
+ }
+ /*
+ * TODO: Put into a try catch. Since we don't need suite->exit
+ * for it we can't reuse kunit_try_run_cleanup for this yet.
+ */
+ if (test_case->param_exit)
+ test_case->param_exit(test);
+ /* TODO: Put this kunit_cleanup into a try-catch. */
+ kunit_cleanup(test);
+}
+
+static noinline_for_stack void
+kunit_run_one_test(struct kunit_suite *suite, struct kunit_case *test_case,
+ struct kunit_result_stats *suite_stats,
+ struct kunit_result_stats *total_stats)
+{
+ struct kunit test = { .param_value = NULL, .param_index = 0 };
+ struct kunit_result_stats param_stats = { 0 };
+
+ kunit_init_test(&test, test_case->name, test_case->log);
+ if (test_case->status == KUNIT_SKIPPED) {
+ /* Test marked as skip */
+ test.status = KUNIT_SKIPPED;
+ kunit_update_stats(&param_stats, test.status);
+ } else if (!test_case->generate_params) {
+ /* Non-parameterised test. */
+ test_case->status = KUNIT_SKIPPED;
+ kunit_run_case_catch_errors(suite, test_case, &test);
+ kunit_update_stats(&param_stats, test.status);
+ } else {
+ kunit_run_param_test(suite, test_case, &test, suite_stats,
+ total_stats, &param_stats);
+ }
+ kunit_print_attr((void *)test_case, true, KUNIT_LEVEL_CASE);
+
+ kunit_print_test_stats(&test, &param_stats);
+
+ kunit_print_ok_not_ok(&test, KUNIT_LEVEL_CASE, test_case->status,
+ kunit_test_case_num(suite, test_case),
+ test_case->name,
+ test.status_comment);
+
+ kunit_update_stats(suite_stats, test_case->status);
+ kunit_accumulate_stats(total_stats, param_stats);
+}
+
+
+int kunit_run_tests(struct kunit_suite *suite)
+{
struct kunit_case *test_case;
struct kunit_result_stats suite_stats = { 0 };
struct kunit_result_stats total_stats = { 0 };
- const void *curr_param;
/* Taint the kernel so we know we've run tests. */
add_taint(TAINT_TEST, LOCKDEP_STILL_OK);
@@ -703,97 +806,13 @@ int kunit_run_tests(struct kunit_suite *suite)
kunit_print_suite_start(suite);
- kunit_suite_for_each_test_case(suite, test_case) {
- struct kunit test = { .param_value = NULL, .param_index = 0 };
- struct kunit_result_stats param_stats = { 0 };
-
- kunit_init_test(&test, test_case->name, test_case->log);
- if (test_case->status == KUNIT_SKIPPED) {
- /* Test marked as skip */
- test.status = KUNIT_SKIPPED;
- kunit_update_stats(&param_stats, test.status);
- } else if (!test_case->generate_params) {
- /* Non-parameterised test. */
- test_case->status = KUNIT_SKIPPED;
- kunit_run_case_catch_errors(suite, test_case, &test);
- kunit_update_stats(&param_stats, test.status);
- } else {
- kunit_init_parent_param_test(test_case, &test);
- if (test_case->status == KUNIT_FAILURE) {
- kunit_update_stats(&param_stats, test.status);
- goto test_case_end;
- }
- /* Get initial param. */
- param_desc[0] = '\0';
- /* TODO: Make generate_params try-catch */
- curr_param = test_case->generate_params(&test, NULL, param_desc);
- test_case->status = KUNIT_SKIPPED;
- kunit_log(KERN_INFO, &test, KUNIT_SUBTEST_INDENT KUNIT_SUBTEST_INDENT
- "KTAP version 1\n");
- kunit_log(KERN_INFO, &test, KUNIT_SUBTEST_INDENT KUNIT_SUBTEST_INDENT
- "# Subtest: %s", test_case->name);
- if (test.params_array.params &&
- test_case->generate_params == kunit_array_gen_params) {
- kunit_log(KERN_INFO, &test, KUNIT_SUBTEST_INDENT
- KUNIT_SUBTEST_INDENT "1..%zd\n",
- test.params_array.num_params);
- }
-
- while (curr_param) {
- struct kunit param_test = {
- .param_value = curr_param,
- .param_index = ++test.param_index,
- .parent = &test,
- };
- kunit_init_test(&param_test, test_case->name, NULL);
- param_test.log = test_case->log;
- kunit_run_case_catch_errors(suite, test_case, &param_test);
-
- if (param_desc[0] == '\0') {
- snprintf(param_desc, sizeof(param_desc),
- "param-%d", param_test.param_index);
- }
-
- kunit_print_ok_not_ok(&param_test, KUNIT_LEVEL_CASE_PARAM,
- param_test.status,
- param_test.param_index,
- param_desc,
- param_test.status_comment);
-
- kunit_update_stats(&param_stats, param_test.status);
-
- /* Get next param. */
- param_desc[0] = '\0';
- curr_param = test_case->generate_params(&test, curr_param,
- param_desc);
- }
- /*
- * TODO: Put into a try catch. Since we don't need suite->exit
- * for it we can't reuse kunit_try_run_cleanup for this yet.
- */
- if (test_case->param_exit)
- test_case->param_exit(&test);
- /* TODO: Put this kunit_cleanup into a try-catch. */
- kunit_cleanup(&test);
- }
-test_case_end:
- kunit_print_attr((void *)test_case, true, KUNIT_LEVEL_CASE);
-
- kunit_print_test_stats(&test, param_stats);
-
- kunit_print_ok_not_ok(&test, KUNIT_LEVEL_CASE, test_case->status,
- kunit_test_case_num(suite, test_case),
- test_case->name,
- test.status_comment);
-
- kunit_update_stats(&suite_stats, test_case->status);
- kunit_accumulate_stats(&total_stats, param_stats);
- }
+ kunit_suite_for_each_test_case(suite, test_case)
+ kunit_run_one_test(suite, test_case, &suite_stats, &total_stats);
if (suite->suite_exit)
suite->suite_exit(suite);
- kunit_print_suite_stats(suite, suite_stats, total_stats);
+ kunit_print_suite_stats(suite, &suite_stats, &total_stats);
suite_end:
kunit_print_suite_end(suite);