]> git.ipfire.org Git - thirdparty/linux.git/commit
docs: unittests: add a parser to test kernel-doc parser logic
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 18 Mar 2026 09:11:09 +0000 (10:11 +0100)
committerJonathan Corbet <corbet@lwn.net>
Sun, 22 Mar 2026 21:10:40 +0000 (15:10 -0600)
commita5dea56ebd35a3027628b73db0968788e99c8412
treecfad33877bcf456f65f664209ccf6fc75ab5d2bc
parente394855fcc897f73f23c364a3a596b54cc879e4c
docs: unittests: add a parser to test kernel-doc parser logic

Validating that kernel-doc is parsing data properly is tricky.

Add an unittest skeleton that alllows passing a source code
and check if the corresponding values of export_table and
entries returned by the parser are properly filled.

It works by mocking a file input with the contents of a source
string, an comparing if:

- exports set matches;
- expected KernelItem entries match.

Create a new TestSelfValidate meant to check if the logic
inside KdocParser.run_test() does its job of checking for
differences inside KdocItem.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <8d91bfabd69de7aa44a0f5080ccb01aa41957e6d.1773823995.git.mchehab+huawei@kernel.org>
tools/unittests/test_kdoc_parser.py [new file with mode: 0755]