Skip to content

Commit 0108463

Browse files
authored
Merge pull request #416 from CodeConstruct/kdoc-test
doc: Add a kdoc test for API docs
2 parents 25ee057 + 9f6d0ed commit 0108463

3 files changed

Lines changed: 41 additions & 45 deletions

File tree

.github/workflows/doc.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

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: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ api_files = [
2020
'util.h'
2121
]
2222

23+
api_paths = []
24+
foreach f: api_files
25+
api_paths += files('../src/nvme/' + f)
26+
endforeach
27+
2328
sphinx_sources = [
2429
'conf.py',
2530
'api.rst',
@@ -41,8 +46,12 @@ subdir('rst')
4146

4247
want_docs = get_option('docs')
4348
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+
4454
if want_docs != 'false'
45-
kernel_doc = find_program('kernel-doc')
4655

4756
conf = configuration_data()
4857
conf.set('SYSCONFDIR', sysconfdir)
@@ -51,29 +60,27 @@ if want_docs != 'false'
5160
mandir = join_paths(get_option('mandir'), 'man2')
5261
list_man_pages = find_program('list-man-pages.sh')
5362
if want_docs_build
54-
foreach apif : api_files
55-
foreach file : files('../src/nvme/' + apif)
56-
subst = configure_file(
57-
input: file,
58-
output: '@[email protected]',
59-
configuration: conf)
60-
c = run_command(list_man_pages, subst)
61-
man_pages = c.stdout().split()
62-
foreach page : man_pages
63-
custom_target(
64-
page.underscorify() + '_man',
65-
input: subst,
66-
output: page + '.2',
67-
capture: true,
68-
command: [kernel_doc,
69-
'-module', 'libnvme',
70-
'-man',
71-
'-function',
72-
page,
73-
subst],
74-
install: true,
75-
install_dir: mandir)
76-
endforeach
63+
foreach apif : api_paths
64+
subst = configure_file(
65+
input: file,
66+
output: '@[email protected]',
67+
configuration: conf)
68+
c = run_command(list_man_pages, subst)
69+
man_pages = c.stdout().split()
70+
foreach page : man_pages
71+
custom_target(
72+
page.underscorify() + '_man',
73+
input: subst,
74+
output: page + '.2',
75+
capture: true,
76+
command: [kernel_doc,
77+
'-module', 'libnvme',
78+
'-man',
79+
'-function',
80+
page,
81+
subst],
82+
install: true,
83+
install_dir: mandir)
7784
endforeach
7885
endforeach
7986
else

0 commit comments

Comments
 (0)