[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260129091401.0b86926c@foz.lan>
Date: Thu, 29 Jan 2026 09:14:01 +0100
From: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
To: Jacob Keller <jacob.e.keller@...el.com>
Cc: Jonathan Corbet <corbet@....net>, "David S. Miller"
<davem@...emloft.net>, Alexander Lobakin <aleksander.lobakin@...el.com>,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann
<daniel@...earbox.net>, Jakub Kicinski <kuba@...nel.org>, Jesper Dangaard
Brouer <hawk@...nel.org>, John Fastabend <john.fastabend@...il.com>, Mauro
Carvalho Chehab <mchehab@...nel.org>, Richard Cochran
<richardcochran@...il.com>, <bpf@...r.kernel.org>,
<intel-wired-lan@...ts.osuosl.org>, <linux-doc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>, Randy Dunlap
<rdunlap@...radead.org>, Shuah Khan <skhan@...uxfoundation.org>, "Stanislav
Fomichev" <sdf@...ichev.me>
Subject: Re: [PATCH v2 00/25] kernel-doc: make it parse new functions and
structs
On Wed, 28 Jan 2026 14:08:50 -0800
Jacob Keller <jacob.e.keller@...el.com> wrote:
> On 1/28/2026 2:00 PM, Mauro Carvalho Chehab wrote:
> > On Wed, 28 Jan 2026 10:15:51 -0800
> > Jacob Keller <jacob.e.keller@...el.com> wrote:
> >> On 1/28/2026 9:27 AM, Jonathan Corbet wrote:
> >>> Do we really need another unit-testing setup in the kernel? I can't say
> >>> I'm familiar enough with kunit to say whether it would work for
> >>> non-kernel code; have you looked and verified that it isn't suitable?
> >>>
> >>
> >> I'm not sure kunit would be suitable here, since its meant for running
> >> kernel code and does a lot of stuff to make that possible. It might be
> >> able to be extended, but.. this is python code. Why *shouldn't* we use
> >> one of the python unit test frameworks for it?
> >
> > This is not using kunit. It is using standard "import unittest" from
> > Python internal lib.
> >
>
> Right. I think it makes perfect sense to use unittest for python files.
> That was the point of my reply above :D
>
> >> We have other python code in tree. Does any of that code have unit tests?
> >
> > Good question. On a quick grep, it sounds so:
> >
> > $ git grep "import unittest" tools scripts
> > scripts/rust_is_available_test.py:import unittest
> > tools/crypto/ccp/test_dbc.py:import unittest
> > tools/perf/pmu-events/metric_test.py:import unittest
> > tools/testing/kunit/kunit_tool_test.py:import unittest
> > tools/testing/selftests/bpf/test_bpftool.py:import unittest
> > tools/testing/selftests/tpm2/tpm2.py:import unittest
> > tools/testing/selftests/tpm2/tpm2_tests.py:import unittest
> >
> >> I agree that it doesn't make sense to build new bespoke unit tests
> >> different or unique per each python module, so if we want to adopt
> >> python unit tests we should try to pick something that works for the
> >> python tools in the kernel.
> >>
> >> Perhaps finding a way to integrate this with kunit so that you can use
> >> "kunit run" and get python tests executed as well would make sense?
> >> But.. then again this isn't kernel code so I'm not sure it makes sense
> >> to conflate the tests with kernel unit tests.
> >
> > It shouldn't be hard to add it there - or to have a separate script
> > to run python unittests.
> >
>
> Right. Some way to have all unit tests run is nice so that its easy to
> hook up into various CI processes. Sounds like you have a solid idea on
> that.
>
> > That's said, some integration with kunit can be interesting
> > to have it producing a KTAP output if needed by some CI.
> >
> That could also be interesting, as it would make it easier for other
> tooling to work with all the tests.
>
> Personally I am not sure how useful that would be vs just making use of
> the unittest stuff provided as-is with python.
I'd say that, for now, we don't need a KTAP output, but as things go
more complex and more parts of the tools get unittests added, it
could make sense to add it.
Adding proper support for it shouldn't be hard with the definitions
inside unittest_helper. All we need to do would be to write a new
inherited class from unittest.TestResult, placing there a
printResults() method that would generate the KTAP format. We may
add a new "--ktap" argparse argument that, if enabled, it would
use the newer class instead of the Summary class.
Thanks,
Mauro
Powered by blists - more mailing lists