Skip to content

Commit 96fa91d

Browse files
pmachatadavem330
authored andcommitted
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: Petr Machata <petrm@mellanox.com> Reviewed-by: Yuval Mintz <yuvalm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 87d8fb1 commit 96fa91d

File tree

1 file changed

+13
-0
lines changed
  • tools/testing/selftests/net/forwarding

1 file changed

+13
-0
lines changed

tools/testing/selftests/net/forwarding/lib.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,19 @@ check_fail()
156156
fi
157157
}
158158

159+
check_err_fail()
160+
{
161+
local should_fail=$1; shift
162+
local err=$1; shift
163+
local what=$1; shift
164+
165+
if ((should_fail)); then
166+
check_fail $err "$what succeeded, but should have failed"
167+
else
168+
check_err $err "$what failed"
169+
fi
170+
}
171+
159172
log_test()
160173
{
161174
local test_name=$1

0 commit comments

Comments
 (0)