Add the capability to add functional coverage results into the dashboard (#2183)

This commit is contained in:
Jalali 2024-06-03 09:47:22 +00:00 committed by GitHub
parent d89c5b6ba6
commit 8e2393db99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 43 additions and 20 deletions

View file

@ -13,20 +13,31 @@ import yaml
import report_builder as rb
from pprint import pprint
log_path = str(sys.argv[1])
with open(log_path, 'r') as f:
log = f.read()
log_cc_path = str(sys.argv[1])
with open(log_cc_path, 'r') as f:
cc_log = f.read()
log_fc_path = str(sys.argv[2])
with open(log_fc_path, 'r') as f:
fc_log = f.read()
pattern = re.compile(r'\S{2,}')
def get_scores(component):
for l in log.splitlines():
def get_cc_scores(component):
for l in cc_log.splitlines():
if re.search(r'\b'+component+r'\b', l):
line = l
scores = pattern.findall(line)
return [float(score) for score in scores[0:4]]
components = [
def get_fc_scores(component):
for l in fc_log.splitlines():
if re.search(r'\b'+component+r'\b', l):
line = l
scores = pattern.findall(line)
return [float(scores[0])]
cc_components = [
"i_cva6",
"commit_stage_i",
"controller_i",
@ -38,16 +49,33 @@ components = [
"issue_stage_i",
]
score_metric = rb.TableMetric('Coverage results')
score_metric.add_value("COMPONENT", "SCORE", "LINE", "COND", "TOGGLE")
for component in components:
scores = get_scores(component)
score_metric.add_value(component, *scores)
fc_components = [
"ISA",
"CSR access",
"TRAPs",
]
coverage_score = int(get_scores("i_cva6")[0])
cc_score_metric = rb.TableMetric('Coverage results')
cc_score_metric.add_value("COMPONENT", "SCORE", "LINE", "COND", "TOGGLE")
for component in cc_components:
cc_scores = get_cc_scores(component)
cc_score_metric.add_value(component, *cc_scores)
fc_score_metric = rb.TableMetric('Functional results')
fc_score_metric.add_value("FEATURE", "SCORE")
for component in fc_components:
fc_scores = get_fc_scores(component)
fc_score_metric.add_value(component, *fc_scores)
coverage_score = int(get_cc_scores("i_cva6")[0])
report = rb.Report(f'{coverage_score}%')
report.add_metric(score_metric)
report.add_metric(cc_score_metric)
report.add_metric(fc_score_metric)
report.dump()
pprint(score_metric.values)
print("Code Coverage Results :\n")
pprint(cc_score_metric.values)
print("\nFunctional Coverage Results :\n")
for i in range(0, 4):
pprint(fc_score_metric.values[i])