linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
To: Daniel Latypov <dlatypov@google.com>
Cc: "Isabella Basso" <isabbasso@riseup.net>,
	linux-kselftest@vger.kernel.org,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"KUnit Development" <kunit-dev@googlegroups.com>,
	"Magali Lemes" <magalilemes00@gmail.com>,
	"Maíra Canal" <maira.canal@usp.br>,
	n@nfraprado.net, "kernel list" <linux-kernel@vger.kernel.org>,
	leandro.ribeiro@collabora.com, igt-dev@lists.freedesktop.org,
	"ML dri-devel" <dri-devel@lists.freedesktop.org>,
	"David Gow" <davidgow@google.com>,
	"Tales Aparecida" <tales.aparecida@gmail.com>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"André Almeida" <andrealmeid@riseup.net>,
	"Brendan Higgins" <brendanhiggins@google.com>,
	"Trevor Woerner" <twoerner@gmail.com>
Subject: Re: [igt-dev] [PATCH i-g-t v2 3/4] lib/igt_kmod: add compatibility for KUnit
Date: Tue, 1 Nov 2022 13:43:34 +0100	[thread overview]
Message-ID: <20221101134334.59500e01@maurocar-mobl2> (raw)
In-Reply-To: <CAGS_qxpCPTSRNAyejL0gS0pZAoVNp9SdFwPFkHRyn5yMuPGkLw@mail.gmail.com>

On Mon, 19 Sep 2022 17:25:38 -0700
Daniel Latypov <dlatypov@google.com> wrote:

> On Mon, Sep 19, 2022 at 1:43 PM Isabella Basso <isabbasso@riseup.net> wrote:
> > >> +        * "(K)TAP version XX" should be the first line on all (sub)tests as per
> > >> +        * https://www.kernel.org/doc/html/latest/dev-tools/ktap.html#version-lines
> > >> +        * but actually isn't, as it currently depends on whoever writes the
> > >> +        * test to print this info  
> > >
> > > FYI: we're really trying to fix cases of "missing version lines",
> > > largely by making the kunit_test_suites() macro work in more
> > > circumstances.
> > >
> > > So while it may be worth still handling the case where this is
> > > missing, I don't think there are any tests in the latest versions of
> > > the kernel which should have this missing.  
> >
> > I’m not sure if I totally get how these work. Every time I run a KUnit test I
> > get something like this: https://pastebin.com/7Ff31PMC
> >
> > As you can see it has been loaded as a module, just like we intend to do it
> > from IGT, and I see no version lines whatsoever. Am I doing something wrong?  
> 
> You're doing everything right.
> 
> The problem is we only print the version line for the *built-in* tests.
> It never gets printed for tests in loadable modules.

IGT tests require loadable modules, as some tests check if bind/unbind
and load/unload works. Also, some tests require modprobing drivers
with different parameters.

Unfortunately, kunit.py is currently broken on such cases: its parser
simply ignores everything if the subtest doesn't have a TAP version
just before it. See:

	$ ./tools/testing/kunit/kunit.py parse /var/log/dmesg
	[12:37:05] ============================================================
	[12:37:05] [ERROR] Test: main: 0 tests run!
	[12:37:05] ============================================================
	[12:37:05] Testing complete. Ran 0 tests: errors: 1

Here, I loaded the test module twice. I can force it to parse it by
doing

	$ (dmesg|grep "TAP version"; dmesg|grep -A9999 intel_i915_mock) >logs 

But then, it gets confused with two subtests with the same name:

	$ ./tools/testing/kunit/kunit.py parse logs
	[12:37:34] ============================================================
	[12:37:34] ============== intel_i915_mock (18 subtests) ===============
	[12:37:34] [PASSED] sanitycheck
	[12:37:34] [PASSED] shmem
	[12:37:34] [PASSED] fence
	[12:37:34] [PASSED] scatterlist
	[12:37:34] [PASSED] syncmap
	[12:37:34] [PASSED] uncore
	[12:37:34] [PASSED] ring
	[12:37:34] [PASSED] engine
	[12:37:34] [PASSED] timelines
	[12:37:34] [PASSED] requests
	[12:37:34] [PASSED] objects
	[12:37:34] [PASSED] phys
	[12:37:34] [PASSED] dmabuf
	[12:37:34] [PASSED] vma
	[12:37:34] [PASSED] evict
	[12:37:34] [PASSED] gtt
	[12:37:34] [PASSED] hugepages
	[12:37:34] [PASSED] memory_region
	[12:37:34] ================= [PASSED] intel_i915_mock =================
	[12:37:34] ============== intel_i915_mock (18 subtests) ===============
	[12:37:34] [PASSED] sanitycheck
	[12:37:34] [PASSED] shmem
	[12:37:34] [PASSED] fence
	[12:37:34] [PASSED] scatterlist
	[12:37:34] [PASSED] syncmap
	[12:37:34] [PASSED] uncore
	[12:37:34] [PASSED] ring
	[12:37:34] [PASSED] engine
	[12:37:34] [PASSED] timelines
	[12:37:34] [PASSED] requests
	[12:37:34] [PASSED] objects
	[12:37:34] [PASSED] phys
	[12:37:34] [PASSED] dmabuf
	[12:37:34] [PASSED] vma
	[12:37:34] [PASSED] evict
	[12:37:34] [PASSED] gtt
	[12:37:34] [PASSED] hugepages
	[12:37:34] [PASSED] memory_region
	[12:37:34] [ERROR] Test: intel_i915_mock: Expected test number 2 but found 1
	[12:37:34] ================= [PASSED] intel_i915_mock =================
	[12:37:34] ============================================================
	[12:37:34] Testing complete. Ran 36 tests: passed: 36, errors: 1

