Changeset 87148 in webkit


Ignore:
Timestamp:
May 24, 2011 8:09:39 AM (13 years ago)
Author:
Adam Roben
Message:

Make TestFailures show how many tests are failing on each tester, and omit testers with no failures

Fixes <http://webkit.org/b/61063> <rdar://problem/9460533> TestFailures page shows testers
that don't have any failing tests, which isn't useful

Reviewed by David Kilzer.

  • BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Buildbot.js:

(Buildbot.prototype.getTesters): Renamed from getTesterNames. Now returns Builder objects
instead of name strings.
(Buildbot.prototype._buildersForNames): Added. Helper function to convert an array of
builder names into an array of builders.

  • BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js:

(Builder.prototype.getMostRecentCompletedBuildNumber): Added. Returns the build number of
the most recently completed build, or -1 if there is no such build.
(Builder.prototype.getNumberOfFailingTests): Added. Returns the number of tests that failed
in the given build, or -1 if the number could not be determined. Some of this code came from
_getFailingTests.
(Builder.prototype._getBuildJSON): Added. Code came from _getFailingTests.
(Builder.prototype._getFailingTests): Changed to use new _getBuildJSON and
getNumberOfFailingTests functions.

  • BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js:

(ViewController.prototype._displayTesters): Get the current number of test failures for each
tester and show it in the list. Omit testers that have no failures at all. We keep the
testers and failure counts in an array and sort it before displaying the current data, as
the order in which data will be fetched is unpredictable.

Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Buildbot.js

    r86766 r87148  
    4242    },
    4343
    44     getTesterNames: function(callback) {
    45         var cacheKey = 'getTesterNames';
     44    getTesters: function(callback) {
     45        var cacheKey = 'getTesters';
    4646        if (cacheKey in this._cache) {
    47             callback(this._cache[cacheKey]);
     47            callback(this._buildersForNames(this._cache[cacheKey]));
    4848            return;
    4949        }
     
    5858
    5959            self._cache[cacheKey] = names;
    60             callback(names);
     60            callback(self._buildersForNames(names));
    6161        });
    6262    },
     
    7272        return this.baseURL + 'results/' + builderName + '/' + buildName + '/';
    7373    },
     74
     75    _buildersForNames: function(names) {
     76        var self = this;
     77        return names.map(function(name) { return self.builderNamed(name) });
     78    },
    7479};
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js

    r86766 r87148  
    5858    },
    5959
     60    getMostRecentCompletedBuildNumber: function(callback) {
     61        var cacheKey = 'getMostRecentCompletedBuildNumber';
     62        if (cacheKey in this._cache) {
     63            callback(this._cache[cacheKey]);
     64            return;
     65        }
     66
     67        var self = this;
     68        getResource(self.buildbot.baseURL + 'json/builders/' + self.name, function(xhr) {
     69            var data = JSON.parse(xhr.responseText);
     70
     71            var oldestUnfinishedBuild = Infinity;
     72            if ('currentBuilds' in data)
     73                oldestUnfinishedBuild = data.currentBuilds[0];
     74
     75            for (var i = data.cachedBuilds.length - 1; i >= 0; --i) {
     76                if (data.cachedBuilds[i] >= oldestUnfinishedBuild)
     77                    continue;
     78
     79                self._cache[cacheKey] = data.cachedBuilds[i];
     80                callback(data.cachedBuilds[i]);
     81                return;
     82            }
     83
     84            self._cache[cacheKey] = -1;
     85            callback(self._cache[cacheKey]);
     86        },
     87        function(xhr) {
     88            self._cache[cacheKey] = -1;
     89            callback(self._cache[cacheKey]);
     90        });
     91    },
     92
     93    getNumberOfFailingTests: function(buildNumber, callback) {
     94        var cacheKey = 'getNumberOfFailingTests_' + buildNumber;
     95        if (cacheKey in this._cache) {
     96            callback(this._cache[cacheKey]);
     97            return;
     98        }
     99
     100        var self = this;
     101        self._getBuildJSON(buildNumber, function(data) {
     102            var layoutTestStep = data.steps.findFirst(function(step) { return step.name === 'layout-test'; });
     103            if (!layoutTestStep) {
     104                self._cache[cacheKey] = -1;
     105                callback(self._cache[cacheKey]);
     106                return;
     107            }
     108
     109            if (!('isStarted' in layoutTestStep)) {
     110                // run-webkit-tests never even ran.
     111                self._cache[cacheKey] = -1;
     112                callback(self._cache[cacheKey]);
     113                return;
     114            }
     115
     116            if (!('results' in layoutTestStep) || layoutTestStep.results[0] === 0) {
     117                // All tests passed.
     118                self._cache[cacheKey] = 0;
     119                callback(self._cache[cacheKey]);
     120                return;
     121            }
     122
     123            if (/^Exiting early/.test(layoutTestStep.results[1][0])) {
     124                // Too many tests crashed or timed out. We can't know for sure how many failed.
     125                self._cache[cacheKey] = -1;
     126                callback(self._cache[cacheKey]);
     127                return;
     128            }
     129
     130            var failureCount = layoutTestStep.results[1].reduce(function(sum, outputLine) {
     131                var match = /^(\d+) test cases/.exec(outputLine);
     132                if (!match)
     133                    return sum;
     134                return sum + parseInt(match[1], 10);
     135            }, 0);
     136
     137            self._cache[cacheKey] = failureCount;
     138            callback(failureCount);
     139        });
     140    },
     141
    60142    /*
    61143     * Preiodically calls callback until all current failures have been explained. Callback is
     
    100182    },
    101183
     184    _getBuildJSON: function(buildNumber, callback) {
     185        var cacheKey = 'getBuildJSON_' + buildNumber;
     186        if (cacheKey in this._cache) {
     187            callback(this._cache[cacheKey]);
     188            return;
     189        }
     190
     191        var self = this;
     192        getResource(self.buildbot.baseURL + 'json/builders/' + self.name + '/builds/' + buildNumber, function(xhr) {
     193            var data = JSON.parse(xhr.responseText);
     194            self._cache[cacheKey] = data;
     195            callback(data);
     196        });
     197    },
     198
    102199    _getBuildNames: function(callback) {
    103200        var cacheKey = '_getBuildNames';
     
    134231        this._cache[cacheKey] = tests;
    135232
    136         var self = this;
    137         getResource(self.buildbot.baseURL + 'json/builders/' + self.name + '/builds/' + self.buildbot.parseBuildName(buildName).buildNumber, function(xhr) {
    138             var data = JSON.parse(xhr.responseText);
    139             var layoutTestStep = data.steps.findFirst(function(step) { return step.name === 'layout-test'; });
    140             if (!('isStarted' in layoutTestStep)) {
    141                 // run-webkit-tests never even ran.
     233        var buildNumber = this.buildbot.parseBuildName(buildName).buildNumber;
     234
     235        var self = this;
     236        self.getNumberOfFailingTests(buildNumber, function(failingTestCount) {
     237            if (failingTestCount < 0) {
     238                // The number of failing tests couldn't be determined.
    142239                errorCallback(tests);
    143240                return;
    144241            }
    145242
    146             if (!('results' in layoutTestStep) || layoutTestStep.results[0] === 0) {
     243            if (!failingTestCount) {
    147244                // All tests passed.
    148245                callback(tests);
    149                 return;
    150             }
    151 
    152             if (/^Exiting early/.test(layoutTestStep.results[1][0])) {
    153                 // Too many tests crashed or timed out. We can't use this test run.
    154                 errorCallback(tests);
    155246                return;
    156247            }
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js

    r86766 r87148  
    8181
    8282    _displayTesters: function() {
    83         this._buildbot.getTesterNames(function(names) {
    84             var list = document.createElement('ul');
    85             names.forEach(function(name) {
     83        var list = document.createElement('ul');
     84        var testersAndFailureCounts = [];
     85
     86        function updateList() {
     87            testersAndFailureCounts.sort(function(a, b) { return a.tester.name.localeCompare(b.tester.name) });
     88            while (list.firstChild)
     89                list.removeChild(list.firstChild);
     90            testersAndFailureCounts.forEach(function(testerAndFailureCount) {
     91                var tester = testerAndFailureCount.tester;
     92                var failureCount = testerAndFailureCount.failureCount;
     93
    8694                var link = document.createElement('a');
    87                 link.href = '#/' + name;
    88                 link.appendChild(document.createTextNode(name));
     95                link.href = '#/' + tester.name;
     96                link.appendChild(document.createTextNode(tester.name));
     97
    8998                var item = document.createElement('li');
    9099                item.appendChild(link);
     100                item.appendChild(document.createTextNode(' (' + failureCount + ' failing tests)'));
    91101                list.appendChild(item);
     102            });
     103        }
     104
     105        this._buildbot.getTesters(function(testers) {
     106            testers.forEach(function(tester) {
     107                tester.getMostRecentCompletedBuildNumber(function(buildNumber) {
     108                    if (buildNumber < 0)
     109                        return;
     110                    tester.getNumberOfFailingTests(buildNumber, function(failureCount) {
     111                        if (failureCount <= 0)
     112                            return;
     113                        testersAndFailureCounts.push({ tester: tester, failureCount: failureCount });
     114                        updateList();
     115                    });
     116                });
    92117            });
    93118
  • trunk/Tools/ChangeLog

    r87124 r87148  
     12011-05-24  Adam Roben  <aroben@apple.com>
     2
     3        Make TestFailures show how many tests are failing on each tester, and omit testers with no failures
     4
     5        Fixes <http://webkit.org/b/61063> <rdar://problem/9460533> TestFailures page shows testers
     6        that don't have any failing tests, which isn't useful
     7
     8        Reviewed by David Kilzer.
     9
     10        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Buildbot.js:
     11        (Buildbot.prototype.getTesters): Renamed from getTesterNames. Now returns Builder objects
     12        instead of name strings.
     13        (Buildbot.prototype._buildersForNames): Added. Helper function to convert an array of
     14        builder names into an array of builders.
     15
     16        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js:
     17        (Builder.prototype.getMostRecentCompletedBuildNumber): Added. Returns the build number of
     18        the most recently completed build, or -1 if there is no such build.
     19        (Builder.prototype.getNumberOfFailingTests): Added. Returns the number of tests that failed
     20        in the given build, or -1 if the number could not be determined. Some of this code came from
     21        _getFailingTests.
     22        (Builder.prototype._getBuildJSON): Added. Code came from _getFailingTests.
     23        (Builder.prototype._getFailingTests): Changed to use new _getBuildJSON and
     24        getNumberOfFailingTests functions.
     25
     26        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js:
     27        (ViewController.prototype._displayTesters): Get the current number of test failures for each
     28        tester and show it in the list. Omit testers that have no failures at all. We keep the
     29        testers and failure counts in an array and sort it before displaying the current data, as
     30        the order in which data will be fetched is unpredictable.
     31
    1322011-05-23  Tony Chang  <tony@chromium.org>
    233
Note: See TracChangeset for help on using the changeset viewer.