Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (C) 2012 Google Inc. All rights reserved. | 1 // Copyright (C) 2012 Google Inc. All rights reserved. |
| 2 // | 2 // |
| 3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
| 4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
| 5 // met: | 5 // met: |
| 6 // | 6 // |
| 7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
| 8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
| 9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
| 10 // copyright notice, this list of conditions and the following disclaimer | 10 // copyright notice, this list of conditions and the following disclaimer |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 | 535 |
| 536 html += '</ul>'; | 536 html += '</ul>'; |
| 537 ui.popup.show(e.target, html); | 537 ui.popup.show(e.target, html); |
| 538 } | 538 } |
| 539 | 539 |
| 540 function classNameForFailureString(failure) | 540 function classNameForFailureString(failure) |
| 541 { | 541 { |
| 542 return failure.replace(/(\+|\ )/, ''); | 542 return failure.replace(/(\+|\ )/, ''); |
| 543 } | 543 } |
| 544 | 544 |
| 545 function htmlForTestResults(test) | 545 function htmlForTestResults(test, blinkRevisions) |
| 546 { | 546 { |
| 547 var html = ''; | 547 var html = ''; |
| 548 var testResults = test.rawResults.concat(); | 548 var testResults = test.rawResults.concat(); |
| 549 var times = test.rawTimes.concat(); | 549 var times = test.rawTimes.concat(); |
| 550 var builder = test.builder; | 550 var builder = test.builder; |
| 551 var master = builders.master(builder); | 551 var master = builders.master(builder); |
| 552 var buildNumbers = g_resultsByBuilder[builder].buildNumbers; | 552 var buildNumbers = g_resultsByBuilder[builder].buildNumbers; |
| 553 | 553 |
| 554 var cells = []; | |
| 555 for (var idx = 0; idx < blinkRevisions.length; idx++) | |
|
ojan
2014/06/29 03:38:49
nit: s/idx/index
pdr.
2014/06/29 20:51:34
Done.
| |
| 556 cells.push({revision: blinkRevisions[idx]}); | |
| 557 | |
| 554 var indexToReplaceCurrentResult = -1; | 558 var indexToReplaceCurrentResult = -1; |
| 555 var indexToReplaceCurrentTime = -1; | 559 var indexToReplaceCurrentTime = -1; |
| 556 for (var i = 0; i < buildNumbers.length; i++) { | 560 for (var i = 0; i < buildNumbers.length; i++) { |
| 557 var currentResultArray, currentTimeArray, innerHTML, resultString; | 561 var currentResultArray, currentTimeArray, innerHTML, resultString; |
| 558 | 562 |
| 559 if (i > indexToReplaceCurrentResult) { | 563 if (i > indexToReplaceCurrentResult) { |
| 560 currentResultArray = testResults.shift(); | 564 currentResultArray = testResults.shift(); |
| 561 if (currentResultArray) { | 565 if (currentResultArray) { |
| 562 resultString = g_resultsByBuilder[builder][results.FAILURE_MAP][ currentResultArray[results.RLE.VALUE]]; | 566 resultString = g_resultsByBuilder[builder][results.FAILURE_MAP][ currentResultArray[results.RLE.VALUE]]; |
| 563 indexToReplaceCurrentResult += currentResultArray[results.RLE.LE NGTH]; | 567 indexToReplaceCurrentResult += currentResultArray[results.RLE.LE NGTH]; |
| 564 } else { | 568 } else { |
| 565 resultString = results.NO_DATA; | 569 resultString = results.NO_DATA; |
| 566 indexToReplaceCurrentResult += buildNumbers.length; | 570 indexToReplaceCurrentResult += buildNumbers.length; |
| 567 } | 571 } |
| 568 } | 572 } |
| 569 | 573 |
| 570 if (i > indexToReplaceCurrentTime) { | 574 if (i > indexToReplaceCurrentTime) { |
| 571 currentTimeArray = times.shift(); | 575 currentTimeArray = times.shift(); |
| 572 var currentTime = 0; | 576 var currentTime = 0; |
| 573 if (currentResultArray) { | 577 if (currentResultArray) { |
| 574 currentTime = currentTimeArray[results.RLE.VALUE]; | 578 currentTime = currentTimeArray[results.RLE.VALUE]; |
| 575 indexToReplaceCurrentTime += currentTimeArray[results.RLE.LENGTH]; | 579 indexToReplaceCurrentTime += currentTimeArray[results.RLE.LENGTH]; |
| 576 } else | 580 } else |
| 577 indexToReplaceCurrentTime += buildNumbers.length; | 581 indexToReplaceCurrentTime += buildNumbers.length; |
| 578 | 582 |
| 579 innerHTML = currentTime || ' '; | 583 innerHTML = currentTime || ' '; |
| 580 } | 584 } |
| 581 | 585 |
| 582 html += '<td title="' + resultString + '. Click for more info." class="r esults ' + classNameForFailureString(resultString) + | 586 var blink = parseInt(g_resultsByBuilder[builder][results.BLINK_REVISIONS ][i], 10); |
|
ojan
2014/06/29 03:38:48
nit: s/blink/blinkRevision
pdr.
2014/06/29 20:51:34
Done.
| |
| 587 | |
| 588 // Locate the empty cell corresponding to this blink revision. | |
| 589 var cellIndex = -1; | |
| 590 for (var idx = 0; idx < cells.length && cellIndex == -1; idx++) { | |
|
ojan
2014/06/29 03:38:49
I think this would read more straightforward if yo
pdr.
2014/06/29 20:51:34
Done.
| |
| 591 if (cells[idx].revision == blink && !cells[idx].html) | |
| 592 cellIndex = idx; | |
| 593 } | |
| 594 | |
| 595 cells[cellIndex].className = classNameForFailureString(resultString); | |
| 596 cells[cellIndex].html = '<td title="' + resultString + '. Click for more info." class="results ' + cells[cellIndex].className + | |
| 583 '" onclick=\'showPopupForBuild(event, "' + builder + '",' + i + ',"' + test.test + '")\'>' + innerHTML; | 597 '" onclick=\'showPopupForBuild(event, "' + builder + '",' + i + ',"' + test.test + '")\'>' + innerHTML; |
| 584 } | 598 } |
| 599 | |
| 600 // Set nextClassName on all cells. | |
|
ojan
2014/06/29 03:38:49
Nit: unhelpful comment.
pdr.
2014/06/29 20:51:34
Done.
| |
| 601 for (var idx = 1; idx < cells.length; idx++) | |
| 602 cells[idx].nextClassName = cells[idx - 1].className || cells[idx - 1].ne xtClassName; | |
| 603 | |
| 604 // Set prevClassName on all cells. | |
|
ojan
2014/06/29 03:38:49
Nit: unhelpful comment.
pdr.
2014/06/29 20:51:34
Done.
| |
| 605 for (var idx = cells.length - 2; idx >= 0; --idx) | |
| 606 cells[idx].prevClassName = cells[idx + 1].className || cells[idx + 1].pr evClassName; | |
| 607 | |
| 608 var numResultsToShow = buildNumbers.length; | |
| 609 for (var idx = cells.length - 1; idx >= (cells.length - numResultsToShow); - -idx) { | |
| 610 if (cells[idx].html) { | |
| 611 html += cells[idx].html; | |
| 612 } else { | |
| 613 if (cells[idx].nextClassName == cells[idx].prevClassName) | |
| 614 html += '<td class="interpolatedResults results ' + cells[idx].n extClassName + '"> </td>'; | |
|
ojan
2014/06/29 03:38:49
Should put a title on these so people can understa
pdr.
2014/06/29 20:51:34
Done.
| |
| 615 else | |
| 616 html += '<td> </td>'; | |
| 617 } | |
| 618 } | |
| 585 return html; | 619 return html; |
| 586 } | 620 } |
| 587 | 621 |
| 588 function shouldShowTest(testResult) | 622 function shouldShowTest(testResult) |
| 589 { | 623 { |
| 590 if (!g_history.isLayoutTestResults()) | 624 if (!g_history.isLayoutTestResults()) |
| 591 return true; | 625 return true; |
| 592 | 626 |
| 593 if (testResult.expectations == 'WONTFIX') | 627 if (testResult.expectations == 'WONTFIX') |
| 594 return g_history.dashboardSpecificState.showWontFix; | 628 return g_history.dashboardSpecificState.showWontFix; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 642 var bugHtml; | 676 var bugHtml; |
| 643 if (string.startsWith(bug, 'Bug(')) | 677 if (string.startsWith(bug, 'Bug(')) |
| 644 bugHtml = bug; | 678 bugHtml = bug; |
| 645 else | 679 else |
| 646 bugHtml = '<a href="http://' + bug + '">' + bug + '</a>'; | 680 bugHtml = '<a href="http://' + bug + '">' + bug + '</a>'; |
| 647 html += '<div>' + bugHtml + '</div>' | 681 html += '<div>' + bugHtml + '</div>' |
| 648 }); | 682 }); |
| 649 return html; | 683 return html; |
| 650 } | 684 } |
| 651 | 685 |
| 652 function htmlForSingleTestRow(test, showBuilderNames) | 686 function htmlForSingleTestRow(test, showBuilderNames, revisions) |
| 653 { | 687 { |
| 654 var headers = tableHeaders(); | 688 var headers = tableHeaders(); |
| 655 var html = ''; | 689 var html = ''; |
| 656 for (var i = 0; i < headers.length; i++) { | 690 for (var i = 0; i < headers.length; i++) { |
| 657 var header = headers[i]; | 691 var header = headers[i]; |
| 658 if (string.startsWith(header, 'test') || string.startsWith(header, 'buil der')) { | 692 if (string.startsWith(header, 'test') || string.startsWith(header, 'buil der')) { |
| 659 var testCellClassName = 'test-link' + (showBuilderNames ? ' builder- name' : ''); | 693 var testCellClassName = 'test-link' + (showBuilderNames ? ' builder- name' : ''); |
| 660 var testCellHTML = showBuilderNames ? test.builder : '<span class="l ink" onclick="g_history.setQueryParameter(\'tests\',\'' + test.test +'\');">' + test.test + '</span>'; | 694 var testCellHTML = showBuilderNames ? test.builder : '<span class="l ink" onclick="g_history.setQueryParameter(\'tests\',\'' + test.test +'\');">' + test.test + '</span>'; |
| 661 html += '<tr><td class="' + testCellClassName + '">' + testCellHTML; | 695 html += '<tr><td class="' + testCellClassName + '">' + testCellHTML; |
| 662 } else if (string.startsWith(header, 'bugs')) | 696 } else if (string.startsWith(header, 'bugs')) |
| 663 // FIXME: linkify bugs. | 697 // FIXME: linkify bugs. |
| 664 html += '<td class=options-container>' + (linkifyBugs(test.bugs) || createBugHTML(test)); | 698 html += '<td class=options-container>' + (linkifyBugs(test.bugs) || createBugHTML(test)); |
| 665 else if (string.startsWith(header, 'expectations')) | 699 else if (string.startsWith(header, 'expectations')) |
| 666 html += '<td class=options-container>' + test.expectations; | 700 html += '<td class=options-container>' + test.expectations; |
| 667 else if (string.startsWith(header, 'slowest')) | 701 else if (string.startsWith(header, 'slowest')) |
| 668 html += '<td>' + (test.slowestTime ? test.slowestTime + 's' : ''); | 702 html += '<td>' + (test.slowestTime ? test.slowestTime + 's' : ''); |
| 669 else if (string.startsWith(header, 'flakiness')) | 703 else if (string.startsWith(header, 'flakiness')) |
| 670 html += htmlForTestResults(test); | 704 html += htmlForTestResults(test, revisions); |
| 671 } | 705 } |
| 672 return html; | 706 return html; |
| 673 } | 707 } |
| 674 | 708 |
| 675 function sortColumnFromTableHeader(headerText) | 709 function sortColumnFromTableHeader(headerText) |
| 676 { | 710 { |
| 677 return headerText.split(' ', 1)[0]; | 711 return headerText.split(' ', 1)[0]; |
| 678 } | 712 } |
| 679 | 713 |
| 680 function htmlForTableColumnHeader(headerName, opt_fillColSpan) | 714 function htmlForTableColumnHeader(headerName, opt_fillColSpan) |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 776 sortFunctionGetter = numericSort; | 810 sortFunctionGetter = numericSort; |
| 777 resultsProperty = 'slowestTime'; | 811 resultsProperty = 'slowestTime'; |
| 778 } else { | 812 } else { |
| 779 sortFunctionGetter = alphanumericCompare; | 813 sortFunctionGetter = alphanumericCompare; |
| 780 resultsProperty = column; | 814 resultsProperty = column; |
| 781 } | 815 } |
| 782 | 816 |
| 783 tests.sort(sortFunctionGetter(resultsProperty, order == BACKWARD)); | 817 tests.sort(sortFunctionGetter(resultsProperty, order == BACKWARD)); |
| 784 } | 818 } |
| 785 | 819 |
| 820 // Return an array of unique blink build revisions across all builders. | |
| 821 // The array contains blink revisions but note that these revisions may not be | |
| 822 // unique: builds of blink@r123,chrome@r567 and blink@r123,chrome@r568 will | |
| 823 // result in two entries of 123 in the returned array. | |
| 824 function blinkBuildRevisions(testResults) | |
| 825 { | |
| 826 var revisionsCountedSet = {}; | |
| 827 for (var j = 0; j < testResults.length; j++) { | |
| 828 var builder = testResults[j].builder; | |
| 829 var build = g_resultsByBuilder[builder]; | |
| 830 var buildNumbers = build.buildNumbers; | |
| 831 var builderRevisionsCountedSet = {}; | |
| 832 for (var i = 0; i < buildNumbers.length; i++) { | |
| 833 var blinkRevision = build[results.BLINK_REVISIONS][i]; | |
| 834 builderRevisionsCountedSet[blinkRevision] = (builderRevisionsCounted Set[blinkRevision] || 0) + 1; | |
| 835 } | |
| 836 | |
| 837 // Join the builder's revisions with the total revisions for all builder s. | |
| 838 for (var revision in builderRevisionsCountedSet) | |
| 839 revisionsCountedSet[revision] = Math.max(revisionsCountedSet[revisio n] || 0, builderRevisionsCountedSet[revision]); | |
| 840 } | |
| 841 | |
| 842 var revisionsArray = []; | |
| 843 for (var revision in revisionsCountedSet) { | |
| 844 for (var i = revisionsCountedSet[revision] - 1; i >= 0; --i) | |
| 845 revisionsArray.push(revision); | |
| 846 } | |
| 847 | |
| 848 revisionsArray.sort(function(a, b) { | |
| 849 return (a - b); | |
| 850 }); | |
| 851 return revisionsArray; | |
| 852 } | |
| 853 | |
| 786 function htmlForIndividualTestOnAllBuilders(test) | 854 function htmlForIndividualTestOnAllBuilders(test) |
| 787 { | 855 { |
| 788 processTestRunsForAllBuilders(); | 856 processTestRunsForAllBuilders(); |
| 789 | 857 |
| 790 var testResults = g_testToResultsMap[test]; | 858 var testResults = g_testToResultsMap[test]; |
| 791 if (!testResults) | 859 if (!testResults) |
| 792 return '<div class="not-found">Test not found. Either it does not exist, is skipped or passes on all recorded runs.</div>'; | 860 return '<div class="not-found">Test not found. Either it does not exist, is skipped or passes on all recorded runs.</div>'; |
| 793 | 861 |
| 794 var html = ''; | 862 var html = ''; |
| 795 var shownBuilders = []; | 863 var shownBuilders = []; |
| 864 var blinkRevisions = blinkBuildRevisions(testResults); | |
| 796 for (var j = 0; j < testResults.length; j++) { | 865 for (var j = 0; j < testResults.length; j++) { |
| 797 shownBuilders.push(testResults[j].builder); | 866 shownBuilders.push(testResults[j].builder); |
| 798 var showBuilderNames = true; | 867 var showBuilderNames = true; |
| 799 html += htmlForSingleTestRow(testResults[j], showBuilderNames); | 868 html += htmlForSingleTestRow(testResults[j], showBuilderNames, blinkRevi sions); |
| 800 } | 869 } |
| 801 | 870 |
| 802 var skippedBuilders = [] | 871 var skippedBuilders = [] |
| 803 for (builder in currentBuilders()) { | 872 for (builder in currentBuilders()) { |
| 804 if (shownBuilders.indexOf(builder) == -1) | 873 if (shownBuilders.indexOf(builder) == -1) |
| 805 skippedBuilders.push(builder); | 874 skippedBuilders.push(builder); |
| 806 } | 875 } |
| 807 | 876 |
| 808 var skippedBuildersHtml = ''; | 877 var skippedBuildersHtml = ''; |
| 809 if (skippedBuilders.length) { | 878 if (skippedBuilders.length) { |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1254 { | 1323 { |
| 1255 processTestRunsForBuilder(builderName); | 1324 processTestRunsForBuilder(builderName); |
| 1256 | 1325 |
| 1257 var filteredResults = g_perBuilderFailures[builderName].filter(shouldShowTes t); | 1326 var filteredResults = g_perBuilderFailures[builderName].filter(shouldShowTes t); |
| 1258 sortTests(filteredResults, g_history.dashboardSpecificState.sortColumn, g_hi story.dashboardSpecificState.sortOrder); | 1327 sortTests(filteredResults, g_history.dashboardSpecificState.sortColumn, g_hi story.dashboardSpecificState.sortOrder); |
| 1259 | 1328 |
| 1260 var testsHTML = ''; | 1329 var testsHTML = ''; |
| 1261 if (filteredResults.length) { | 1330 if (filteredResults.length) { |
| 1262 var tableRowsHTML = ''; | 1331 var tableRowsHTML = ''; |
| 1263 var showBuilderNames = false; | 1332 var showBuilderNames = false; |
| 1333 var blinkRevisions = blinkBuildRevisions(testResults); | |
| 1264 for (var i = 0; i < filteredResults.length; i++) | 1334 for (var i = 0; i < filteredResults.length; i++) |
| 1265 tableRowsHTML += htmlForSingleTestRow(filteredResults[i], showBuilde rNames) | 1335 tableRowsHTML += htmlForSingleTestRow(filteredResults[i], showBuilde rNames, blinkRevisions) |
| 1266 testsHTML = htmlForTestTable(tableRowsHTML); | 1336 testsHTML = htmlForTestTable(tableRowsHTML); |
| 1267 } else { | 1337 } else { |
| 1268 if (g_history.isLayoutTestResults()) | 1338 if (g_history.isLayoutTestResults()) |
| 1269 testsHTML += '<div>Fill in one of the text inputs or checkboxes abov e to show failures.</div>'; | 1339 testsHTML += '<div>Fill in one of the text inputs or checkboxes abov e to show failures.</div>'; |
| 1270 else | 1340 else |
| 1271 testsHTML += '<div>No tests have failed!</div>'; | 1341 testsHTML += '<div>No tests have failed!</div>'; |
| 1272 } | 1342 } |
| 1273 | 1343 |
| 1274 var html = htmlForNavBar(); | 1344 var html = htmlForNavBar(); |
| 1275 | 1345 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1380 // escape key | 1450 // escape key |
| 1381 hideLegend(); | 1451 hideLegend(); |
| 1382 ui.popup.hide(); | 1452 ui.popup.hide(); |
| 1383 } | 1453 } |
| 1384 }, false); | 1454 }, false); |
| 1385 | 1455 |
| 1386 window.addEventListener('load', function() { | 1456 window.addEventListener('load', function() { |
| 1387 resourceLoader = new loader.Loader(); | 1457 resourceLoader = new loader.Loader(); |
| 1388 resourceLoader.load(); | 1458 resourceLoader.load(); |
| 1389 }, false); | 1459 }, false); |
| OLD | NEW |