提交 96fa91d2 编写于 作者: P Petr Machata 提交者: David S. Miller

selftests: forwarding: lib: Add check_err_fail()

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: NPetr Machata <petrm@mellanox.com>
Reviewed-by: NYuval Mintz <yuvalm@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 87d8fb18
...@@ -156,6 +156,19 @@ check_fail() ...@@ -156,6 +156,19 @@ check_fail()
fi 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() log_test()
{ {
local test_name=$1 local test_name=$1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册