Skip to content

Commit

Permalink
selftests/bpf: add Error: prefix in check_extack helper
Browse files Browse the repository at this point in the history
Currently the test only checks errors, not warnings, so save typing
and prefix the extack messages with "Error:" inside the check helper.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
Jakub Kicinski authored and Daniel Borkmann committed Jul 11, 2018
1 parent 7479efc commit 219f860
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/testing/selftests/bpf/test_offload.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,11 +547,11 @@ def check_extack(output, reference, args):
if skip_extack:
return
lines = output.split("\n")
comp = len(lines) >= 2 and lines[1] == reference
comp = len(lines) >= 2 and lines[1] == 'Error: ' + reference
fail(not comp, "Missing or incorrect netlink extack message")

def check_extack_nsim(output, reference, args):
check_extack(output, "Error: netdevsim: " + reference, args)
check_extack(output, "netdevsim: " + reference, args)

def check_no_extack(res, needle):
fail((res[1] + res[2]).count(needle) or (res[1] + res[2]).count("Warning:"),
Expand Down Expand Up @@ -654,7 +654,7 @@ def test_spurios_extack(sim, obj, skip_hw, needle):
ret, _, err = sim.cls_bpf_add_filter(obj, skip_sw=True,
fail=False, include_stderr=True)
fail(ret == 0, "TC filter loaded without enabling TC offloads")
check_extack(err, "Error: TC offload is disabled on net device.", args)
check_extack(err, "TC offload is disabled on net device.", args)
sim.wait_for_flush()

sim.set_ethtool_tc_offloads(True)
Expand Down Expand Up @@ -694,7 +694,7 @@ def test_spurios_extack(sim, obj, skip_hw, needle):
skip_sw=True,
fail=False, include_stderr=True)
fail(ret == 0, "Offloaded a filter to chain other than 0")
check_extack(err, "Error: Driver supports only offload of chain 0.", args)
check_extack(err, "Driver supports only offload of chain 0.", args)
sim.tc_flush_filters()

start_test("Test TC replace...")
Expand Down

0 comments on commit 219f860

Please sign in to comment.