doc: display ut-test-map

This commit is contained in:
yaozhicheng 2024-11-07 18:50:16 +08:00
parent 7bda310ec7
commit 4faee1680e
5 changed files with 169 additions and 29 deletions

View File

@ -196,9 +196,9 @@ node_default_meta_data = {
"functions": {"total": 0, "cover": 0},
"lines": {"total": 0, "cover": 0},
"paths": "",
"value": 1,
"light": False,
"light_count": 0,
"doc_url": "",
}
@ -214,6 +214,7 @@ def update_dut_tree_node_meta(tree_data):
if "children" in node:
meta = copy.deepcopy(node_default_meta_data)
meta["paths"] = parent_name + "/" + node["name"]
value = 0
for child in node["children"]:
child_meta = _update_node_meta(child, meta["paths"])
meta["cases"]["total"] += child_meta["cases"]["total"]
@ -226,10 +227,10 @@ def update_dut_tree_node_meta(tree_data):
meta["lines"]["cover"] += child_meta["lines"]["cover"]
meta["lines"]["text"] = "%d/%d (%.2f %%)" % (meta["lines"]["cover"], meta["lines"]["total"],
float(meta["lines"]["cover"])/meta["lines"]["total"]*100) if meta["lines"]["total"] > 0 else "0/0 (0.00 %)"
meta["value"] += child_meta["value"]
meta["light_count"] += child_meta["light_count"]
value += child.get("value", 1)
node["meta"] = meta
node["value"] = node["meta"]["value"]
node["value"] = value
else:
node["meta"]["paths"] = parent_name + "/" + node["name"]
node["meta"]["light_count"] = 1 if node["meta"]["light"] else 0
@ -244,7 +245,7 @@ def init_dut_tree(tree_data):
meta = copy.deepcopy(node_default_meta_data)
meta.update(node.get("meta",{}))
node["meta"] = meta
node["value"] = node["meta"]["value"]
node["value"] = 1
node.update(copy.deepcopy(node_defaut_extern))
else:
for child in node["children"]:
@ -287,7 +288,6 @@ class DutTree(object):
warning("Path not found: %s, please check your dut module struct" % path)
continue
leaf_map[path]["meta"] = {**leaf_map[path]["meta"], **meta}
leaf_map[path]["value"] = leaf_map[path]["meta"]["value"]
total = leaf_map[path]["meta"]["cases"]["total"]
if total > 0:
leaf_map[path]["itemStyle"]["colorAlpha"] = min(1.0, float(total)/10.0)

View File

@ -28,6 +28,8 @@ children:
desc: "微操作分支目标缓冲器 (Micro-Op Fetch Target Buffer)"
- name: "ittage"
desc: "分支目标缓冲器 (Instruction Tagged Target Buffer)"
meta:
doc_url: "https://open-verify.cc/xs-bpu/docs/modules/04_ittage"
- name: "tagesc"
desc: "分支目标缓冲器+SC预测器 (TAGE-SC)"
- name: "ras"

View File

