If a suite initialization fails, then our diagnostic message will include redundant indent and hash sign as all this was already added by the kunit_printk() used by kunit_err() macro. This could be easily seen if we force some error in our example test by modyfing example_test_init_suite() and running: $ ./tools/testing/kunit/kunit.py run --raw_output \ --kunitconfig ./lib/kunit/.kunitconfig "example.*" KTAP version 1 1..1 # example: initializing suite # example: # failed to initialize (-19) not ok 1 example Fix that and while around improve error code reporting by using error pointer format %pe that gives more user friendly output: KTAP version 1 1..1 # example: initializing suite # example: failed to initialize (-ENODEV) not ok 1 example Signed-off-by: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx> Cc: David Gow <davidgow@xxxxxxxxxx> Cc: Rae Moar <rmoar@xxxxxxxxxx> --- lib/kunit/test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/kunit/test.c b/lib/kunit/test.c index f2eb71f1a66c..fb5981ce578d 100644 --- a/lib/kunit/test.c +++ b/lib/kunit/test.c @@ -568,8 +568,8 @@ int kunit_run_tests(struct kunit_suite *suite) if (suite->suite_init) { suite->suite_init_err = suite->suite_init(suite); if (suite->suite_init_err) { - kunit_err(suite, KUNIT_SUBTEST_INDENT - "# failed to initialize (%d)", suite->suite_init_err); + kunit_err(suite, "failed to initialize (%pe)", + ERR_PTR(suite->suite_init_err)); goto suite_end; } } -- 2.25.1