[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200415175825.GA79987@google.com>
Date: Wed, 15 Apr 2020 19:58:25 +0200
From: Marco Elver <elver@...gle.com>
To: Alan Maguire <alan.maguire@...cle.com>
Cc: brendanhiggins@...gle.com, frowand.list@...il.com,
gregkh@...uxfoundation.org, shuah@...nel.org,
linux-kselftest@...r.kernel.org, corbet@....net,
linux-kernel@...r.kernel.org, kunit-dev@...glegroups.com,
linux-doc@...r.kernel.org
Subject: Re: [PATCH v8 kunit-next 1/4] kunit: add debugfs
/sys/kernel/debug/kunit/<suite>/results display
Hello,
On Thu, 26 Mar 2020, Alan Maguire wrote:
> add debugfs support for displaying kunit test suite results; this is
> especially useful for module-loaded tests to allow disentangling of
> test result display from other dmesg events. debugfs support is
> provided if CONFIG_KUNIT_DEBUGFS=y.
>
> As well as printk()ing messages, we append them to a per-test log.
>
> Signed-off-by: Alan Maguire <alan.maguire@...cle.com>
> Reviewed-by: Brendan Higgins <brendanhiggins@...gle.com>
> Reviewed-by: Frank Rowand <frank.rowand@...y.com>
> ---
> include/kunit/test.h | 54 +++++++++++++++---
> lib/kunit/Kconfig | 8 +++
> lib/kunit/Makefile | 4 ++
> lib/kunit/debugfs.c | 116 ++++++++++++++++++++++++++++++++++++++
> lib/kunit/debugfs.h | 30 ++++++++++
> lib/kunit/kunit-test.c | 4 +-
> lib/kunit/test.c | 147 ++++++++++++++++++++++++++++++++++++++-----------
> 7 files changed, 322 insertions(+), 41 deletions(-)
> create mode 100644 lib/kunit/debugfs.c
> create mode 100644 lib/kunit/debugfs.h
>
[...]
> diff --git a/lib/kunit/test.c b/lib/kunit/test.c
> index 9242f93..a3fa21f 100644
> --- a/lib/kunit/test.c
> +++ b/lib/kunit/test.c
[...]
> -static void kunit_print_ok_not_ok(bool should_indent,
> +static void kunit_print_ok_not_ok(void *test_or_suite,
> + bool is_test,
> bool is_ok,
> size_t test_number,
> const char *description)
> {
> - const char *indent, *ok_not_ok;
> -
> - if (should_indent)
> - indent = "\t";
> - else
> - indent = "";
> + struct kunit_suite *suite = is_test ? NULL : test_or_suite;
> + struct kunit *test = is_test ? test_or_suite : NULL;
>
> - if (is_ok)
> - ok_not_ok = "ok";
> + /*
> + * We do not log the test suite results as doing so would
> + * mean debugfs display would consist of the test suite
> + * description and status prior to individual test results.
> + * Hence directly printk the suite status, and we will
> + * separately seq_printf() the suite status for the debugfs
> + * representation.
> + */
> + if (suite)
> + pr_info("%s %zd - %s",
I think this is missing '\n' -- is this intentional?
With v5.7-rc1, when I run a test via module, the final "ok" is only
printed once another message is printed to the kernel log (which can
take a while).
Thanks,
-- Marco
> + kunit_status_to_string(is_ok),
> + test_number, description);
> else
> - ok_not_ok = "not ok";
> -
> - pr_info("%s%s %zd - %s\n", indent, ok_not_ok, test_number, description);
> + kunit_log(KERN_INFO, test, "\t%s %zd - %s",
> + kunit_status_to_string(is_ok),
> + test_number, description);
> }
[...]
Powered by blists - more mailing lists