Skip to content

Commit f9d2f5d

Browse files
committed
selftests: net: fix error message in bpf_offload
We hit a following exception on timeout, nmaps is never set: Test bpftool bound info reporting (own ns)... Traceback (most recent call last): File "/home/virtme/testing-1/tools/testing/selftests/net/./bpf_offload.py", line 1128, in <module> check_dev_info(False, "") File "/home/virtme/testing-1/tools/testing/selftests/net/./bpf_offload.py", line 583, in check_dev_info maps = bpftool_map_list_wait(expected=2, ns=ns) File "/home/virtme/testing-1/tools/testing/selftests/net/./bpf_offload.py", line 215, in bpftool_map_list_wait raise Exception("Time out waiting for map counts to stabilize want %d, have %d" % (expected, nmaps)) NameError: name 'nmaps' is not defined Acked-by: Stanislav Fomichev <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8e0e8be commit f9d2f5d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/testing/selftests/net/bpf_offload.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,11 @@ def bpftool_prog_list_wait(expected=0, n_retry=20):
207207
raise Exception("Time out waiting for program counts to stabilize want %d, have %d" % (expected, nprogs))
208208

209209
def bpftool_map_list_wait(expected=0, n_retry=20, ns=""):
210+
nmaps = None
210211
for i in range(n_retry):
211212
maps = bpftool_map_list(ns=ns)
212-
if len(maps) == expected:
213+
nmaps = len(maps)
214+
if nmaps == expected:
213215
return maps
214216
time.sleep(0.05)
215217
raise Exception("Time out waiting for map counts to stabilize want %d, have %d" % (expected, nmaps))

0 commit comments

Comments
 (0)