Skip to content

Commit ffeec6b

Browse files
qmonnetkernel-patches-bot
authored andcommitted
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 <[email protected]> --- tools/testing/selftests/bpf/Makefile | 5 +++++ .../selftests/bpf/test_bpftool_build.sh | 21 +++++++++++++++++++ 2 files changed, 26 insertions(+)
1 parent 33ab75d commit ffeec6b

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tools/testing/selftests/bpf/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) \
176176
$(Q)$(MAKE) $(submake_extras) -C $(BPFTOOLDIR) \
177177
OUTPUT=$(BUILD_DIR)/bpftool/ \
178178
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
179184

180185
$(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \
181186
../../../include/uapi/linux/bpf.h \

tools/testing/selftests/bpf/test_bpftool_build.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,23 @@ make_with_tmpdir() {
8585
echo
8686
}
8787

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+
88105
echo "Trying to build bpftool"
89106
echo -e "... through kbuild\n"
90107

@@ -145,3 +162,7 @@ make_and_clean
145162
make_with_tmpdir OUTPUT
146163

147164
make_with_tmpdir O
165+
166+
echo -e "Checking documentation build\n"
167+
# From tools/bpf/bpftool
168+
make_doc_and_clean

0 commit comments

Comments
 (0)