Re: [PATCH v2 00/25] kernel-doc: make it parse new functions and structs
From: Jacob Keller <jacob.e.keller@intel.com>
Date: 2026-01-28 22:08:55
Also in:
bpf, intel-wired-lan, linux-doc, lkml
On 1/28/2026 2:00 PM, Mauro Carvalho Chehab wrote:
On Wed, 28 Jan 2026 10:15:51 -0800 Jacob Keller [off-list ref] wrote:quoted
On 1/28/2026 9:27 AM, Jonathan Corbet wrote:quoted
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
quoted
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 unittestquoted
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.