Skip to content

Commit 8a446cb

Browse files
committed
doc: Add a kdoc test for API docs
Even when we're not building docs, it would be handy to have an easy check that the kernel-doc comments do not produce warnings or errors. This change adds a test() defintion to docs/, which calls a simple script, kernel-doc-check. This script invokes kernel-doc, looking for error and/or warning output. Signed-off-by: Jeremy Kerr <[email protected]>
1 parent e33cc17 commit 8a446cb

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

doc/kernel-doc-check

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: LGPL-2.1-or-later
3+
4+
kernel_doc=$(dirname $0)/kernel-doc
5+
6+
"$kernel_doc" -none "$@" 2>&1 |
7+
grep '\(warning\|error\)'
8+
9+
# check that kernel-doc succeeded, but the grep failed
10+
[ ${PIPESTATUS[0]} -eq 0 -a ${PIPESTATUS[1]} -eq 1 ]

doc/meson.build

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ subdir('rst')
4646

4747
want_docs = get_option('docs')
4848
want_docs_build = get_option('docs-build')
49+
kernel_doc = find_program('kernel-doc')
50+
kernel_doc_check = find_program('kernel-doc-check')
51+
52+
test('kdoc', kernel_doc_check, args: api_paths)
53+
4954
if want_docs != 'false'
50-
kernel_doc = find_program('kernel-doc')
5155

5256
conf = configuration_data()
5357
conf.set('SYSCONFDIR', sysconfdir)

0 commit comments

Comments
 (0)