linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gow <davidgow@google.com>
To: Brendan Higgins <brendanhiggins@google.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Daniel Latypov <dlatypov@google.com>, Rae Moar <rmoar@google.com>,
	KUnit Development <kunit-dev@googlegroups.com>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] kunit: Print test statistics on failure
Date: Fri, 13 Aug 2021 13:41:08 +0800	[thread overview]
Message-ID: <CABVgOSnLeeRJzn0G3pcVKiByuFTZ3SJd9hU5aR5fr4=sFGbB8Q@mail.gmail.com> (raw)
In-Reply-To: <CAFd5g44suSKUDXhAh6CNewGeg00BDJurYNMyY4vaAsaEZ1puWQ@mail.gmail.com>

On Fri, Aug 6, 2021 at 2:15 AM 'Brendan Higgins' via KUnit Development
<kunit-dev@googlegroups.com> wrote:
>
> On Tue, Aug 3, 2021 at 10:08 PM David Gow <davidgow@google.com> wrote:
> >
> > When a number of tests fail, it can be useful to get higher-level
> > statistics of how many tests are failing (or how many parameters are
> > failing in parameterised tests), and in what cases or suites. This is
> > already done by some non-KUnit tests, so add support for automatically
> > generating these for KUnit tests.
> >
> > This change adds a 'kunit.stats_enabled' switch which has three values:
> > - 0: No stats are printed (current behaviour)
> > - 1: Stats are printed only for tests/suites with more than one
> >      subtest (new default)
> > - 2: Always print test statistics
> >
> > For parameterised tests, the summary line looks as follows:
> > "    # inode_test_xtimestamp_decoding: pass:16 fail:0 skip:0 total:16"
> > For test suites, there are two lines looking like this:
> > "# ext4_inode_test: pass:1 fail:0 skip:0 total:1"
> > "# Totals: pass:16 fail:0 skip:0 total:16"
> >
> > The first line gives the number of direct subtests, the second "Totals"
> > line is the accumulated sum of all tests and test parameters.
> >
> > This format is based on the one used by kselftest[1].
> >
> > [1]: https://elixir.bootlin.com/linux/latest/source/tools/testing/selftests/kselftest.h#L109
> >
> > Signed-off-by: David Gow <davidgow@google.com>
>
> This looks great, David!
>
> My only suggestion, can you maybe provide a sample of the TAP output
> with your change running on the thread? I think it looks great, but I
> imagine that it has the potential of being more interesting to people
> other than you, Daniel, and myself rather than the actual code change.
> (To be clear, I think the summary and the code both look good, IMO.)

Sure. The lines in the commit description I think cover the actual
change pretty well:

"    # inode_test_xtimestamp_decoding: pass:16 fail:0 skip:0 total:16"

"# ext4_inode_test: pass:1 fail:0 skip:0 total:1"
"# Totals: pass:16 fail:0 skip:0 total:16"

Nevertheless, here's the complete output of the 'example' and
'rational' suites, which should give a more complete overview. (This
is with the default configuration of only printing out lines where the
number of subtests is >1)

TAP version 14
1..2
   # Subtest: example
   1..3
   # example_simple_test: initializing
   ok 1 - example_simple_test
   # example_skip_test: initializing
   # example_skip_test: You should not see a line below.
   ok 2 - example_skip_test # SKIP this test should be skipped
   # example_mark_skipped_test: initializing
   # example_mark_skipped_test: You should see a line below.
   # example_mark_skipped_test: You should see this line.
   ok 3 - example_mark_skipped_test # SKIP this test should be skipped
# example: pass:1 fail:0 skip:2 total:3
# Totals: pass:1 fail:0 skip:2 total:3
ok 1 - example
   # Subtest: rational
   1..1
   # rational_test: ok 1 - Exceeds bounds, semi-convergent term > 1/2 last term
   # rational_test: ok 2 - Exceeds bounds, semi-convergent term < 1/2 last term
   # rational_test: ok 3 - Closest to zero
   # rational_test: ok 4 - Closest to smallest non-zero
   # rational_test: ok 5 - Use convergent
   # rational_test: ok 6 - Exact answer
   # rational_test: ok 7 - Semiconvergent, numerator limit
   # rational_test: ok 8 - Semiconvergent, denominator limit
   # rational_test: pass:8 fail:0 skip:0 total:8
   ok 1 - rational_test
# Totals: pass:8 fail:0 skip:0 total:8
ok 2 - rational

      reply	other threads:[~2021-08-13  5:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04  5:08 [PATCH v2] kunit: Print test statistics on failure David Gow
2021-08-04  7:42 ` Andy Shevchenko
2021-08-04 18:39 ` Daniel Latypov
2021-08-05 18:14 ` Brendan Higgins
2021-08-13  5:41   ` David Gow [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABVgOSnLeeRJzn0G3pcVKiByuFTZ3SJd9hU5aR5fr4=sFGbB8Q@mail.gmail.com' \
    --to=davidgow@google.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=brendanhiggins@google.com \
    --cc=dlatypov@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=rmoar@google.com \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).