> Some more details below, if interested.
> Specifically, it happens in
> https://elixir.bootlin.com/linux/latest/C/ident/kunit_print_tap_header
> 
> What David is referring to is we had tests that weren't in modules,
> but didn't use the normal built-in code path. Those were also missing
> TAP version lines.
> But KUnit needs to do better here in the case of modules.
> 
> The goal was that you'd be able to parse the result of module based
> tests by something like
> $ cat /sys/kernel/debug/kunit/*/results | ./tools/testing/kunit/kunit.py parse
> but this doesn't work because of the lack of a version line.

At least here, debug/kunit doesn't exist:

	sudo ls -lctra /sys/kernel/debug/|grep kunit

> 
> If we add it to each module's test results, then we'll need to update
> the parse to allow multiple verison lines, I think.

Yeah, the parser is currently broken when used with modules.

Regards,
Mauro

  reply	other threads:[~2022-11-01 12:43 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29  0:09 [PATCH i-g-t v2 0/4] Add support for KUnit tests Isabella Basso
2022-08-29  0:09 ` [PATCH i-g-t v2 1/4] lib/igt_kmod: rename kselftest functions to ktest Isabella Basso
2022-09-09 15:05   ` [igt-dev] " Janusz Krzysztofik
2022-08-29  0:09 ` [PATCH i-g-t v2 2/4] lib/igt_kmod.c: check if module is builtin before attempting to unload it Isabella Basso
2022-09-09 15:10   ` [igt-dev] " Janusz Krzysztofik
2022-08-29  0:09 ` [PATCH i-g-t v2 3/4] lib/igt_kmod: add compatibility for KUnit Isabella Basso
2022-09-01  6:37   ` David Gow
2022-09-19 20:43     ` Isabella Basso
2022-09-20  0:25       ` Daniel Latypov
2022-11-01 12:43         ` Mauro Carvalho Chehab [this message]
2022-11-01 12:33       ` [igt-dev] " Mauro Carvalho Chehab
2022-11-01 17:17         ` Isabella Basso
2022-11-01 18:03           ` Mauro Carvalho Chehab
2022-11-01 12:29     ` Mauro Carvalho Chehab
2022-09-09 15:18   ` Janusz Krzysztofik
2022-09-19 20:55     ` Isabella Basso
2023-02-10 14:56       ` Janusz Krzysztofik
2023-02-10 16:55         ` Isabella Basso
2023-02-14  9:50           ` Janusz Krzysztofik
2022-11-03  9:48   ` Mauro Carvalho Chehab
2022-11-03 11:40     ` Mauro Carvalho Chehab
2022-11-03 12:35       ` Petri Latvala
2022-11-03 14:57     ` Mauro Carvalho Chehab
2022-08-29  0:09 ` [PATCH i-g-t v2 4/4] tests: DRM selftests: switch to KUnit Isabella Basso
2022-09-20  8:18   ` [igt-dev] " Petri Latvala
2022-11-01 12:54     ` Mauro Carvalho Chehab
2022-11-01 13:16       ` Petri Latvala
2022-11-01 13:53         ` Mauro Carvalho Chehab
2022-11-01 14:04           ` Daniel Latypov
2022-09-09 14:49 ` [igt-dev] [PATCH i-g-t v2 0/4] Add support for KUnit tests Janusz Krzysztofik

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=20221101134334.59500e01@maurocar-mobl2 \
    --to=mauro.chehab@linux.intel.com \
    --cc=andrealmeid@riseup.net \
    --cc=brendanhiggins@google.com \
    --cc=daniel@ffwll.ch \
    --cc=davidgow@google.com \
    --cc=dlatypov@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=isabbasso@riseup.net \
    --cc=kunit-dev@googlegroups.com \
    --cc=leandro.ribeiro@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=magalilemes00@gmail.com \
    --cc=maira.canal@usp.br \
    --cc=n@nfraprado.net \
    --cc=skhan@linuxfoundation.org \
    --cc=tales.aparecida@gmail.com \
    --cc=twoerner@gmail.com \
    /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).