bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martynas Pumputis <m@lambda.lt>
To: bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, m@lambda.lt
Subject: [PATCH bpf-next] selftests/bpf: Mute expected invalid map creation error msg
Date: Wed, 21 Jul 2021 16:09:41 +0200	[thread overview]
Message-ID: <20210721140941.563175-1-m@lambda.lt> (raw)

Previously, the newly introduced test case in test_map_in_map(), which
checks whether the inner map is destroyed after unsuccessful creation of
the outer map, logged the following harmless and expected error:

    libbpf: map 'mim': failed to create: Invalid argument(-22) libbpf:
    failed to load object './test_map_in_map_invalid.o'

To avoid any possible confusion, mute the logging during loading of the
prog.

Fixes: 08f71a1e39a1 ("selftests/bpf: Check inner map deletion")
Reported-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Martynas Pumputis <m@lambda.lt>
---
 tools/testing/selftests/bpf/test_maps.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
index 5a8e069e64fa..14cea869235b 100644
--- a/tools/testing/selftests/bpf/test_maps.c
+++ b/tools/testing/selftests/bpf/test_maps.c
@@ -1163,6 +1163,7 @@ static void test_map_in_map(void)
 	struct bpf_map_info info = {};
 	__u32 len = sizeof(info);
 	__u32 id = 0;
+	libbpf_print_fn_t old_print_fn;
 
 	obj = bpf_object__open(MAPINMAP_PROG);
 
@@ -1250,12 +1251,16 @@ static void test_map_in_map(void)
 		goto out_map_in_map;
 	}
 
+	old_print_fn = libbpf_set_print(NULL);
+
 	err = bpf_object__load(obj);
 	if (!err) {
 		printf("Loading obj supposed to fail\n");
 		goto out_map_in_map;
 	}
 
+	libbpf_set_print(old_print_fn);
+
 	/* Iterate over all maps to check whether the internal map
 	 * ("mim.internal") has been destroyed.
 	 */
-- 
2.32.0


                 reply	other threads:[~2021-07-21 14:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210721140941.563175-1-m@lambda.lt \
    --to=m@lambda.lt \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    /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;
as well as URLs for NNTP newsgroup(s).