summaryrefslogtreecommitdiff
path: root/doc/reference/check-doc-coverage.sh
blob: aa1ee52ef8b26b0efffd013d34628195d936a41c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh

LANG=C
if test -z "$DOC_MODULE"; then
	# extract from Makefile
	eval `grep '^DOC_MODULE' Makefile | sed 's/ //g'`
	if test -z "$DOC_MODULE"; then
		echo Failed extracting DOC_MODULE from Makefile 1>&2
		echo Try setting DOC_MODULE env var manually 1>&2
		exit 1
	fi
fi


test -z "$srcdir" && srcdir=.
stat=0

if test -f "$DOC_MODULE-undocumented.txt" -a -f "$DOC_MODULE-unused.txt"; then
	:
else
	echo At least one of "$DOC_MODULE-undocumented.txt" and "$DOC_MODULE-unused.txt" not found.
	echo Skipping test.
	exit 0
fi

if test -f "$DOC_MODULE-unused.txt"; then
	unused=`cat "$DOC_MODULE-unused.txt"`
	if test -n "$unused"; then
		echo Unused documentated symbols: 1>&2
		cat "$DOC_MODULE-unused.txt" 1>&2
		stat=1
	fi
fi
if test -f "$DOC_MODULE-undocumented.txt"; then
	if grep '^0 symbols incomplete' "$DOC_MODULE-undocumented.txt" >/dev/null &&
	   grep '^0 not documented'     "$DOC_MODULE-undocumented.txt" >/dev/null; then
		:
	else
		echo Incomplete or undocumented symbols: 1>&2
		cat "$DOC_MODULE-undocumented.txt" 1>&2
		stat=1
	fi
fi

exit $stat