selftests/bpf/test_offload.py: Only check verifier log on verification fails
Since commit6f8a57ccf8
("bpf: Make verifier log more relevant by default"), the verifier discards log messages for successfully-verified programs. This broke test_offload.py which is looking for a verification message from the driver callback. Change test_offload.py to use the toggle in netdevsim to make the verification fail before looking for the verification message. Fixes:6f8a57ccf8
("bpf: Make verifier log more relevant by default") Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Jakub Kicinski <kuba@kernel.org> Link: https://lore.kernel.org/bpf/160752226069.110217.12370824996153348073.stgit@toke.dk
This commit is contained in:
parent
e4ff5aa469
commit
d8b5e76ae4
|
@ -911,11 +911,18 @@ try:
|
|||
|
||||
sim.tc_flush_filters()
|
||||
|
||||
start_test("Test TC offloads failure...")
|
||||
sim.dfs["dev/bpf_bind_verifier_accept"] = 0
|
||||
ret, _, err = sim.cls_bpf_add_filter(obj, verbose=True, skip_sw=True,
|
||||
fail=False, include_stderr=True)
|
||||
fail(ret == 0, "TC filter did not reject with TC offloads enabled")
|
||||
check_verifier_log(err, "[netdevsim] Hello from netdevsim!")
|
||||
sim.dfs["dev/bpf_bind_verifier_accept"] = 1
|
||||
|
||||
start_test("Test TC offloads work...")
|
||||
ret, _, err = sim.cls_bpf_add_filter(obj, verbose=True, skip_sw=True,
|
||||
fail=False, include_stderr=True)
|
||||
fail(ret != 0, "TC filter did not load with TC offloads enabled")
|
||||
check_verifier_log(err, "[netdevsim] Hello from netdevsim!")
|
||||
|
||||
start_test("Test TC offload basics...")
|
||||
dfs = simdev.dfs_get_bound_progs(expected=1)
|
||||
|
@ -1032,6 +1039,15 @@ try:
|
|||
rm("/sys/fs/bpf/offload")
|
||||
sim.wait_for_flush()
|
||||
|
||||
start_test("Test XDP load failure...")
|
||||
sim.dfs["dev/bpf_bind_verifier_accept"] = 0
|
||||
ret, _, err = bpftool_prog_load("sample_ret0.o", "/sys/fs/bpf/offload",
|
||||
dev=sim['ifname'], fail=False, include_stderr=True)
|
||||
fail(ret == 0, "verifier should fail on load")
|
||||
check_verifier_log(err, "[netdevsim] Hello from netdevsim!")
|
||||
sim.dfs["dev/bpf_bind_verifier_accept"] = 1
|
||||
sim.wait_for_flush()
|
||||
|
||||
start_test("Test XDP offload...")
|
||||
_, _, err = sim.set_xdp(obj, "offload", verbose=True, include_stderr=True)
|
||||
ipl = sim.ip_link_show(xdp=True)
|
||||
|
@ -1039,7 +1055,6 @@ try:
|
|||
progs = bpftool_prog_list(expected=1)
|
||||
prog = progs[0]
|
||||
fail(link_xdp["id"] != prog["id"], "Loaded program has wrong ID")
|
||||
check_verifier_log(err, "[netdevsim] Hello from netdevsim!")
|
||||
|
||||
start_test("Test XDP offload is device bound...")
|
||||
dfs = simdev.dfs_get_bound_progs(expected=1)
|
||||
|
|
Loading…
Reference in New Issue