From 485a0036f0b37d4455aa48a5432f3cf7506d1722 Mon Sep 17 00:00:00 2001 From: Ionela Voinescu Date: Thu, 27 Feb 2020 22:48:18 +0000 Subject: [PATCH] rta: fix steps for end_pct < start_pct Signed-off-by: Ionela Voinescu --- lisa/wlgen/rta.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisa/wlgen/rta.py b/lisa/wlgen/rta.py index 04a83b9fa..eef223986 100644 --- a/lisa/wlgen/rta.py +++ b/lisa/wlgen/rta.py @@ -902,7 +902,11 @@ class Ramp(RTATask): sign = +1 if start_pct <= end_pct else -1 delta_pct = sign * abs(delta_pct) - steps = list(itertools.takewhile(lambda x: x <= end_pct, itertools.count(start_pct, delta_pct))) + if start_pct <= end_pct: + steps = list(itertools.takewhile(lambda x: x <= end_pct, itertools.count(start_pct, delta_pct))) + else: + steps = list(itertools.takewhile(lambda x: x >= end_pct, itertools.count(start_pct, delta_pct))) + # clip the last step steps[-1] = end_pct -- GitLab