Skip to content

Commit

Permalink
selftests: forwarding: lib: Add check_err_fail()
Browse files Browse the repository at this point in the history
In the scale testing scenarios, one usually has a condition that is
expected to either fail, or pass, depending on which side of the scale
is being tested.

To capture this logic, add a function check_err_fail(), which dispatches
either to check_err() or check_fail(), depending on the value of the
first argument, should_fail.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Yuval Mintz <yuvalm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Petr Machata authored and David S. Miller committed Jun 30, 2018
1 parent 87d8fb1 commit 96fa91d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tools/testing/selftests/net/forwarding/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,19 @@ check_fail()
fi
}

check_err_fail()
{
local should_fail=$1; shift
local err=$1; shift
local what=$1; shift

if ((should_fail)); then
check_fail $err "$what succeeded, but should have failed"
else
check_err $err "$what failed"
fi
}

log_test()
{
local test_name=$1
Expand Down

0 comments on commit 96fa91d

Please sign in to comment.