Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests, bpftool: Add bpftool (and eBPF helpers) documentation build

eBPF selftests include a script to check that bpftool builds correctly
with different command lines. Let's add one build for bpftool's
documentation so as to detect errors or warning reported by rst2man when
compiling the man pages. Also add a build to the selftests Makefile to
make sure we build bpftool documentation along with bpftool when
building the selftests.

This also builds and checks warnings for the man page for eBPF helpers,
which is built along bpftool's documentation.

This change adds rst2man as a dependency for selftests (it comes with
Python's "docutils").

v2:
- Use "--exit-status=1" option for rst2man instead of counting lines
from stderr.
- Also build bpftool as part as the selftests build (and not only when
the tests are actually run).

Signed-off-by: Quentin Monnet <quentin@isovalent.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200909162251.15498-3-quentin@isovalent.com

authored by

Quentin Monnet and committed by
Alexei Starovoitov
41d5c37b 16f3ddfb

+26
+5
tools/testing/selftests/bpf/Makefile
··· 176 176 $(Q)$(MAKE) $(submake_extras) -C $(BPFTOOLDIR) \ 177 177 OUTPUT=$(BUILD_DIR)/bpftool/ \ 178 178 prefix= DESTDIR=$(SCRATCH_DIR)/ install 179 + $(Q)mkdir -p $(BUILD_DIR)/bpftool/Documentation 180 + $(Q)RST2MAN_OPTS="--exit-status=1" $(MAKE) $(submake_extras) \ 181 + -C $(BPFTOOLDIR)/Documentation \ 182 + OUTPUT=$(BUILD_DIR)/bpftool/Documentation/ \ 183 + prefix= DESTDIR=$(SCRATCH_DIR)/ install 179 184 180 185 $(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \ 181 186 ../../../include/uapi/linux/bpf.h \
+21
tools/testing/selftests/bpf/test_bpftool_build.sh
··· 85 85 echo 86 86 } 87 87 88 + make_doc_and_clean() { 89 + echo -e "\$PWD: $PWD" 90 + echo -e "command: make -s $* doc >/dev/null" 91 + RST2MAN_OPTS="--exit-status=1" make $J -s $* doc 92 + if [ $? -ne 0 ] ; then 93 + ERROR=1 94 + printf "FAILURE: Errors or warnings when building documentation\n" 95 + fi 96 + ( 97 + if [ $# -ge 1 ] ; then 98 + cd ${@: -1} 99 + fi 100 + make -s doc-clean 101 + ) 102 + echo 103 + } 104 + 88 105 echo "Trying to build bpftool" 89 106 echo -e "... through kbuild\n" 90 107 ··· 162 145 make_with_tmpdir OUTPUT 163 146 164 147 make_with_tmpdir O 148 + 149 + echo -e "Checking documentation build\n" 150 + # From tools/bpf/bpftool 151 + make_doc_and_clean