Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter for test coverage #1549

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 73 additions & 1 deletion conf/report/report-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,31 @@
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/fixedheader/3.1.5/js/dataTables.fixedHeader.min.js"> </script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/fixedheader/3.1.5/css/fixedHeader.dataTables.min.css">
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/select/1.3.3/js/dataTables.select.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/select/1.3.3/css/select.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="report.css">
<script type="text/javascript" charset="utf8" src="report.js"></script>
</head>

<script>
function toggleTestCoverage() {
var x = document.getElementById("test_coverage");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}

function toggleFilters() {
var x = document.getElementById("filters");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}

$(document).ready( function () {
$('#report_table').DataTable( {
paging: false,
Expand All @@ -33,7 +53,53 @@
{% for tool in report %}
{ "orderDataType": "test-status" },
{% endfor %}
]
],
initComplete: function() {
this.api().columns().every( function () {
var column = this;
if (column.index() !== 0 && column.index() !== 1) {
var theadname = column.header().textContent;
var select = $('<select><option value="Select">'+theadname+'</option></select>')
.appendTo("#test_coverage")
.on('change', function() {
var array = [];
var val = $(this).val();
if(val.length > 1){
val = parseFloat(val.slice(0, -1));
} else {
val = parseFloat(val);
}
column.data().each(function(d, j) {
output = d.split('/');
tests_passed = output[0];
total_tests = output[1];
percentage = (tests_passed/total_tests)*100;

// 0 tests passed
if(tests_passed == val && tests_passed == 0 && tests_passed != ""){
array.push('^'+d+'$');
}
// At least 1 test passed
else if(tests_passed >= val && val == 1){
array.push('^'+d+'$');
}
// other cases
else if(percentage >= val && val > 1) {
array.push('^'+d+'$');
}
});
array = array.join('|');
column.search(array, true, false, true).draw();
} );
select.append('<option value="0">0</option>');
select.append('<option value="1">1</option>');
select.append('<option value="25%">25%</option>');
select.append('<option value="50%">50%</option>');
select.append('<option value="75%">75%</option>');
select.append('<option value="100%">All</option>');
}
} );
}
});
} );
</script>
Expand All @@ -46,6 +112,12 @@
<body>
<h1 class="headline"><a href="https://github.com/SymbiFlow/sv-tests">SV-Tests</a></h1>
<p class="headline"><a href="https://github.com/SymbiFlow/sv-tests"><em>Test suite to check compliance with the SystemVerilog LRM by chapter as well as some real-world cores and test-cases.</em></a></p>
<button id="filterButton" onclick="toggleFilters()">Hide/Show Filter Options</button>
<div id="filters">
<p>Filter by test coverage</p>
<button onclick="toggleTestCoverage()">Hide/Show</button>
<div id="test_coverage"></div>
</div>
<table id="report_table">
<thead>
<tr class="fixed_header">
Expand Down