⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 240104 in webkit


Ignore:
Timestamp:
Jan 16, 2019, 9:56:18 PM (8 years ago)
Author:
Dewei Zhu
Message:

Add UI in analysis task page to show commit testability information.
https://bugs.webkit.org/show_bug.cgi?id=192972

Reviewed by Ryosuke Niwa.

Add UI in custom analysis task configuration and customizable test group form to show testability information.
Fix a bug in 'CustomAnalysisTaskConfigurator._updateCommitSetMap' that 'currentComparison' is incorrectly set.
SQL to update existing database:

ALTER TABLE commits ADD COLUMN IF NOT EXISTS commit_testability varchar(128) DEFAULT NULL;

  • browser-tests/custom-analysis-task-configurator-tests.js: Added a unit test for the bug in

'CustomAnalysisTaskConfigurator._updateCommitSetMap'.
Added a unit test to make sure 'CustomAnalysisTaskConfigurator' still works when commit fetching never returns.

  • browser-tests/index.html: Imported custom-analysis-task-configurator-tests.js'.
  • init-database.sql: Increase 'commit_testability' field length from 64 characters to 128.
  • public/v3/components/custom-analysis-task-configurator.js: Added UI to show testability information.

(CustomAnalysisTaskConfigurator):
(CustomAnalysisTaskConfigurator.prototype._didUpdateSelectedPlatforms): Should reset related field for corresponding
repositories that user does not specify revision.
(CustomAnalysisTaskConfigurator.prototype._updateMapFromSpecifiedRevisionsForConfiguration): A helper function
to update '_specifiedCommits' and '_invalidRevisionsByConfiguration' per '_specifiedRevisions'.
(CustomAnalysisTaskConfigurator.prototype.render):
(CustomAnalysisTaskConfigurator.prototype._updateCommitSetMap): Fixed a bug that 'currentComparison' is incorrectly set.
(CustomAnalysisTaskConfigurator.prototype._computeCommitSet):
(CustomAnalysisTaskConfigurator.prototype.async._fetchCommitsForConfiguration):
(CustomAnalysisTaskConfigurator.prototype.async._resolveRevision):
(CustomAnalysisTaskConfigurator.prototype._buildRevisionTable):
(CustomAnalysisTaskConfigurator.prototype._buildTestabilityList):
(CustomAnalysisTaskConfigurator.prototype._selectRepositoryGroup):
(CustomAnalysisTaskConfigurator.prototype._buildRevisionInput):
(CustomAnalysisTaskConfigurator.cssTemplate):

  • public/v3/components/customizable-test-group-form.js: Added UI to show testability information.

(CustomizableTestGroupForm.prototype._renderCustomRevisionTable):
(CustomizableTestGroupForm.prototype._constructTestabilityRows.):
(CustomizableTestGroupForm.prototype._constructTestabilityRows):
(CustomizableTestGroupForm.prototype._constructRevisionRadioButtons):
Changing either revision editor or radio button should trigger a re-render as testability
information for updated revision may change.
(CustomizableTestGroupForm.cssTemplate):

  • public/v3/models/commit-set.js:

(IntermediateCommitSet.prototype.commitsWithTestability): Renamed from 'commitsWithTestabilityWarnings'.
(IntermediateCommitSet.prototype.commitsWithTestabilityWarnings): Deleted.

