[PATCH v1 1/3] kunit: fix bug in debugfs logs of parameterized tests

From: Rae Moar
Date: Tue Jan 31 2023 - 17:04:12 EST


Fix bug in debugfs logs that causes parameterized results to not appear
in the log because the log is reintialized (cleared) when each parameter is
run.

Ensure these results appear in the debugfs logs and increase log size to
allow for the size of parameterized results.

Signed-off-by: Rae Moar <rmoar@xxxxxxxxxx>
---
include/kunit/test.h | 2 +-
lib/kunit/test.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/kunit/test.h b/include/kunit/test.h
index 87ea90576b50..0a077a4c067c 100644
--- a/include/kunit/test.h
+++ b/include/kunit/test.h
@@ -34,7 +34,7 @@ DECLARE_STATIC_KEY_FALSE(kunit_running);
struct kunit;

/* Size of log associated with test. */
-#define KUNIT_LOG_SIZE 512
+#define KUNIT_LOG_SIZE 1500

/* Maximum size of parameter description string. */
#define KUNIT_PARAM_DESC_SIZE 128
diff --git a/lib/kunit/test.c b/lib/kunit/test.c
index 51cae59d8aae..66ba93b8222c 100644
--- a/lib/kunit/test.c
+++ b/lib/kunit/test.c
@@ -437,7 +437,6 @@ static void kunit_run_case_catch_errors(struct kunit_suite *suite,
struct kunit_try_catch_context context;
struct kunit_try_catch *try_catch;

- kunit_init_test(test, test_case->name, test_case->log);
try_catch = &test->try_catch;

kunit_try_catch_init(try_catch,
@@ -533,6 +532,8 @@ int kunit_run_tests(struct kunit_suite *suite)
struct kunit_result_stats param_stats = { 0 };
test_case->status = KUNIT_SKIPPED;

+ kunit_init_test(&test, test_case->name, test_case->log);
+
if (!test_case->generate_params) {
/* Non-parameterised test. */
kunit_run_case_catch_errors(suite, test_case, &test);
--
2.39.1.456.gfc5497dd1b-goog