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

Changeset 246663 in webkit


Ignore:
Timestamp:
Jun 20, 2019, 4:53:22 PM (7 years ago)
Author:
Dewei Zhu
Message:

Fix a bug that 'test_metrics' and 'tests' tables are not joined correctly in CommitLogFetcher.fetch_latest_for_platform
https://bugs.webkit.org/show_bug.cgi?id=199062

Reviewed by Ryosuke Niwa.

'test_metrics' and 'tests' should be joined based on 'metric_test' and 'test_id'.

  • public/include/commit-log-fetcher.php: Fix the typo in the query.
  • server-tests/api-commits-tests.js: Added a unit test for this change.
Location:
trunk/Websites/perf.webkit.org
Files:
3 edited

Legend:

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

    r246581 r246663  
     12019-06-20  Dewei Zhu  <dewei_zhu@apple.com>
     2
     3        Fix a bug that 'test_metrics' and 'tests' tables are not joined correctly in CommitLogFetcher.fetch_latest_for_platform
     4        https://bugs.webkit.org/show_bug.cgi?id=199062
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        'test_metrics' and 'tests' should be joined based on 'metric_test' and 'test_id'.
     9
     10        * public/include/commit-log-fetcher.php: Fix the typo in the query.
     11        * server-tests/api-commits-tests.js: Added a unit test for this change.
     12
    1132019-06-17  Dewei Zhu  <dewei_zhu@apple.com>
    214
  • trunk/Websites/perf.webkit.org/public/include/commit-log-fetcher.php

    r246522 r246663  
    156156    {
    157157        $query_result = $this->db->query_and_fetch_all("SELECT commits.* FROM test_runs, builds, build_commits, commits
    158             WHERE run_build = build_id AND NOT EXISTS (SELECT * FROM build_requests WHERE request_build = build_id)
     158            WHERE run_build = build_id AND NOT EXISTS (SELECT * FROM build_requests WHERE request_build = build_id LIMIT 1)
    159159                AND run_config IN (SELECT config_id FROM test_configurations
    160160                    WHERE config_type = 'current' AND config_platform = $2 AND config_metric
    161                         IN (SELECT metric_id FROM test_metrics, tests WHERE metric_id = test_id and test_parent IS NULL))
     161                        IN (SELECT metric_id FROM test_metrics, tests WHERE metric_test = test_id and test_parent IS NULL))
    162162                AND run_build = build_id AND commit_build = build_id AND build_commit = commit_id AND commit_repository = $1
    163163            ORDER BY build_time DESC LIMIT 1;", array($repository_id, $platform_id));
  • trunk/Websites/perf.webkit.org/server-tests/api-commits-tests.js

    r246522 r246663  
    66const addSlaveForReport = require('./resources/common-operations.js').addSlaveForReport;
    77const prepareServerTest = require('./resources/common-operations.js').prepareServerTest;
     8const submitReport = require('./resources/common-operations.js').submitReport;
    89
    910describe("/api/commits/", function () {
     
    8081        time: '2017-01-20T03:56:20.045Z'
    8182    }
     83
     84    const report = [{
     85        "buildNumber": "124",
     86        "buildTime": "2015-10-27T15:34:51",
     87        "builderName": "someBuilder",
     88        "builderPassword": "somePassword",
     89        "platform": "some platform",
     90        "tests": {"Speedometer-2": {"metrics": {"Score": {"current": [[100]]}}}},
     91        "revisions": {
     92            "WebKit": {
     93                "timestamp": "2017-01-20T02:52:34.577Z",
     94                "revision": "210948"
     95            }
     96        }
     97    }];
    8298
    8399    function assertCommitIsSameAsOneSubmitted(commit, submitted)
     
    238254                assert.equal(result['commits'][0]['revision'], systemVersionCommits['commits'][0]['revision']);
    239255            });
     256        });
     257
     258        it("should always return a commit as long as there is an existing 'current' type test run for a given platform", async () => {
     259            const remote = TestServer.remoteAPI();
     260            const db = TestServer.database();
     261            await db.insert('tests', {name: 'A-Test'});
     262            await submitReport(report);
     263            await db.query(`DELETE FROM tests WHERE test_name = 'A-Test'`);
     264
     265            const platforms = await db.selectAll('platforms');
     266            assert.equal(platforms.length, 1);
     267
     268            const test_metrics = await db.selectAll('test_metrics');
     269            assert.equal(test_metrics.length, 1);
     270
     271            const tests = await db.selectAll('tests');
     272            assert.equal(tests.length, 1);
     273
     274            assert(test_metrics[0].id != tests[0].id);
     275
     276            const response = await remote.getJSON(`/api/commits/WebKit/latest?platform=${platforms[0].id}`);
     277            assert(response.commits.length);
    240278        });
    241279    });
Note: See TracChangeset for help on using the changeset viewer.