+2017-01-18 Dewei Zhu <dewei_zhu@apple.com>
+
+ 'buildbot-syncer.js' should be able to determine force build argument from a list of possible repositories.
+ https://bugs.webkit.org/show_bug.cgi?id=167152
+
+ Reviewed by Ryosuke Niwa.
+
+ Add 'rootOptions' key which maps to a list of possible repositories.
+ For a build request, only one of the repositories in the list is valid.
+
+ * tools/js/buildbot-syncer.js:
+ (BuildbotSyncer.prototype._propertiesForBuildRequest):
+ (BuildbotSyncer._validateAndMergeProperties):
+ (BuildbotSyncer):
+ * unit-tests/buildbot-syncer-tests.js:
+ (sampleiOSConfig):
+ (sampleiOSConfigWithExpansions):
+ (createSampleBuildRequest):
+ (Promise.resolve.then):
+ * unit-tests/resources/mock-v3-models.js:
+ (MockModels.inject):
+
2017-01-17 Ryosuke Niwa <rniwa@webkit.org>
Make calls to render() functions async
else if ('root' in value) {
let repositoryName = value['root'];
let repository = repositoryByName[repositoryName];
- assert(repository, '"${repositoryName}" must be specified');
+ assert(repository, `"${repositoryName}" must be specified`);
properties[key] = rootSet.revisionForRepository(repository);
- } else if ('rootsExcluding' in value) {
+ } else if ('rootOptions' in value) {
+ const filteredOptions = value['rootOptions'].filter((option) => option in repositoryByName);
+ assert.equal(filteredOptions.length, 1, `There should be exactly one valid root among "${value['rootOptions']}".`);
+ properties[key] = rootSet.revisionForRepository(repositoryByName[filteredOptions[0]]);
+ }
+ else if ('rootsExcluding' in value) {
let revisionSet = this._revisionSetFromRootSetWithExclusionList(rootSet, value['rootsExcluding']);
properties[key] = JSON.stringify(revisionSet);
}
continue;
switch (name) {
- case 'properties': // fallthrough
+ case 'properties': // Fallthrough
case 'arguments':
assert.equal(typeof(value), 'object', 'arguments should be a dictionary');
if (!config['properties'])
config['properties'] = {};
this._validateAndMergeProperties(config['properties'], value);
break;
- case 'test': // fallthrough
- case 'slaveList': // fallthrough
+ case 'test': // Fallthrough
+ case 'slaveList': // Fallthrough
case 'platforms':
case 'types':
assert(value instanceof Array, `${name} should be an array`);
assert(value.every(function (part) { return typeof part == 'string'; }), `${name} should be an array of strings`);
config[name] = value.slice();
break;
- case 'type': // fallthrough
- case 'builder': // fallthrough
- case 'platform': // fallthrough
- case 'slaveArgument': // fallthrough
+ case 'type': // Fallthrough
+ case 'builder': // Fallthrough
+ case 'platform': // Fallthrough
+ case 'slaveArgument': // Fallthrough
case 'buildRequestArgument':
assert.equal(typeof(value), 'string', `${name} should be of string type`);
config[name] = value;
continue;
}
assert.equal(typeof(value), 'object', 'A argument value must be either a string or a dictionary');
-
+
let keys = Object.keys(value);
assert.equal(keys.length, 1, 'arguments value cannot contain more than one key');
let namedValue = value[keys[0]];
case 'root':
assert.equal(typeof(namedValue), 'string', 'root name must be a string');
break;
+ case 'rootOptions': // Fallthrough
case 'rootsExcluding':
- assert(namedValue instanceof Array, 'rootsExcluding must specify an array');
+ assert(namedValue instanceof Array, `${keys[0]} must specify an array`);
for (let excludedRootName of namedValue)
- assert.equal(typeof(excludedRootName), 'string', 'rootsExcluding must specify an array of strings');
+ assert.equal(typeof(excludedRootName), 'string', `${keys[0]} must specify an array of strings`);
namedValue = namedValue.slice();
break;
default:
{
'arguments': {
'desired_image': {'root': 'iOS'},
+ 'opensource': {'rootOptions': ['WebKit-SVN', 'WebKit-Git']},
'roots_dict': {'rootsExcluding': ['iOS']}
},
'slaveArgument': 'slavename',
},
]
}
-
}
let sampleRootSetData = {
'time': 1456931874000,
'repository': 'Shared',
'revision': '80229',
- }
+ },
+ 'WebKit-Git': {
+ "id":"111239",
+ "time":1456931874000,
+ "repository":"WebKit-Git",
+ "revision":"9abcdef",
+ },
};
function smallConfiguration()
let rootSet = RootSet.ensureSingleton('4197', {roots: [
{'id': '111127', 'time': 1456955807334, 'repository': MockModels.webkit, 'revision': '197463'},
{'id': '111237', 'time': 1456931874000, 'repository': MockModels.sharedRepository, 'revision': '80229'},
+ {'id': '111239', 'time': 1456931874000, 'repository': MockModels.webkitGit, 'revision': '9abcdef'},
{'id': '88930', 'time': 0, 'repository': MockModels.ios, 'revision': '13A452'},
]});
it('should include all properties specified in a given configuration', function () {
let syncers = BuildbotSyncer._loadConfig(RemoteAPI, sampleiOSConfig());
let properties = syncers[0]._propertiesForBuildRequest(createSampleBuildRequest(MockModels.iphone, MockModels.speedometer));
- assert.deepEqual(Object.keys(properties), ['desired_image', 'roots_dict', 'test_name', 'forcescheduler', 'build_request_id']);
+ assert.deepEqual(Object.keys(properties), ['desired_image', 'opensource', 'roots_dict', 'test_name', 'forcescheduler', 'build_request_id']);
});
it('should preserve non-parametric property values', function () {
assert.equal(properties['desired_image'], '13A452');
});
+ it('should resolve "rootOptions"', function () {
+ let syncers = BuildbotSyncer._loadConfig(RemoteAPI, sampleiOSConfig());
+ let properties = syncers[0]._propertiesForBuildRequest(createSampleBuildRequest(MockModels.iphone, MockModels.speedometer));
+ assert.equal(properties['roots_dict'], JSON.stringify(sampleRootSetData));
+ });
+
it('should resolve "rootsExcluding"', function () {
let syncers = BuildbotSyncer._loadConfig(RemoteAPI, sampleiOSConfig());
let properties = syncers[0]._propertiesForBuildRequest(createSampleBuildRequest(MockModels.iphone, MockModels.speedometer));
assert.deepEqual(requests[0].data, {
'build_request_id': '16733-' + MockModels.iphone.id(),
'desired_image': '13A452',
+ "opensource": "9abcdef",
'forcescheduler': 'ABTest-iPhone-RunBenchmark-Tests-ForceScheduler',
'roots_dict': '{"WebKit":{"id":"111127","time":1456955807334,"repository":"WebKit","revision":"197463"},'
- + '"Shared":{"id":"111237","time":1456931874000,"repository":"Shared","revision":"80229"}}',
+ + '"Shared":{"id":"111237","time":1456931874000,"repository":"Shared","revision":"80229"},'
+ + '"WebKit-Git":{"id":"111239","time":1456931874000,"repository":"WebKit-Git","revision":"9abcdef"}}',
'slavename': 'some-slave',
'test_name': 'speedometer'
});
MockModels.ios = Repository.ensureSingleton(22, {name: 'iOS'});
MockModels.webkit = Repository.ensureSingleton(11, {name: 'WebKit', url: 'http://trac.webkit.org/changeset/$1'});
MockModels.sharedRepository = Repository.ensureSingleton(16, {name: 'Shared'});
+ MockModels.webkitGit = Repository.ensureSingleton(17, {name: 'WebKit-Git'});
MockModels.builder = new Builder(176, {name: 'WebKit Perf Builder', buildUrl: 'http://build.webkit.org/builders/$builderName/$buildNumber'});
MockModels.someTest = Test.ensureSingleton(1, {name: 'Some test'});