From c5341bcc337ca762faa58790c2065c76cd05f2e6 Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Sun, 29 Dec 2019 13:48:29 +0200 Subject: selftests: mlxsw: Add a self-test for port-default priority Send non-IP traffic to a port and observe that it gets prioritized according to the lldptool app=$prio,1,0 rules. Signed-off-by: Petr Machata Reviewed-by: Jiri Pirko Signed-off-by: Ido Schimmel Signed-off-by: David S. Miller --- tools/testing/selftests/net/forwarding/lib.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tools/testing/selftests/net/forwarding/lib.sh') diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index a0b09bb6995e..8dc5fac98cbc 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -225,6 +225,29 @@ log_info() echo "INFO: $msg" } +busywait() +{ + local timeout=$1; shift + + local start_time="$(date -u +%s%3N)" + while true + do + local out + out=$("$@") + local ret=$? + if ((!ret)); then + echo -n "$out" + return 0 + fi + + local current_time="$(date -u +%s%3N)" + if ((current_time - start_time > timeout)); then + echo -n "$out" + return 1 + fi + done +} + setup_wait_dev() { local dev=$1; shift -- cgit