summaryrefslogtreecommitdiffstats
path: root/utils/test/reporting/yardstick/reportingUtils.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils/test/reporting/yardstick/reportingUtils.py')
-rw-r--r--utils/test/reporting/yardstick/reportingUtils.py48
1 files changed, 45 insertions, 3 deletions
diff --git a/utils/test/reporting/yardstick/reportingUtils.py b/utils/test/reporting/yardstick/reportingUtils.py
index 06bcd4926..71eb9196c 100644
--- a/utils/test/reporting/yardstick/reportingUtils.py
+++ b/utils/test/reporting/yardstick/reportingUtils.py
@@ -45,17 +45,59 @@ def getScenarioStatus(installer, version):
print 'Got an error code:', e
scenario_results = {}
+ result_dict = {}
if test_results is not None:
for r in test_results:
- if r['stop_date'] != 'None':
+ if r['stop_date'] != 'None' and r['criteria'] is not None:
if not r['scenario'] in scenario_results.keys():
scenario_results[r['scenario']] = []
scenario_results[r['scenario']].append(r)
for k,v in scenario_results.items():
- scenario_results[k] = v[:conf.LASTEST_TESTS]
+ # scenario_results[k] = v[:conf.LASTEST_TESTS]
+ s_list = []
+ for element in v:
+ if element['criteria'] == 'SUCCESS':
+ s_list.append(1)
+ else:
+ s_list.append(0)
+ result_dict[k] = s_list
- return scenario_results
+ # return scenario_results
+ return result_dict
+
+def subfind(given_list, pattern_list):
+ for i in range(len(given_list)):
+ if given_list[i] == pattern_list[0] and given_list[i:i + conf.LASTEST_TESTS] == pattern_list:
+ return True
+ return False
+
+def get_percent(status):
+
+ if status * 100 % 6:
+ return round(float(status) * 100 / 6, 1)
+ else:
+ return status * 100 / 6
+
+def get_status(four_list, ten_list):
+ four_score = 0
+ ten_score = 0
+
+ for v in four_list:
+ four_score += v
+ for v in ten_list:
+ ten_score += v
+
+ if four_score == conf.LASTEST_TESTS:
+ status = 6
+ elif subfind(ten_list, [1, 1, 1, 1]):
+ status = 5
+ elif ten_score == 0:
+ status = 0
+ else:
+ status = four_score + 1
+
+ return get_percent(status)
def _test():