Skip to content

Commit

Permalink
Create analysis task should use build time as fallback when commit ti…
Browse files Browse the repository at this point in the history
…me is not available.

https://bugs.webkit.org/show_bug.cgi?id=183309

Reviewed by Ryosuke Niwa.

Added the ability to schedule analysis task for the range without commit time.

* public/privileged-api/create-analysis-task.php: Use build time as fallback.
* server-tests/privileged-api-create-analysis-task-tests.js: Added a unit test for this change.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@229501 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
[email protected] committed Mar 10, 2018
1 parent eacb275 commit 5299c2e
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 2 deletions.
12 changes: 12 additions & 0 deletions Websites/perf.webkit.org/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
2018-03-04 Dewei Zhu <[email protected]>

Create analysis task should use build time as fallback when commit time is not available.
https://bugs.webkit.org/show_bug.cgi?id=183309

Reviewed by Ryosuke Niwa.

Added the ability to schedule analysis task for the range without commit time.

* public/privileged-api/create-analysis-task.php: Use build time as fallback.
* server-tests/privileged-api-create-analysis-task-tests.js: Added a unit test for this change.

2018-03-04 Aakash Jain <[email protected]>

BuildbotBuildEntry for buildbot 0.9 uses incorrect buildrequestid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ function ensure_config_from_runs($db, $start_run, $end_run) {
}

function time_for_run($db, $run_id) {
$result = $db->query_and_fetch_all('SELECT max(commit_time) as time
$result = $db->query_and_fetch_all('SELECT max(commit_time) as time, max(build_time) as build_time
FROM test_runs JOIN builds ON run_build = build_id
JOIN build_commits ON commit_build = build_id
JOIN commits ON build_commit = commit_id
WHERE run_id = $1', array($run_id));
return $result ? $result[0]['time'] : null;

$first_result = array_get($result, 0, array());
return $first_result['time'] ? $first_result['time'] : $first_result['build_time'];
}

main();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,30 @@ const reportWithRevision = [{
},
}}];

const reportWithRevisionNoTimestamp = [{
"buildNumber": "124",
"buildTime": "2015-10-27T15:34:51",
"revisions": {
"WebKit": {
"revision": "191622",
},
},
"builderName": "someBuilder",
"builderPassword": "somePassword",
"platform": "some platform",
"tests": {
"Suite": {
"metrics": {
"Time": ["Arithmetic"],
},
"tests": {
"test1": {
"metrics": {"Time": { "current": [11] }},
}
}
},
}}];

const anotherReportWithRevision = [{
"buildNumber": "125",
"buildTime": "2015-10-27T17:27:41",
Expand All @@ -57,6 +81,30 @@ const anotherReportWithRevision = [{
},
}}];

const anotherReportWithRevisionNoTimestamp = [{
"buildNumber": "125",
"buildTime": "2015-10-27T17:27:41",
"revisions": {
"WebKit": {
"revision": "191623",
},
},
"builderName": "someBuilder",
"builderPassword": "somePassword",
"platform": "some platform",
"tests": {
"Suite": {
"metrics": {
"Time": ["Arithmetic"],
},
"tests": {
"test1": {
"metrics": {"Time": { "current": [12] }},
}
}
},
}}];

describe('/privileged-api/create-analysis-task', function () {
prepareServerTest(this);

Expand Down Expand Up @@ -180,6 +228,40 @@ describe('/privileged-api/create-analysis-task', function () {
});
});

it('should create an analysis task and use build time as fallback when commit time is not available', () => {
const db = TestServer.database();
return addBuilderForReport(reportWithRevisionNoTimestamp[0]).then(() => {
return TestServer.remoteAPI().postJSON('/api/report/', reportWithRevisionNoTimestamp);
}).then(() => {
return TestServer.remoteAPI().postJSON('/api/report/', anotherReportWithRevisionNoTimestamp);
}).then(() => {
return Manifest.fetch();
}).then(() => {
const test1 = Test.findByPath(['Suite', 'test1']);
const platform = Platform.findByName('some platform');
return db.selectFirstRow('test_configurations', {metric: test1.metrics()[0].id(), platform: platform.id()});
}).then((configRow) => {
return db.selectRows('test_runs', {config: configRow['id']});
}).then((testRuns) => {
assert.equal(testRuns.length, 2);
return PrivilegedAPI.sendRequest('create-analysis-task', {name: 'hi', startRun: testRuns[0]['id'], endRun: testRuns[1]['id']});
}).then((content) => {
return AnalysisTask.fetchById(content['taskId']);
}).then((task) => {
assert.equal(task.name(), 'hi');
assert(!task.hasResults());
assert(!task.hasPendingRequests());
assert.deepEqual(task.bugs(), []);
assert.deepEqual(task.causes(), []);
assert.deepEqual(task.fixes(), []);
assert.equal(task.changeType(), null);
assert.equal(task.platform().label(), 'some platform');
assert.equal(task.metric().test().label(), 'test1');
assert.equal(task.startTime(), 1445960091000);
assert.equal(task.endTime(), 1445966861000);
});
});

it('should return "DuplicateAnalysisTask" when there is already an analysis task for the specified range', () => {
const db = TestServer.database();
let startId;
Expand Down

0 comments on commit 5299c2e

Please sign in to comment.