aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorvalentin boucher <valentin.boucher@orange.com>2016-08-04 08:21:59 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-08-04 08:21:59 +0000
commit8ff41c55c650e45cc0464a89c3c26ccc54f2a15c (patch)
tree1da25f3ae2659a4fbbb45fc91cd1f3083c043e62 /utils
parent3acdf5161577bfc5b01d677c4e5c7eefb0042cde (diff)
parent86195b92c29c2925529771d7a8014392e815f38c (diff)
Merge "unify test result check for feature project and apply to parser"
Diffstat (limited to 'utils')
-rw-r--r--utils/functest_utils.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/utils/functest_utils.py b/utils/functest_utils.py
index 5f790a015..cb2333d42 100644
--- a/utils/functest_utils.py
+++ b/utils/functest_utils.py
@@ -357,16 +357,33 @@ def check_success_rate(case_name, success_rate):
success_rate = float(success_rate)
criteria = get_criteria_by_test(case_name)
- def get_value(op):
+ def get_criteria_value(op):
return float(criteria.split(op)[1].rstrip('%'))
status = 'FAIL'
ops = ['==', '>=']
for op in ops:
if op in criteria:
- c_value = get_value(op)
+ c_value = get_criteria_value(op)
if eval("%s %s %s" % (success_rate, op, c_value)):
status = 'PASS'
break
return status
+
+
+def check_test_result(test_name, ret, start_time, stop_time):
+ def get_criteria_value():
+ return get_criteria_by_test(test_name).split('==')[1].strip()
+
+ status = 'FAIL'
+ if str(ret) == get_criteria_value():
+ status = 'PASS'
+
+ details = {
+ 'timestart': start_time,
+ 'duration': round(stop_time - start_time, 1),
+ 'status': status,
+ }
+
+ return status, details