@ -10,6 +10,7 @@ weight: 10
<script>
function update_charts(data_url){
show_meta_chart("meta_chart", data_url)
updateDUTestStatus(data_url)
}
</script>
@ -21,42 +22,36 @@ function update_charts(data_url){
香山昆明湖架构各个模块验证情况如上图中所示。总统计数据如下:
<table>
<ol>
<tr>
<td><li>总测试用例数Total Cases</td>
<td style="text-align: right; font-weight: bold;"><em id="em_id_report_cases_toal">-</em></li></td>
<td>总测试用例数Total Cases</td>
<td style="text-align: left; font-weight: bold;"><em id="em_id_report_cases_toal">-</em></td>
<td>测试用例通过数Passed Cases</td>
<td style="text-align: left; font-weight: bold;"><em id="em_id_report_cases_pass">-</em></td>
</tr>
<tr>
<td><li>测试用例通过数Passed Cases</td>
<td style="text-align: right; font-weight: bold;"><em id="em_id_report_cases_pass">-</em></li></td>
<td>测试用例未过数Failed Cases</td>
<td style="text-align: left; font-weight: bold;"><em id="em_id_report_cases_fail">-</em></td>
<td>测试用例跳过数Skipped Cases</td>
<td style="text-align: left; font-weight: bold;"><em id="em_id_report_cases_skip">-</em></td>
</tr>
<tr>
<td><li>测试用例未过数Failed Cases</td>
<td style="text-align: right; font-weight: bold;"><em id="em_id_report_cases_fail">-</em></li></td>
<td>总功能覆盖点数Function Coverage</td>
<td style="text-align: left; font-weight: bold;"><em id="em_id_report_function_total">-</em></td>
<td>覆盖点已覆盖数Coverage Functions</td>
<td style="text-align: left; font-weight: bold;"><em id="em_id_report_function_cover">-</em></td>
</tr>
<tr>
<td><li>测试用例跳过数Skipped Cases</td>
<td style="text-align: right; font-weight: bold;"><em id="em_id_report_cases_skip">-</em></li></td>
</tr>
<tr>
<td><li>总功能覆盖点数Function Coverage</td>
<td style="text-align: right; font-weight: bold;"><em id="em_id_report_function_total">-</em></li></td>
</tr>
<tr>
<td><li>覆盖点已覆盖数Coverage Functions</td>
<td style="text-align: right; font-weight: bold;"><em id="em_id_report_function_cover">-</em></li></td>
</tr>
<tr>
<td><li>总代码行覆盖率Line Coverage Rate</td>
<td style="text-align: right;"><em id="em_id_report_line_coverage">-</em></li></td>
<td>总代码行覆盖率Line Coverage Rate</td>
<td style="text-align: left;"><em id="em_id_report_line_coverage">-</em></td>
</tr>
</ol>
</table>
*总代码行会随着DUT的增加而不断增加因此总代码行覆盖率不是最终覆盖率
其他内容快捷连接:
- **[DUT文档与功能](https://open-verify.cc/UnityChipForXiangShan/)**
@ -66,9 +61,16 @@ function update_charts(data_url){
- **[正在进行的任务列表](https://github.com/XS-MLVP/UnityChipForXiangShan/labels/task)**
- **[已完成的任务列表](https://github.com/XS-MLVP/UnityChipForXiangShan/labels/taskdone)**
本项目中的统计信息根据commit等数据自动更新参与者可以提交issue写明任务内容预计完成时间等同步正在进行的任务。
<br>
<div style="text-align: center; width: 100%;">
<h4>香山昆明湖的每个DUT验证进展</h4>
</div>
<br>
{{<list-dut-test-status>}}
<div style="text-align: center; width: 100%;">
<br>
本项目中的统计信息根据commit等数据自动更新参与者可以提交issue写明任务内容预计完成时间等同步正在进行的任务。<br>
数据自动更新日期:<em id="em_id_report_date">1970-01-01 00:00:00</em>
</div>

View File

@ -0,0 +1,136 @@
<style>
.div-dut-test-report {
all:none;
display: flex;
align-items: center;
text-align: center;
justify-content: center;
width: 100%;
margin: 0 auto;
}
.div-dut-test-report tbody {
--bs-table-striped-bg: white;
}
.div-dut-test-report .td-name {
text-align: left;
}
.div-dut-test-report .td-index {
text-align: center;
}
.div-dut-test-report table {
width: 90%;
margin: 0 auto;
}
.div-dut-test-report td {
text-align: right;
}
.div-dut-test-report th {
text-align: right;
}
.div-dut-test-report tr {
border-bottom: 1px solid #ddd;
}
.em-red {
color: yellow;
font-weight: bold;
background-color: rgb(247, 36, 152);
border-radius: 2px;
}
.em-orange {
color: white;
font-weight: bold;
background-color: orange;
border-radius: 2px;
}
.em-green {
font-weight: bold;
color: yellow;
background-color: green;
border-radius: 2px;
}
</style>
<div class="div-dut-test-report">
<table id="dut-test-items" align="center" class="td-initial">
<tbody align="center">
<tr>
<th class="td-index">Index</th>
<th class="td-name">Name</th>
<th>Document</th>
<th>&nbsp;&nbsp;Cases</th>
<th>&nbsp;&nbsp;&nbsp;Fail</th>
<th>&nbsp;&nbsp;&nbsp;SKip</th>
<th>CsRate (%)</th>
<th>Checks
<th>CkRate (%)</th>
<th>Lines</th>
<th>CvRate (%)</th>
</tr>
</tbody>
</table>
</div>
<script>
function updateDUTestStatus(data_url){
$.getJSON(data_url, function (data) {
var prefix = data.tree.meta.paths;
var index = 1;
function calcRateColor(rate){
var color = "";
if(rate < 50){
color = "red";
} else if(rate < 85){
color = "orange";
} else {
color = "green";
}
return "<em class=\"em-"+color+"\">" + rate + "</em>";
}
function calcRate(a, b){
if(b === 0){
return 0;
}
return calcRateColor((a / b * 100).toFixed(2));
}
function redItem(item){
if (item > 0) {
return "<em class=\"em-red\">" + item + "</em>";
}
return item;
}
function getDocUrl(url){
if(url){
return "<a href=\"" + url + "\" target=\"_blank\">Detail</a>";
}
return "-";
}
function traverse(node) {
if (!node.children || node.children.length === 0) {
var meta = node.meta
$("#dut-test-items").html($("#dut-test-items").html() +
"<tr><td class=\"td-index\">" + index + "</td>" +
"<td class=\"td-name\">" + meta.paths.replace(prefix + "/",
"").replaceAll("/", ".") + "</td>" +
"<td>" + getDocUrl(meta.doc_url) + "</td>" +
"<td>" + meta.cases.pass + "/" + meta.cases.total + "</td>" +
"<td>" + redItem(meta.cases.fail) + "</td>" +
"<td>" + meta.cases.skip + "</td>" +
"<td>" + calcRate(meta.cases.pass, meta.cases.total) + "</td>" +
"<td>" + meta.functions.cover + "/" +meta.functions.total + "</td>" +
"<td>" + calcRate(meta.functions.cover, meta.functions.total) + "</td>" +
"<td>" + meta.lines.cover + "/" +meta.lines.total + "</td>" +
"<td>" + calcRate(meta.lines.cover, meta.lines.total) + "</td>" +
"</tr>"
);
index++;
} else {
$.each(node.children, function(index, child) {
traverse(child);
});
}
}
traverse(data.tree);
});
}
</script>

View File

@ -143,10 +143,10 @@ function show_datatree_chart(chart_id, data_url) {
});
// set em data
$("#em_id_report_dut_total").text(graph_data["tree"]["meta"]["value"])
$("#em_id_report_dut_total").text(graph_data["tree"]["value"])
$("#em_id_report_dut_min_light").text(graph_data["config"]["default_light_min"])
$("#em_id_report_dut_lighted").text(graph_data["tree"]["meta"]["light_count"])
$("#em_id_report_dut_lighted_no").text(graph_data["tree"]["meta"]["value"] - graph_data["tree"]["meta"]["light_count"])
$("#em_id_report_dut_lighted_no").text(graph_data["tree"]["value"] - graph_data["tree"]["meta"]["light_count"])
});
option && utChart.setOption(option);
}