[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yf1ELsA5yhhBrJnf@krava>
Date: Fri, 4 Feb 2022 16:20:14 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, netdev@...r.kernel.org,
bpf@...r.kernel.org, Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Jakub Kicinski <kuba@...nel.org>,
Jiri Pirko <jiri@...lanox.com>
Subject: Re: [RFC] failing selftests/bpf/test_offload.py
On Mon, Jan 31, 2022 at 02:15:07PM +0100, Toke Høiland-Jørgensen wrote:
> Jiri Olsa <jolsa@...hat.com> writes:
>
> > hi,
> > I have failing test_offload.py with following output:
> >
> > # ./test_offload.py
> > ...
> > Test bpftool bound info reporting (own ns)...
> > FAIL: 3 BPF maps loaded, expected 2
> > File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 1177, in <module>
> > check_dev_info(False, "")
> > File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 645, in check_dev_info
> > maps = bpftool_map_list(expected=2, ns=ns)
> > File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 190, in bpftool_map_list
> > fail(True, "%d BPF maps loaded, expected %d" %
> > File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 86, in fail
> > tb = "".join(traceback.extract_stack().format())
> >
> > it fails to detect maps from bpftool's feature detection,
> > that did not make it yet through deferred removal
> >
> > with the fix below I have this subtest passed, but it fails
> > further on:
> >
> > # ./test_offload.py
> > ...
> > Test bpftool bound info reporting (own ns)...
> > Test bpftool bound info reporting (other ns)...
> > Test bpftool bound info reporting (remote ns)...
> > Test bpftool bound info reporting (back to own ns)...
> > Test bpftool bound info reporting (removed dev)...
> > Test map update (no flags)...
> > Test map update (exists)...
> > Test map update (noexist)...
> > Test map dump...
> > Test map dump...
> > Traceback (most recent call last):
> > File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 1251, in <module>
> > _, entries = bpftool("map dump id %d" % (m["id"]))
> > File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 169, in bpftool
> > return tool("bpftool", args, {"json":"-p"}, JSON=JSON, ns=ns,
> > File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 155, in tool
> > ret, stdout = cmd(ns + name + " " + params + args,
> > File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 109, in cmd
> > return cmd_result(proc, include_stderr=include_stderr, fail=fail)
> > File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 131, in cmd_result
> > raise Exception("Command failed: %s\n%s" % (proc.args, stderr))
> > Exception: Command failed: bpftool -p map dump id 4325
> >
> > the test seems to expect maps having BTF loaded, which for some reason
> > did not happen, so the test fails with bpftool pretty dump fail
> >
> > the test loads the object with 'ip link ...', which I never touched,
> > so I wanted ask first before I dive in, perhaps I miss some setup
> >
> > thoughts? ;-)
>
> It looks like the test_offload.py has been using 'bpftool -p' since its
> inception (in commit: 417ec26477a5 ("selftests/bpf: add offload test
> based on netdevsim") introduced in December 2017), so this sounds like a
> regression in bpftool?
>
> -Toke
>
right, looks like this commit:
e5043894b21f ("bpftool: Use libbpf_get_error() to check error")
forced btf for pretty map dump.. change below fixes the test for me,
I'll send full patchset for this later
thanks,
jirka
---
tools/bpf/bpftool/map.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index c66a3c979b7a..2ccf85042e75 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -862,6 +862,7 @@ map_dump(int fd, struct bpf_map_info *info, json_writer_t *wtr,
prev_key = NULL;
if (wtr) {
+ errno = 0;
btf = get_map_kv_btf(info);
err = libbpf_get_error(btf);
if (err) {
--
2.34.1
Powered by blists - more mailing lists