Skip to content

Commit 0dc93a5

Browse files
dbkinderjren1
authored andcommitted
doc: filter known issues
make the doc build process quiet and add filtering of known (Sphinx) issues. Scripting comes from the open source Zephyr project. Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
1 parent b170e29 commit 0dc93a5

File tree

7 files changed

+416
-9
lines changed

7 files changed

+416
-9
lines changed

doc/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ doxygen
22
_build
33
*.bak
44
*.sav
5+
*.log
6+
*.warnings

doc/.known-issues/README

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
This directory contains configuration files to ignore errors found in
2+
the build and test process which are known to the developers and for
3+
now can be safely ignored.
4+
5+
To use:
6+
7+
$ cd <build directory>
8+
$ make SOMETHING >& result
9+
$ scripts/filter-known-issues.py result
10+
11+
It is included in the source tree so if anyone has to submit anything
12+
that triggers some kind of error that is a false positive, it can
13+
include the "ignore me" file, properly documented.
14+
15+
Each file can contain one or more multiline Python regular expressions
16+
(https://docs.python.org/2/library/re.html#regular-expression-syntax)
17+
that match an error message. Multiple regular expressions are
18+
separated by comment blocks (that start with #). Note that an empty
19+
line still is considered part of the multiline regular expression.
20+
21+
For example
22+
23+
---beginning---
24+
#
25+
# This testcase always fails, pending fix ZEP-1234
26+
#
27+
.*/tests/kernel/grumpy .* FAIL
28+
#
29+
# Documentation issue, masks:
30+
#
31+
# /home/e/inaky/z/kernel.git/doc/api/io_interfaces.rst:28: WARNING: Invalid definition: Expected identifier in nested name. [error at 19]
32+
# struct dev_config::@65 dev_config::bits
33+
# -------------------^
34+
#
35+
^(?P<filename>.+/doc/api/io_interfaces.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
36+
^\s+struct dev_config::@[0-9]+ dev_config::bits.*
37+
^\s+-+\^
38+
---end---
39+
40+
Note you want to:
41+
42+
- use relateive paths; instead of
43+
/home/me/mydir/zephyr/something/somewhere.c you will want
44+
^.*/something/somewhere.c (as they will depend on where it is being
45+
built)
46+
47+
- Replace line numbers with [0-9]+, as they will change
48+
49+
- (?P<filename>[-._/\w]+/something/somewhere.c) saves the match on
50+
that file path in a "variable" called 'filename' that later you can
51+
match with (?P=filename) if you want to match multiple lines of the
52+
same error message.
53+
54+
Can get really twisted and interesting in terms of regexps; they are
55+
powerful, so start small :)

doc/.known-issues/doc/hypercall.conf

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
# Hypercall
3+
#
4+
#
5+
# include/net/net_ip.h warnings
6+
#
7+
^(?P<filename>[-._/\w]+/api/hypercall_api.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
8+
^[ \t]*
9+
^[ \t]*\^
10+
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
11+
^[ \t]*
12+
^[ \t]*\^
13+
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
14+
^[ \t]*
15+
^[ \t]*\^
16+
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
17+
^[ \t]*
18+
^[ \t]*\^
19+
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
20+
^.*vhm_request.reqs
21+
^[- \t]*\^
22+
#
23+
^(?P<filename>[-._/\w]+/api/hypercall_api.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
24+
^[ \t]*
25+
^[ \t]*\^
26+
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
27+
^[ \t]*
28+
^[ \t]*\^
29+
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
30+
^.*hc_ptdev_irq.is
31+
^[- \t]*\^
32+
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
33+
^.*hc_ptdev_irq.is.intx
34+
^[- \t]*\^
35+
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
36+
^.*hc_ptdev_irq.is.msix
37+
^[- \t]*\^

doc/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ help:
2323
.PHONY: help Makefile
2424

2525
pullsource:
26-
scripts/pullsource.sh
26+
$(Q)scripts/pullsource.sh
2727

2828

2929
# Generate the doxygen xml (for Sphinx) and copy the doxygen html to the
@@ -32,6 +32,11 @@ pullsource:
3232
doxy: pullsource
3333
$(Q)(cat acrn.doxyfile) | doxygen - 2>&1
3434

35+
html: doxy
36+
$(Q)$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)" "$(SPHINXOPTS)" $(O) > doc.log 2>&1
37+
$(Q)./scripts/filter-doc-log.sh doc.log
38+
39+
3540
# Remove generated content (Sphinx and doxygen)
3641

3742
clean:

doc/scripts/filter-doc-log.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
# run the filter-known-issues.py script to remove "expected" warning
4+
# messages from the output of the document build process and write
5+
# the filtered output to stdout
6+
#
7+
# Only argument is the name of the log file saved by the build.
8+
9+
KI_SCRIPT=scripts/filter-known-issues.py
10+
CONFIG_DIR=.known-issues/doc
11+
12+
LOG_FILE=$1
13+
14+
if [ -z "${LOG_FILE}" ]; then
15+
echo "Error in $0: missing input parameter <logfile>"
16+
exit 1
17+
fi
18+
19+
# When running in background, detached from terminal jobs, tput will
20+
# fail; we usually can tell because there is no TERM env variable.
21+
if [ -z "${TERM:-}" -o "${TERM:-}" = dumb ]; then
22+
TPUT="true"
23+
red=''
24+
green=''
25+
else
26+
TPUT="tput"
27+
red='\E[31m'
28+
green='\e[32m'
29+
fi
30+
31+
if [ -s "${LOG_FILE}" ]; then
32+
$KI_SCRIPT --config-dir ${CONFIG_DIR} ${LOG_FILE} > doc.warnings 2>&1
33+
if [ -s doc.warnings ]; then
34+
echo
35+
echo -e "${red}New errors/warnings found, please fix them:"
36+
echo -e "=============================================="
37+
$TPUT sgr0
38+
echo
39+
cat doc.warnings
40+
echo
41+
else
42+
echo -e "${green}No new errors/warnings."
43+
$TPUT sgr0
44+
fi
45+
46+
else
47+
echo "Error in $0: logfile \"${LOG_FILE}\" not found."
48+
exit 1
49+
fi

0 commit comments

Comments
 (0)