Revision information returned by querying measurement set api with analysis task...
authordewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2018 02:34:11 +0000 (02:34 +0000)
committerdewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2018 02:34:11 +0000 (02:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184902

Reviewed by Ryosuke Niwa

This is a bug fix for r230719 which does not cover the case while querying `measurement-set.php?analysisTask=$task_id`

* public/api/measurement-set.php: AnalysisResultsFetcher.fetch_commits results should contains commit order.
* server-tests/api-measurement-set-tests.js: Added unit test for this change.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230940 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/public/api/measurement-set.php
Websites/perf.webkit.org/server-tests/api-measurement-set-tests.js

index f3edcfb..b8bca06 100644 (file)
@@ -1,3 +1,15 @@
+2018-04-23  Dewei Zhu  <dewei_zhu@apple.com>
+
+        Revision information returned by querying measurement set api with analysis task id should contain commit order.
+        https://bugs.webkit.org/show_bug.cgi?id=184902
+
+        Reviewed by Ryosuke Niwa.
+
+        This is a bug fix for r230719 which does not cover the case while querying `measurement-set.php?analysisTask=$task_id`
+
+        * public/api/measurement-set.php: AnalysisResultsFetcher.fetch_commits results should contains commit order.
+        * server-tests/api-measurement-set-tests.js: Added unit test for this change.
+
 2018-04-19  Dewei Zhu  <dewei_zhu@apple.com>
 
         Add a bisect button to automatically schedule bisecting A/B tasks.
index 712aae7..579bb52 100644 (file)
@@ -262,14 +262,14 @@ class AnalysisResultsFetcher {
 
     function fetch_commits()
     {
-        $query = $this->db->query('SELECT commit_id, commit_build, commit_repository, commit_revision, commit_time
+        $query = $this->db->query('SELECT commit_id, commit_build, commit_repository, commit_revision, commit_order, commit_time
             FROM commits, build_commits, build_requests, analysis_test_groups
             WHERE commit_id = build_commit AND commit_build = request_build
                 AND request_group = testgroup_id AND testgroup_task = $1', array($this->task_id));
         while ($row = $this->db->fetch_next_row($query)) {
             $commit_time = Database::to_js_time($row['commit_time']);
             array_push(array_ensure_item_has_array($this->build_to_commits, $row['commit_build']),
-                array($row['commit_id'], $row['commit_repository'], $row['commit_revision'], $commit_time));
+                array($row['commit_id'], $row['commit_repository'], $row['commit_revision'], $row['commit_order'], $commit_time));
         }
     }
 
index 84713a8..e2aa2c4 100644 (file)
@@ -500,4 +500,49 @@ describe("/api/measurement-set", function () {
         });
     });
 
+    async function reportAfterAddingBuilderAndAggregatorsWithResponse(report)
+    {
+        await addBuilderForReport(report);
+        const db = TestServer.database();
+        await Promise.all([
+            db.insert('aggregators', {name: 'Arithmetic'}),
+            db.insert('aggregators', {name: 'Geometric'}),
+        ]);
+        return await TestServer.remoteAPI().postJSON('/api/report/', [report]);
+    }
+
+    const reportWithBuildRequest = {
+        "buildNumber": "123",
+        "buildTime": "2013-02-28T10:12:03.388304",
+        "builderName": "someBuilder",
+        "builderPassword": "somePassword",
+        "platform": "Mountain Lion",
+        "buildRequest": "700",
+        "tests": {
+            "test": {
+                "metrics": {"FrameRate": { "current": [[[0, 4], [100, 5], [205, 3]]] }}
+            },
+        },
+        "revisions": {
+            "macOS": {
+                "revision": "10.8.2 12C60"
+            },
+            "WebKit": {
+                "revision": "141977",
+                "timestamp": "2013-02-06T08:55:20.9Z"
+            }
+        }
+    };
+
+    it("should allow to report a build request", async () => {
+        await MockData.addMockData(TestServer.database());
+        let response = await reportAfterAddingBuilderAndAggregatorsWithResponse(reportWithBuildRequest);
+        assert.equal(response['status'], 'OK');
+        response = await TestServer.remoteAPI().getJSONWithStatus('/api/measurement-set/?analysisTask=500');
+        assert.equal(response['status'], 'OK');
+        assert.deepEqual(response['measurements'], [[1, 4, 3, 12, 50, [
+                ['1', '9', '10.8.2 12C60', null, 0], ['2', '11', '141977', null, 1360140920900]],
+            1, 1362046323388, '123', 1, 1, 'current']]);
+    });
+
 });