From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>
Subject: [PATCH bpf-next v2 1/3] selftests/bpf: Print log buffer for exceptions test only on failure
Date: Mon, 18 Sep 2023 17:52:31 +0200 [thread overview]
Message-ID: <20230918155233.297024-2-memxor@gmail.com> (raw)
In-Reply-To: <20230918155233.297024-1-memxor@gmail.com>
Alexei reported seeing log messages for some test cases even though we
just wanted to match the error string from the verifier. Move the
printing of the log buffer to a guarded condition so that we only print
it when we fail to match on the expected string in the log buffer,
preventing unneeded output when running the test.
Reported-by: Alexei Starovoitov <ast@kernel.org>
Fixes: d2a93715bfb0 ("selftests/bpf: Add tests for BPF exceptions")
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
---
tools/testing/selftests/bpf/prog_tests/exceptions.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/exceptions.c b/tools/testing/selftests/bpf/prog_tests/exceptions.c
index 5663e427dc00..516f4a13013c 100644
--- a/tools/testing/selftests/bpf/prog_tests/exceptions.c
+++ b/tools/testing/selftests/bpf/prog_tests/exceptions.c
@@ -103,9 +103,10 @@ static void test_exceptions_success(void)
goto done; \
} \
if (load_ret != 0) { \
- printf("%s\n", log_buf); \
- if (!ASSERT_OK_PTR(strstr(log_buf, msg), "strstr")) \
+ if (!ASSERT_OK_PTR(strstr(log_buf, msg), "strstr")) { \
+ printf("%s\n", log_buf); \
goto done; \
+ } \
} \
if (!load_ret && attach_err) { \
if (!ASSERT_ERR_PTR(link = bpf_program__attach(prog), "attach err")) \
--
2.41.0
next prev parent reply other threads:[~2023-09-18 16:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-18 15:52 [PATCH bpf-next v2 0/3] Fixes for Exceptions Kumar Kartikeya Dwivedi
2023-09-18 15:52 ` Kumar Kartikeya Dwivedi [this message]
2023-09-18 15:52 ` [PATCH bpf-next v2 2/3] bpf: Fix bpf_throw warning on 32-bit arch Kumar Kartikeya Dwivedi
2023-09-18 17:09 ` Matthieu Baerts
2023-09-18 18:12 ` Kui-Feng Lee
2023-09-18 15:52 ` [PATCH bpf-next v2 3/3] bpf: Disable exceptions when CONFIG_UNWINDER_FRAME_POINTER=y Kumar Kartikeya Dwivedi
2023-09-18 16:00 ` Eric Dumazet
2023-09-18 20:50 ` [PATCH bpf-next v2 0/3] Fixes for Exceptions patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230918155233.297024-2-memxor@gmail.com \
--to=memxor@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox