All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 bpf-next] selftests/bpf: Make docs tests fail more reliably
@ 2021-06-08  1:57 Joe Stringer
  2021-06-08 16:16 ` Quentin Monnet
  2021-06-08 20:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Joe Stringer @ 2021-06-08  1:57 UTC (permalink / raw)
  To: bpf; +Cc: daniel, ast, quentin

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 <joe@cilium.io>
---
v2: Pass --exit-status=1 to rst2man instead of --strict
    Ignore *.tmp files from the build
---
 tools/testing/selftests/bpf/.gitignore        | 1 +
 tools/testing/selftests/bpf/Makefile.docs     | 3 ++-
 tools/testing/selftests/bpf/test_doc_build.sh | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selftests/bpf/.gitignore
index a18f57044014..eae6fc7d3ed8 100644
--- a/tools/testing/selftests/bpf/.gitignore
+++ b/tools/testing/selftests/bpf/.gitignore
@@ -37,5 +37,6 @@ test_cpp
 /runqslower
 /bench
 *.ko
+*.tmp
 xdpxceiver
 xdp_redirect_multi
diff --git a/tools/testing/selftests/bpf/Makefile.docs b/tools/testing/selftests/bpf/Makefile.docs
index ccf260021e83..eb6a4fea8c79 100644
--- a/tools/testing/selftests/bpf/Makefile.docs
+++ b/tools/testing/selftests/bpf/Makefile.docs
@@ -52,7 +52,8 @@ $(OUTPUT)%.$2: $(OUTPUT)%.rst
 ifndef RST2MAN_DEP
 	$$(error "rst2man not found, but required to generate man pages")
 endif
-	$$(QUIET_GEN)rst2man $$< > $$@
+	$$(QUIET_GEN)rst2man --exit-status=1 $$< > $$@.tmp
+	$$(QUIET_GEN)mv $$@.tmp $$@
 
 docs-clean-$1:
 	$$(call QUIET_CLEAN, eBPF_$1-manpage)
diff --git a/tools/testing/selftests/bpf/test_doc_build.sh b/tools/testing/selftests/bpf/test_doc_build.sh
index 7eb940a7b2eb..ed12111cd2f0 100755
--- a/tools/testing/selftests/bpf/test_doc_build.sh
+++ b/tools/testing/selftests/bpf/test_doc_build.sh
@@ -1,5 +1,6 @@
 #!/bin/bash
 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+set -e
 
 # Assume script is located under tools/testing/selftests/bpf/. We want to start
 # build attempts from the top of kernel repository.
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCHv2 bpf-next] selftests/bpf: Make docs tests fail more reliably
  2021-06-08  1:57 [PATCHv2 bpf-next] selftests/bpf: Make docs tests fail more reliably Joe Stringer
@ 2021-06-08 16:16 ` Quentin Monnet
  2021-06-08 20:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Quentin Monnet @ 2021-06-08 16:16 UTC (permalink / raw)
  To: Joe Stringer, bpf; +Cc: daniel, ast

2021-06-07 18:57 UTC-0700 ~ Joe Stringer <joe@cilium.io>
> 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 <joe@cilium.io>

Reviewed-by: Quentin Monnet <quentin@isovalent.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCHv2 bpf-next] selftests/bpf: Make docs tests fail more reliably
  2021-06-08  1:57 [PATCHv2 bpf-next] selftests/bpf: Make docs tests fail more reliably Joe Stringer
  2021-06-08 16:16 ` Quentin Monnet
@ 2021-06-08 20:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-08 20:10 UTC (permalink / raw)
  To: Joe Stringer; +Cc: bpf, daniel, ast, quentin

Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

On Mon,  7 Jun 2021 18:57:56 -0700 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [PATCHv2,bpf-next] selftests/bpf: Make docs tests fail more reliably
    https://git.kernel.org/bpf/bpf-next/c/380afe720896

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-08 20:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08  1:57 [PATCHv2 bpf-next] selftests/bpf: Make docs tests fail more reliably Joe Stringer
2021-06-08 16:16 ` Quentin Monnet
2021-06-08 20:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.