Location:
trunk/Websites/perf.webkit.org
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Websites/perf.webkit.org/ChangeLog

    r239485 r240104  
     12018-12-21  Dewei Zhu  <dewei_zhu@apple.com>
     2
     3        Add UI in analysis task page to show commit testability information.
     4        https://bugs.webkit.org/show_bug.cgi?id=192972
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Add UI in custom analysis task configuration and customizable test group form to show testability information.
     9        Fix a bug in 'CustomAnalysisTaskConfigurator._updateCommitSetMap' that 'currentComparison' is incorrectly set.
     10        SQL to update existing database:
     11            ALTER TABLE commits ADD COLUMN IF NOT EXISTS commit_testability varchar(128) DEFAULT NULL;
     12
     13        * browser-tests/custom-analysis-task-configurator-tests.js: Added a unit test for the bug in
     14        'CustomAnalysisTaskConfigurator._updateCommitSetMap'.
     15        Added a unit test to make sure 'CustomAnalysisTaskConfigurator' still works when commit fetching never returns.
     16        * browser-tests/index.html: Imported ''custom-analysis-task-configurator-tests.js'.
     17        * init-database.sql: Increase 'commit_testability' field length from 64 characters to 128.
     18        * public/v3/components/custom-analysis-task-configurator.js: Added UI to show testability information.
     19        (CustomAnalysisTaskConfigurator):
     20        (CustomAnalysisTaskConfigurator.prototype._didUpdateSelectedPlatforms): Should reset related field for corresponding
     21        repositories that user does not specify revision.
     22        (CustomAnalysisTaskConfigurator.prototype._updateMapFromSpecifiedRevisionsForConfiguration): A helper function
     23        to update '_specifiedCommits' and '_invalidRevisionsByConfiguration' per '_specifiedRevisions'.
     24        (CustomAnalysisTaskConfigurator.prototype.render):
     25        (CustomAnalysisTaskConfigurator.prototype._updateCommitSetMap): Fixed a bug that 'currentComparison' is incorrectly set.
     26        (CustomAnalysisTaskConfigurator.prototype._computeCommitSet):
     27        (CustomAnalysisTaskConfigurator.prototype.async._fetchCommitsForConfiguration):
     28        (CustomAnalysisTaskConfigurator.prototype.async._resolveRevision):
     29        (CustomAnalysisTaskConfigurator.prototype._buildRevisionTable):
     30        (CustomAnalysisTaskConfigurator.prototype._buildTestabilityList):
     31        (CustomAnalysisTaskConfigurator.prototype._selectRepositoryGroup):
     32        (CustomAnalysisTaskConfigurator.prototype._buildRevisionInput):
     33        (CustomAnalysisTaskConfigurator.cssTemplate):
     34        * public/v3/components/customizable-test-group-form.js: Added UI to show testability information.
     35        (CustomizableTestGroupForm.prototype._renderCustomRevisionTable):
     36        (CustomizableTestGroupForm.prototype._constructTestabilityRows.):
     37        (CustomizableTestGroupForm.prototype._constructTestabilityRows):
     38        (CustomizableTestGroupForm.prototype._constructRevisionRadioButtons):
     39        Changing either revision editor or radio button should trigger a re-render as testability
     40        information for updated revision may change.
     41        (CustomizableTestGroupForm.cssTemplate):
     42        * public/v3/models/commit-set.js:
     43        (IntermediateCommitSet.prototype.commitsWithTestability): Renamed from 'commitsWithTestabilityWarnings'.
     44        (IntermediateCommitSet.prototype.commitsWithTestabilityWarnings): Deleted.
     45
    1462018-12-14  Dewei Zhu  <dewei_zhu@apple.com>
    247
  • trunk/Websites/perf.webkit.org/browser-tests/index.html

    r237915 r240104  
    2828<script src="commit-log-viewer-tests.js"></script>
    2929<script src="test-group-form-tests.js"></script>
     30<script src="custom-analysis-task-configurator-tests.js"></script>
    3031<script src="customizable-test-group-form-tests.js"></script>
    3132<script src="markup-page-tests.js"></script>
  • trunk/Websites/perf.webkit.org/init-database.sql

    r239485 r240104  
    102102    commit_message text,
    103103    commit_reported boolean NOT NULL DEFAULT FALSE,
    104     commit_testability varchar(64) DEFAULT NULL,
     104    commit_testability varchar(128) DEFAULT NULL,
    105105    CONSTRAINT commit_in_repository_must_be_unique UNIQUE(commit_repository, commit_revision));
    106106CREATE INDEX commit_time_index ON commits(commit_time);
  • trunk/Websites/perf.webkit.org/public/v3/components/custom-analysis-task-configurator.js

    r230666 r240104  
    88        this._triggerablePlatforms = [];
    99        this._selectedPlatform = null;
    10         this._configurationNames = ['Baseline', 'Comparison'];
    1110        this._showComparison = false;
    1211        this._commitSetMap = {};
     
    1413        this._patchUploaders = {'Baseline': new Map, 'Comparison': new Map};
    1514        this._customRootUploaders = {'Baseline': null, 'Comparison': null};
    16         this._fetchedRevisions = {'Baseline': new Map, 'Comparison': new Map};
     15        this._fetchedCommits = {'Baseline': new Map, 'Comparison': new Map};
    1716        this._repositoryGroupByConfiguration = {'Baseline': null, 'Comparison': null};
     17        this._invalidRevisionsByConfiguration = {'Baseline': new Map, 'Comparison': new Map};
     18
    1819        this._updateTriggerableLazily = new LazilyEvaluatedFunction(this._updateTriggerable.bind(this));
    19 
    2020        this._renderTriggerableTestsLazily = new LazilyEvaluatedFunction(this._renderTriggerableTests.bind(this));
    2121        this._renderTriggerablePlatformsLazily = new LazilyEvaluatedFunction(this._renderTriggerablePlatforms.bind(this));
     
    5656    _didUpdateSelectedPlatforms()
    5757    {
     58        for (const configuration of ['Baseline', 'Comparison']) {
     59            this._updateMapFromSpecifiedRevisionsForConfiguration(this._fetchedCommits, configuration);
     60            this._updateMapFromSpecifiedRevisionsForConfiguration(this._invalidRevisionsByConfiguration, configuration);
     61        }
    5862        this._updateCommitSetMap();
    59 
    6063        this.enqueueToRender();
     64    }
     65
     66    _updateMapFromSpecifiedRevisionsForConfiguration(map, configuration)
     67    {
     68        const referenceMap = this._specifiedRevisions[configuration];
     69        const newValue = new Map;
     70        for (const [key, value] of map[configuration].entries()) {
     71            if (!referenceMap.has(key))
     72                continue;
     73            newValue.set(key, value);
     74        }
     75        if (newValue.size !== map[configuration].size)
     76            map[configuration] = newValue;
    6177    }
    6278
     
    191207
    192208        this._renderRepositoryPanesLazily.evaluate(triggerable, error, this._selectedPlatform, this._repositoryGroupByConfiguration, this._showComparison);
     209
     210        this.renderReplace(this.content('baseline-testability'), this._buildTestabilityList(this._commitSetMap['Baseline'],
     211            'Baseline', this._invalidRevisionsByConfiguration['Baseline']));
     212
     213        this.renderReplace(this.content('comparison-testability'), !this._showComparison ? null :
     214            this._buildTestabilityList(this._commitSetMap['Comparison'], 'Comparison', this._invalidRevisionsByConfiguration['Comparison']));
    193215    }
    194216
     
    305327
    306328        const currentBaseline = this._commitSetMap['Baseline'];
    307         const currentComparison = this._commitSetMap['Baseline'];
    308         if (newBaseline == currentBaseline && newComparison == currentComparison)
    309             return; // Both of them are null.
    310 
    311         if (newBaseline && currentBaseline && newBaseline.equals(currentBaseline)
    312             && newComparison && currentComparison && newComparison.equals(currentComparison))
     329        const currentComparison = this._commitSetMap['Comparison'];
     330        const areCommitSetsEqual = (commitSetA, commitSetB) => commitSetA == commitSetB || (commitSetA && commitSetB && commitSetA.equals(commitSetB));
     331        const sameBaselineConfig = areCommitSetsEqual(currentBaseline, newBaseline);
     332        const sameComparisionConfig = areCommitSetsEqual(currentComparison, newComparison);
     333
     334        if (sameBaselineConfig && sameComparisionConfig)
    313335            return;
    314336
     
    332354        for (let repository of repositoryGroup.repositories()) {
    333355            let revision = this._specifiedRevisions[configurationName].get(repository);
    334             if (!revision)
    335                 revision = this._fetchedRevisions[configurationName].get(repository);
     356            if (!revision) {
     357                const commit = this._fetchedCommits[configurationName].get(repository);
     358                if (commit)
     359                    revision = commit.revision();
     360            }
    336361            if (!revision)
    337362                return null;
     
    356381    }
    357382
     383    async _fetchCommitsForConfiguration(configurationName)
     384    {
     385        const commitSet = this._commitSetMap[configurationName];
     386        if (!commitSet)
     387            return;
     388
     389        const specifiedRevisions = this._specifiedRevisions[configurationName];
     390        const fetchedCommits = this._fetchedCommits[configurationName];
     391        const invalidRevisionForRepository = this._invalidRevisionsByConfiguration[configurationName];
     392
     393        await Promise.all(Array.from(commitSet.repositories()).map((repository) => {
     394            const revision = commitSet.revisionForRepository(repository);
     395            return this._resolveRevision(repository, revision, specifiedRevisions, invalidRevisionForRepository, fetchedCommits);
     396        }));
     397
     398        const latestCommitSet = this._commitSetMap[configurationName];
     399        if (commitSet != latestCommitSet)
     400            return;
     401        this.enqueueToRender();
     402    }
     403
     404    async _resolveRevision(repository, revision, specifiedRevisions, invalidRevisionForRepository, fetchedCommits)
     405    {
     406        const fetchedCommit = fetchedCommits.get(repository);
     407        if (fetchedCommit && fetchedCommit.revision() == revision)
     408            return;
     409
     410        fetchedCommits.delete(repository);
     411        let commits = [];
     412        try {
     413            commits = await CommitLog.fetchForSingleRevision(repository, revision);
     414        } catch (error) {
     415            console.assert(error == 'UnknownCommit');
     416            if (revision != specifiedRevisions.get(repository))
     417                return;
     418            invalidRevisionForRepository.set(repository, revision);
     419            return;
     420        }
     421        console.assert(commits.length, 1);
     422        if (revision != specifiedRevisions.get(repository))
     423            return;
     424        invalidRevisionForRepository.delete(repository);
     425        fetchedCommits.set(repository, commits[0]);
     426    }
     427
    358428    _renderRepositoryPanes(triggerable, error, platform, repositoryGroupByConfiguration, showComparison)
    359429    {
     
    415485    {
    416486        const element = ComponentBase.createElement;
    417         const link = ComponentBase.createLink;
    418487
    419488        const customRootsTBody = element('tbody', [
     
    454523    }
    455524
     525    _buildTestabilityList(commitSet, configurationName, invalidRevisionForRepository)
     526    {
     527        const element = ComponentBase.createElement;
     528        const entries = [];
     529
     530        if (!commitSet || !commitSet.repositories().length)
     531            return [];
     532
     533        for (const repository of commitSet.repositories()) {
     534            const commit = this._fetchedCommits[configurationName].get(repository);
     535            if (commit && commit.testability() && !invalidRevisionForRepository.has(repository))
     536                entries.push(element('li', `${commit.repository().name()} - "${commit.label()}": ${commit.testability()}`));
     537            if (invalidRevisionForRepository.has(repository))
     538                entries.push(element('li', `${repository.name()} - "${invalidRevisionForRepository.get(repository)}": Invalid revision`));
     539        }
     540
     541        return entries;
     542    }
     543
    456544    _buildRepositoryGroupList(repositoryGroups, currentGroup, configurationName)
    457545    {
     
    477565        this._repositoryGroupByConfiguration = clone;
    478566        this._updateCommitSetMap();
     567        this._fetchCommitsForConfiguration(configurationName);
    479568        this.enqueueToRender();
    480569    }
     
    484573        const revision = this._specifiedRevisions[configurationName].get(repository) || '';
    485574        const element = ComponentBase.createElement;
     575        let scheduledUpdate = null;
    486576        const input = element('input', {value: revision, oninput: () => {
    487577            unmodifiedInput = null;
    488             this._specifiedRevisions[configurationName].set(repository, input.value);
     578            const revisionToFetch = input.value;
     579            this._specifiedRevisions[configurationName].set(repository, revisionToFetch);
    489580            this._updateCommitSetMap();
     581            if (scheduledUpdate)
     582                clearTimeout(scheduledUpdate);
     583            scheduledUpdate = setTimeout(() => {
     584                if (revisionToFetch == input.value)
     585                    this._fetchCommitsForConfiguration(configurationName);
     586                scheduledUpdate = null;
     587            }, CustomAnalysisTaskConfigurator.commitFetchInterval);
    490588        }});
    491589        let unmodifiedInput = input;
     
    495593                if (commit && unmodifiedInput) {
    496594                    unmodifiedInput.value = commit.revision();
    497                     this._fetchedRevisions[configurationName].set(repository, commit.revision());
     595                    this._fetchedCommits[configurationName].set(repository, commit);
    498596                    this._updateCommitSetMap();
    499597                }
     
    522620                <h2>3. Configure Baseline</h2>
    523621                <table id="baseline-revision-table" class="revision-table"></table>
     622                <ul id="baseline-testability"></ul>
    524623            </section>
    525624            <section id="specify-comparison-pane" class="pane">
     
    529628                <h2>4. Configure Comparison</h2>
    530629                <table id="comparison-revision-table" class="revision-table"></table>
     630                <ul id="comparison-testability"></ul>
    531631            </section>`;
    532632    }
     
    675775                font-weight: inherit;
    676776            }
     777
     778            #baseline-testability li,
     779            #comparison-testability li {
     780                color: #c33;
     781                width: 20rem;
     782            }
    677783`;
    678784    }
    679785}
    680786
     787CustomAnalysisTaskConfigurator.commitFetchInterval = 100;
     788
    681789ComponentBase.defineElement('custom-analysis-task-configurator', CustomAnalysisTaskConfigurator);
  • trunk/Websites/perf.webkit.org/public/v3/components/customizable-test-group-form.js

    r237950 r240104  
    136136                element('tr',
    137137                    [element('td', {colspan: 2}, 'Repository'), commitSetLabels.map((label) => element('td', {colspan: commitSetLabels.length + 1}, label)), element('td')])),
    138             this._constructTableBodyList(repositoryList, commitSetMap, ownedRepositoriesByRepository, this._hasIncompleteOwnedRepository, uncustomizedCommitSetMap)]);
     138            this._constructTableBodyList(repositoryList, commitSetMap, ownedRepositoriesByRepository, this._hasIncompleteOwnedRepository, uncustomizedCommitSetMap),
     139            this._constructTestabilityRows(commitSetMap)]);
     140    }
     141
     142    _constructTestabilityRows(commitSetMap)
     143    {
     144        const element = ComponentBase.createElement;
     145
     146        const commitSets = Array.from(commitSetMap.values());
     147        const hasCommitWithTestability = commitSets.some((commitSet) =>  !!commitSet.commitsWithTestability().length);
     148        for (const c of commitSets) {
     149            if (c.commitsWithTestability().length)
     150                console.log(c);
     151        }
     152        console.log({hasCommitWithTestability});
     153        console.log('aaaa');
     154        if (!hasCommitWithTestability)
     155            return [];
     156
     157        const testabilityCells = [];
     158        for (const commitSet of commitSetMap.values()) {
     159            const entries = commitSet.commitsWithTestability().map((commit) =>
     160                element('li', `${commit.title()}: ${commit.testability()}`));
     161            testabilityCells.push(element('td', {colspan: commitSetMap.size + 1, class: 'testability'}, element('ul', entries)));
     162        }
     163
     164        return element('tbody', element('tr', [element('td', {colspan: 2}), testabilityCells, element('td')]));
    139165    }
    140166
     
    256282                if (ownerRepository)
    257283                    return;
    258 
    259                 commitSetMap.get(columnLabel).updateRevisionForOwnerRepository(repository, revisionEditor.value).catch(
     284                commitSetMap.get(columnLabel).updateRevisionForOwnerRepository(repository, revisionEditor.value).then(
     285                    () => this.enqueueToRender(),
    260286                    () => {
    261287                        alert(`"${revisionEditor.value}" does not exist in "${repository.name()}".`);
     
    279305                    if (uncustomizedCommit && uncustomizedCommit.ownerCommit())
    280306                        this._ownerRevisionMap.get(columnLabel).set(repository, uncustomizedCommit.ownerCommit().revision());
     307                    this.enqueueToRender();
    281308                }});
    282309            nodes.push(element('td', element('label', [radioButton, labelToChoose])));
     
    337364                margin-left: 0.4rem;
    338365            }
     366
     367            #custom-table td.testability {
     368                vertical-align: top;
     369            }
     370
     371            #custom-table td.testability ul {
     372                text-align: left;
     373                color: #c33;
     374                max-width: 13rem;
     375                margin: 0 0 0 1rem;
     376                padding: 0;
     377            }
    339378            `;
    340379    }
  • trunk/Websites/perf.webkit.org/public/v3/models/commit-set.js

    r239485 r240104  
    390390    }
    391391
    392     commitsWithTestabilityWarnings() { return this.commits().filter((commit) => !!commit.testabilityWarning()); }
     392    commitsWithTestability() { return this.commits().filter((commit) => !!commit.testability()); }
    393393    commits() { return  Array.from(this._commitByRepository.values()); }
    394394
Note: See TracChangeset for help on using the changeset viewer.