summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPetr Machata <petrm@mellanox.com>2018-06-30 02:45:47 +0200
committerDavid S. Miller <davem@davemloft.net>2018-06-30 22:06:15 +0900
commit96fa91d281229390b75a004d49582400b5f93cb1 (patch)
tree41f672c201ab868de0bc5b8d6e76db0f9914140f /tools
parent87d8fb18cbe919342a1909a1e4168c9a63b9bbbf (diff)
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/net/forwarding/lib.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 59272824ef37..5f4b7ed2c65a 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -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