Modified: trunk/Websites/perf.webkit.org/tools/js/buildbot-syncer.js (210908 => 210909)
--- trunk/Websites/perf.webkit.org/tools/js/buildbot-syncer.js 2017-01-19 03:07:09 UTC (rev 210908)
+++ trunk/Websites/perf.webkit.org/tools/js/buildbot-syncer.js 2017-01-19 03:19:37 UTC (rev 210909)
@@ -222,9 +222,14 @@
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);
}
@@ -334,7 +339,7 @@
continue;
switch (name) {
- case 'properties': // fallthrough
+ case 'properties': // Fallthrough
case 'arguments':
assert.equal(typeof(value), 'object', 'arguments should be a dictionary');
if (!config['properties'])
@@ -341,8 +346,8 @@
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`);
@@ -349,10 +354,10 @@
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;
@@ -373,7 +378,7 @@
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]];
@@ -381,10 +386,11 @@
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:
Modified: trunk/Websites/perf.webkit.org/unit-tests/buildbot-syncer-tests.js (210908 => 210909)
--- trunk/Websites/perf.webkit.org/unit-tests/buildbot-syncer-tests.js 2017-01-19 03:07:09 UTC (rev 210908)
+++ trunk/Websites/perf.webkit.org/unit-tests/buildbot-syncer-tests.js 2017-01-19 03:19:37 UTC (rev 210909)
@@ -16,6 +16,7 @@
{
'arguments': {
'desired_image': {'root': 'iOS'},
+ 'opensource': {'rootOptions': ['WebKit-SVN', 'WebKit-Git']},
'roots_dict': {'rootsExcluding': ['iOS']}
},
'slaveArgument': 'slavename',
@@ -107,7 +108,6 @@
},
]
}
-
}
let sampleRootSetData = {
@@ -122,7 +122,13 @@
'time': 1456931874000,
'repository': 'Shared',
'revision': '80229',
- }
+ },
+ 'WebKit-Git': {
+ "id":"111239",
+ "time":1456931874000,
+ "repository":"WebKit-Git",
+ "revision":"9abcdef",
+ },
};
function smallConfiguration()
@@ -204,6 +210,7 @@
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'},
]});
@@ -564,7 +571,7 @@
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 () {
@@ -584,6 +591,12 @@
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));
@@ -892,9 +905,11 @@
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'
});