[PATCH lnst] recipes: switchdev: RedTestLib: Fix syntax

Petr Machata petrm at mellanox.com
Thu Jun 28 00:26:27 AEST 2018


- "else if" is written as "elif" in Python.
- List length is not written list.size, but len(list).

Signed-off-by: Petr Machata <petrm at mellanox.com>
---

Notes:
    Fixes: 1d7202e5b196 ("recipes: switchdev: Prevent error when no RED backlog")
    
    Since this is only in our queue, this patch should be just folded in the
    above commit before it's sent upstream.

 recipes/switchdev/RedTestLib.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/recipes/switchdev/RedTestLib.py b/recipes/switchdev/RedTestLib.py
index fadb97e..96d4490 100644
--- a/recipes/switchdev/RedTestLib.py
+++ b/recipes/switchdev/RedTestLib.py
@@ -310,9 +310,9 @@ class RedTestLib:
             msg = "Not enough early drops (%d)" % res.stats["early"]
         self.test_result(desc, msg)
 
-        if not res.backlogs.size:
+        if len(res.backlogs) == 0:
             self.test_result("RED high rate no backlog results")
-        else if max(res.backlogs) > self.max * 1.2:
+        elif max(res.backlogs) > self.max * 1.2:
             self.test_result("RED high rate - backlog over limit",
                              "backlog was %d when max limit is %d" %
                              (max(res.backlogs), self.max))
-- 
2.4.11



More information about the Linux-mlxsw mailing list