diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-08-18 00:18:30 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-08-18 00:18:30 +0000 |
commit | 7148352cb05e0d011d568f1465cfb1ef1882dcce (patch) | |
tree | 6333fc1196c8537436141f64f3b7cc0831501e0f /src | |
parent | 849c33c6215f10e20967f2b8a833ec9b1093b1fb (diff) | |
parent | 35707068892d614d836a9b8d8a166d0d0b87b4b8 (diff) | |
download | dashboard-7148352cb05e0d011d568f1465cfb1ef1882dcce.tar.gz |
Merge "Rest API for coverage API and API coverage entity"
Diffstat (limited to 'src')
-rw-r--r-- | src/main/webapp/WEB-INF/appengine-web.xml | 4 | ||||
-rw-r--r-- | src/main/webapp/WEB-INF/jsp/show_coverage.jsp | 2 | ||||
-rw-r--r-- | src/main/webapp/WEB-INF/jsp/show_plan_run.jsp | 110 | ||||
-rw-r--r-- | src/main/webapp/WEB-INF/jsp/show_release.jsp | 6 | ||||
-rw-r--r-- | src/main/webapp/WEB-INF/queue.xml | 6 | ||||
-rw-r--r-- | src/main/webapp/css/common.css | 4 | ||||
-rw-r--r-- | src/main/webapp/css/navbar.css | 1 | ||||
-rw-r--r-- | src/main/webapp/js/test_results.js | 20 | ||||
-rw-r--r-- | src/test/java/com/android/vts/job/VtsProfilingStatsJobServletTest.java | 52 |
9 files changed, 163 insertions, 42 deletions
diff --git a/src/main/webapp/WEB-INF/appengine-web.xml b/src/main/webapp/WEB-INF/appengine-web.xml index d019e5c..714aa54 100644 --- a/src/main/webapp/WEB-INF/appengine-web.xml +++ b/src/main/webapp/WEB-INF/appengine-web.xml @@ -18,10 +18,6 @@ <runtime>java8</runtime> <instance-class>F4_1G</instance-class> - <staging> - <enable-jar-classes>true</enable-jar-classes> - </staging> - <system-properties> </system-properties> diff --git a/src/main/webapp/WEB-INF/jsp/show_coverage.jsp b/src/main/webapp/WEB-INF/jsp/show_coverage.jsp index a1a38f5..0d1e5ce 100644 --- a/src/main/webapp/WEB-INF/jsp/show_coverage.jsp +++ b/src/main/webapp/WEB-INF/jsp/show_coverage.jsp @@ -47,7 +47,7 @@ var cmd = $(evt.target).text(); var testRunId = $(evt.target).data("id"); var postData = { coverageId: testRunId, testName: "${testName}", testRunId: "${startTime}", cmd: cmd}; - $.post("/api/coverage", postData, function() { + $.post("/api/coverage/data", postData, function() { // success console.log("success"); var detachedLi = $(evt.target).parent().parent().detach(); diff --git a/src/main/webapp/WEB-INF/jsp/show_plan_run.jsp b/src/main/webapp/WEB-INF/jsp/show_plan_run.jsp index 474cefa..bec4c76 100644 --- a/src/main/webapp/WEB-INF/jsp/show_plan_run.jsp +++ b/src/main/webapp/WEB-INF/jsp/show_plan_run.jsp @@ -32,8 +32,73 @@ $(document).ready(function() { $('#test-results-container').showTests(${testRuns}, true); drawSummary(); + + $('#apiCoverageModal').modal({ + width: '75%', + dismissible: true, // Modal can be dismissed by clicking outside of the modal + opacity: .5, // Opacity of modal background + inDuration: 300, // Transition in duration + outDuration: 200, // Transition out duration + startingTop: '4%', // Starting top style attribute + endingTop: '10%', // Ending top style attribute + ready: function(modal, trigger) { // Callback for Modal open. Modal and trigger parameters available. + var urlSafeKeyList = modal.data('urlSafeKeyList'); + var halApiInfoList = []; + var getAjaxList = $.map( urlSafeKeyList, function( urlSafeKey ) { + return $.get( "/api/coverage/api/data?key=" + urlSafeKey, function(data) { + halApiInfoList.push(data); + }) + .fail(function() { + alert( "Error : can't bring API coverage data from the server" ); + }); + }); + + $.when.apply($, getAjaxList).then(function() { + $.each(halApiInfoList, function( index, data ) { + $("#halApiList").append(halApiListTemplate()); + var version = data.halMajorVersion + '.' + data.halMinorVersion; + var defaultInfo = data.halPackageName + '@' + version + '::' + data.halInterfaceName; + $("#halApiList > li:last > div.collapsible-header").html( + '<i class="material-icons">report</i> HAL API Information : ' + defaultInfo + ); + /* + $("#halApiList > li:last > div.collapsible-body > ul.collection.with-header").append( + '<li class="collection-header">' + + '</li>' + ); + */ + + $("#halApiList > li:last > div.collapsible-body > ul.collection.with-header").append( + $.map( data.halApi, function( apiName, idx ) { + var colorClass = data.coveredHalApi.indexOf(apiName) > -1 ? "green" : "red" + return '<li class="collection-item ' + colorClass + ' lighten-1">' + apiName + '</li>'; + }).join("") + ); + $("#halApiList").collapsible('open', index); + }); + $('#dataTableLoading').hide("slow"); + }); + }, + complete: function() { + $("#halApiList").empty(); + $('#dataTableLoading').show("slow"); + } // Callback for Modal close + } + ); }); + function halApiListTemplate() { + return '<li>' + + '<div class="collapsible-header">' + + '<i class="material-icons">report</i> API Information' + + '</div>' + + '<div class="collapsible-body">' + + '<ul class="collection with-header">' + + '</ul>' + + '</div>' + + '</li>'; + } + // to draw pie chart function drawPieChart() { var topBuildResultCounts = ${topBuildResultCounts}; @@ -86,6 +151,12 @@ details.append('<b>Modules: </b>' + moduleCount + '<br>'); details.append('<b>Passing Test Cases: </b>' + passingTestCaseCount + '<br>'); details.append('<b>Non-Passing Test Cases: </b>' + failingTestCaseCount + '<br>'); + + <c:if test="${totalApiCount > 0 && totalCoveredApiCount >= 0}"> + details.append('<b>Total API : </b><c:out value="${totalApiCount}"/><br>'); + details.append('<b>Total Covered API : </b><c:out value="${totalCoveredApiCount}"/><br>'); + </c:if> + div.appendTo($('#summary-container')); } </script> @@ -120,9 +191,46 @@ </div> </div> - <div class='col s12' id='test-results-container'> + <div class='col s12' id='test-results-container'></div> + </div> + + <!-- Modal Structure --> + <div id="apiCoverageModal" class="modal modal-fixed-footer" style="width: 75%;"> + <div class="modal-content"> + <h4 id="coverageModalTitle">API Coverage</h4> + + <div class="preloader-wrapper big active loaders"> + <div id="dataTableLoading" class="spinner-layer spinner-blue-only"> + <div class="circle-clipper left"> + <div class="circle"></div> + </div> + <div class="gap-patch"> + <div class="circle"></div> + </div> + <div class="circle-clipper right"> + <div class="circle"></div> + </div> + </div> + </div> + + <div class="row"> + <div class="col s12"> + <ul class="collection with-header"> + <li class="collection-header"> + <h4>Total HAL API List</h4> + <ul id="halApiList" class="collapsible popout" data-collapsible="expandable"> + + </ul> + </li> + </ul> + </div> + </div> + </div> + <div class="modal-footer"> + <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">Close</a> </div> </div> + <%@ include file="footer.jsp" %> </body> </html> diff --git a/src/main/webapp/WEB-INF/jsp/show_release.jsp b/src/main/webapp/WEB-INF/jsp/show_release.jsp index 40a072f..9e8c2eb 100644 --- a/src/main/webapp/WEB-INF/jsp/show_release.jsp +++ b/src/main/webapp/WEB-INF/jsp/show_release.jsp @@ -34,7 +34,7 @@ <div class='row'> <div class='col s12'> - <ul class="tabs"> + <ul class="tabs z-depth-1"> <li class="tab col s6" id="planTabLink"> <a class="${testType == 'plan' ? 'active' : 'inactive'}" href="${requestScope['javax.servlet.forward.servlet_path']}?type=plan">Test Plans</a> </li> @@ -51,14 +51,14 @@ <c:forEach items='${planNames}' var='plan'> <c:choose> <c:when test="${isAdmin}"> - <div class="col s11 center"> + <div class="col s10 center"> <a href='/show_plan_release?plan=${plan}${typeParam}'> <div class='col s12 card hoverable option valign-wrapper waves-effect'> <span class='entry valign'>${plan}</span> </div> </a> </div> - <div class="col s1 center btn-container" style="margin-top: 9px;"> + <div class="col s2 center btn-container" style="margin-top: 9px;"> <a href='/show_green_release?plan=${plan}${typeParam}' class="waves-effect waves-light btn">Green</a> </div> </c:when> diff --git a/src/main/webapp/WEB-INF/queue.xml b/src/main/webapp/WEB-INF/queue.xml index 8900015..3a116f2 100644 --- a/src/main/webapp/WEB-INF/queue.xml +++ b/src/main/webapp/WEB-INF/queue.xml @@ -26,4 +26,10 @@ Copyright (C) 2017 The Android Open Source Project <bucket-size>40</bucket-size> <max-concurrent-requests>10</max-concurrent-requests> </queue> + <queue> + <name>coverageApiQueue</name> + <rate>20/s</rate> + <bucket-size>100</bucket-size> + <max-concurrent-requests>10</max-concurrent-requests> + </queue> </queue-entries>
\ No newline at end of file diff --git a/src/main/webapp/css/common.css b/src/main/webapp/css/common.css index 2b43210..3e0a1c9 100644 --- a/src/main/webapp/css/common.css +++ b/src/main/webapp/css/common.css @@ -13,13 +13,11 @@ limitations under the License. */ -.container { - min-height: 80%; -} @media only screen and (min-width: 993px) { .wide.container { width: 80%; max-width: 1600px; + min-height: 80vh; } } .TEST_CASE_RESULT_PASS { diff --git a/src/main/webapp/css/navbar.css b/src/main/webapp/css/navbar.css index 9395d1b..cf16f60 100644 --- a/src/main/webapp/css/navbar.css +++ b/src/main/webapp/css/navbar.css @@ -13,7 +13,6 @@ limitations under the License. */ nav#navbar { - height: auto; margin-bottom: 30px; user-select: none; } diff --git a/src/main/webapp/js/test_results.js b/src/main/webapp/js/test_results.js index a7be803..e00d6ac 100644 --- a/src/main/webapp/js/test_results.js +++ b/src/main/webapp/js/test_results.js @@ -243,9 +243,9 @@ metadata.testRun.totalLineCount != undefined) { var url = ( '/show_coverage?testName=' + test + '&startTime=' + startTime); - covered = metadata.testRun.coveredLineCount; - total = metadata.testRun.totalLineCount; - covPct = Math.round(covered / total * 1000) / 10; + var covered = metadata.testRun.coveredLineCount; + var total = metadata.testRun.totalLineCount; + var covPct = Math.round(covered / total * 1000) / 10; var color = 'red'; if (covPct > 20 && covPct < 70) { color = 'orange'; @@ -258,6 +258,20 @@ div, coverage, color, function () { window.location.href = url; return false; }); } + if (metadata.testRun.coveredApiCount != undefined && + metadata.testRun.totalApiCount != undefined) { + var covered = metadata.testRun.coveredApiCount; + var total = metadata.testRun.totalApiCount; + var apiCoverage = ('API Coverage: ' + covered + '/' + total); + createClickableIndicator( + div, apiCoverage, 'yellow grey-text', + function (evt) { + $('#apiCoverageModal').data("urlSafeKeyList", metadata.testRun.apiCoverageKeyList); + $('#apiCoverageModal').modal('open'); + return false; + } + ); + } if (metadata.testRun.logLinks != undefined) { createClickableIndicator( div, 'Links', 'grey lighten-1', diff --git a/src/test/java/com/android/vts/job/VtsProfilingStatsJobServletTest.java b/src/test/java/com/android/vts/job/VtsProfilingStatsJobServletTest.java index 8cfe5b5..5ed748e 100644 --- a/src/test/java/com/android/vts/job/VtsProfilingStatsJobServletTest.java +++ b/src/test/java/com/android/vts/job/VtsProfilingStatsJobServletTest.java @@ -254,7 +254,7 @@ public class VtsProfilingStatsJobServletTest { DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); // Check profiling point entity - Key profilingPointKey = ProfilingPointEntity.createKey(test, profilingPointRunEntity.name); + Key profilingPointKey = ProfilingPointEntity.createKey(test, profilingPointRunEntity.getName()); ProfilingPointEntity profilingPointEntity = null; try { Entity profilingPoint = datastore.get(profilingPointKey); @@ -263,11 +263,11 @@ public class VtsProfilingStatsJobServletTest { fail(); } assertNotNull(profilingPointEntity); - assertEquals(profilingPointRunEntity.name, profilingPointEntity.profilingPointName); - assertEquals(profilingPointRunEntity.xLabel, profilingPointEntity.xLabel); - assertEquals(profilingPointRunEntity.yLabel, profilingPointEntity.yLabel); - assertEquals(profilingPointRunEntity.type, profilingPointEntity.type); - assertEquals(profilingPointRunEntity.regressionMode, profilingPointEntity.regressionMode); + assertEquals(profilingPointRunEntity.getName(), profilingPointEntity.getProfilingPointName()); + assertEquals(profilingPointRunEntity.getXLabel(), profilingPointEntity.getXLabel()); + assertEquals(profilingPointRunEntity.getYLabel(), profilingPointEntity.getYLabel()); + assertEquals(profilingPointRunEntity.getType(), profilingPointEntity.getType()); + assertEquals(profilingPointRunEntity.getRegressionMode(), profilingPointEntity.getRegressionMode()); // Check all summary entities Query q = new Query(ProfilingPointSummaryEntity.KIND).setAncestor(profilingPointKey); @@ -275,16 +275,16 @@ public class VtsProfilingStatsJobServletTest { ProfilingPointSummaryEntity pps = ProfilingPointSummaryEntity.fromEntity(e); assertNotNull(pps); assertTrue( - pps.branch.equals(device.branch) - || pps.branch.equals(ProfilingPointSummaryEntity.ALL)); + pps.getBranch().equals(device.getBranch()) + || pps.getBranch().equals(ProfilingPointSummaryEntity.ALL)); assertTrue( - pps.buildFlavor.equals(ProfilingPointSummaryEntity.ALL) - || pps.buildFlavor.equals(device.buildFlavor)); - assertEquals(expected.getCount(), pps.globalStats.getCount()); - assertEquals(expected.getMax(), pps.globalStats.getMax(), THRESHOLD); - assertEquals(expected.getMin(), pps.globalStats.getMin(), THRESHOLD); - assertEquals(expected.getMean(), pps.globalStats.getMean(), THRESHOLD); - assertEquals(expected.getSumSq(), pps.globalStats.getSumSq(), THRESHOLD); + pps.getBuildFlavor().equals(ProfilingPointSummaryEntity.ALL) + || pps.getBuildFlavor().equals(device.getBuildFlavor())); + assertEquals(expected.getCount(), pps.getGlobalStats().getCount()); + assertEquals(expected.getMax(), pps.getGlobalStats().getMax(), THRESHOLD); + assertEquals(expected.getMin(), pps.getGlobalStats().getMin(), THRESHOLD); + assertEquals(expected.getMean(), pps.getGlobalStats().getMean(), THRESHOLD); + assertEquals(expected.getSumSq(), pps.getGlobalStats().getSumSq(), THRESHOLD); } } @@ -324,7 +324,7 @@ public class VtsProfilingStatsJobServletTest { devices.add(device); // Create the existing stats - Key profilingPointKey = ProfilingPointEntity.createKey(test, profilingPointRunEntity.name); + Key profilingPointKey = ProfilingPointEntity.createKey(test, profilingPointRunEntity.getName()); StatSummary expected = new StatSummary( "label", @@ -340,8 +340,8 @@ public class VtsProfilingStatsJobServletTest { expected, new ArrayList<>(), new HashMap<>(), - device.branch, - device.buildFlavor, + device.getBranch(), + device.getBuildFlavor(), series, time); @@ -360,7 +360,7 @@ public class VtsProfilingStatsJobServletTest { // Get the summary and check the values match what is expected Key summaryKey = ProfilingPointSummaryEntity.createKey( - profilingPointKey, device.branch, device.buildFlavor, series, time); + profilingPointKey, device.getBranch(), device.getBuildFlavor(), series, time); ProfilingPointSummaryEntity pps = null; try { Entity e = datastore.get(summaryKey); @@ -369,12 +369,12 @@ public class VtsProfilingStatsJobServletTest { fail(); } assertNotNull(pps); - assertTrue(pps.branch.equals(device.branch)); - assertTrue(pps.buildFlavor.equals(device.buildFlavor)); - assertEquals(expected.getCount(), pps.globalStats.getCount()); - assertEquals(expected.getMax(), pps.globalStats.getMax(), THRESHOLD); - assertEquals(expected.getMin(), pps.globalStats.getMin(), THRESHOLD); - assertEquals(expected.getMean(), pps.globalStats.getMean(), THRESHOLD); - assertEquals(expected.getSumSq(), pps.globalStats.getSumSq(), THRESHOLD); + assertTrue(pps.getBranch().equals(device.getBranch())); + assertTrue(pps.getBuildFlavor().equals(device.getBuildFlavor())); + assertEquals(expected.getCount(), pps.getGlobalStats().getCount()); + assertEquals(expected.getMax(), pps.getGlobalStats().getMax(), THRESHOLD); + assertEquals(expected.getMin(), pps.getGlobalStats().getMin(), THRESHOLD); + assertEquals(expected.getMean(), pps.getGlobalStats().getMean(), THRESHOLD); + assertEquals(expected.getSumSq(), pps.getGlobalStats().getSumSq(), THRESHOLD); } } |