Skip to content

Commit 380afe7

Browse files
joestringerborkmann
authored andcommitted
selftests, bpf: Make docs tests fail more reliably
Previously, if rst2man caught errors, then these would be ignored and the output file would be written anyway. This would allow developers to introduce regressions in the docs comments in the BPF headers. Additionally, even if you instruct rst2man to fail out, it will still write out to the destination target file, so if you ran the tests twice in a row it would always pass. Use a temporary file for the initial run to ensure that if rst2man fails out under "--strict" mode, subsequent runs will not automatically pass. Tested via ./tools/testing/selftests/bpf/test_doc_build.sh Signed-off-by: Joe Stringer <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Reviewed-by: Quentin Monnet <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent edc0571 commit 380afe7

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

tools/testing/selftests/bpf/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ test_cpp
3737
/runqslower
3838
/bench
3939
*.ko
40+
*.tmp
4041
xdpxceiver
4142
xdp_redirect_multi

tools/testing/selftests/bpf/Makefile.docs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ $(OUTPUT)%.$2: $(OUTPUT)%.rst
5252
ifndef RST2MAN_DEP
5353
$$(error "rst2man not found, but required to generate man pages")
5454
endif
55-
$$(QUIET_GEN)rst2man $$< > $$@
55+
$$(QUIET_GEN)rst2man --exit-status=1 $$< > [email protected]
56+
$$(QUIET_GEN)mv [email protected] $$@
5657

5758
docs-clean-$1:
5859
$$(call QUIET_CLEAN, eBPF_$1-manpage)

tools/testing/selftests/bpf/test_doc_build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
3+
set -e
34

45
# Assume script is located under tools/testing/selftests/bpf/. We want to start
56
# build attempts from the top of kernel repository.

0 commit comments

Comments
 (0)