[Fuego] [PATCH 09/10] parser: do all comparisons before returning the error
Daniel Sangorrin
daniel.sangorrin at toshiba.co.jp
Fri Apr 28 08:28:31 UTC 2017
Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
engine/scripts/parser/common.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/engine/scripts/parser/common.py b/engine/scripts/parser/common.py
index ebbff08..27939c3 100644
--- a/engine/scripts/parser/common.py
+++ b/engine/scripts/parser/common.py
@@ -424,22 +424,23 @@ def compare(thresholds, test_results, criteria):
"""
This function makes a decision about current results.
Input: thresholds (from reference.log), test results dictionary, criteria dictionary.
- Return code: '1' is used for parsing errors, so use '2' instead for threshold errors
+ Return code: '1' is already used for parsing errors, so use '2' instead for threshold errors
"""
+ ret = 0
for key in test_results:
comparison_result = cmp(float(test_results[key]), float(thresholds[key]))
if criteria[key] == 'ge' and comparison_result < 0:
hls("Test section %s: test result %s is smaller than threshold %s." % (key, test_results[key], thresholds[key]),'e')
- return 2
+ ret = 2
elif criteria[key] == 'le' and comparison_result > 0:
hls("Test section %s: test result %s is greater than threshold %s." % (key, test_results[key], thresholds[key]),'e')
- return 2
+ ret = 2
elif criteria[key] == 'eq' and comparison_result != 0:
hls("Test section %s: test result %s is different than %s (PASS)." % (key, test_results[key], thresholds[key]),'e')
- return 2
+ ret = 2
else:
print "Test section %s: test result %s satisfies (%s) threshold %s." % (key, test_results[key], criteria[key], thresholds[key])
- return 0
+ return ret
def main():
pass
--
2.7.4
More information about the Fuego
mailing list