Changeset 204151 in webkit
- Timestamp:
- Aug 4, 2016, 4:24:14 PM (9 years ago)
- Location:
- trunk/Websites/perf.webkit.org
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Websites/perf.webkit.org/ChangeLog
r203748 r204151 1 2016-08-04 Ryosuke Niwa <rniwa@webkit.org> 2 3 Syncing script's configuration duplicates a lot of boilerplate 4 https://bugs.webkit.org/show_bug.cgi?id=160574 5 6 Rubber-stamped by Chris Dumez. 7 8 This patch makes each configuration accept an array of platforms and types so that we can write: 9 10 {"type": "speedometer", "builder": "mba", "platform": "Trunk El Capitan MacBookAir"}, 11 {"type": "speedometer", "builder": "mbp", "platform": "Trunk El Capitan MacBookPro"}, 12 {"type": "speedometer", "builder": "mba", "platform": "Trunk Sierra MacBookAir"}, 13 {"type": "speedometer", "builder": "mbp", "platform": "Trunk Sierra MacBookPro"}, 14 {"type": "jetstream", "builder": "mba", "platform": "Trunk El Capitan MacBookAir"}, 15 {"type": "jetstream", "builder": "mbp", "platform": "Trunk El Capitan MacBookPro"}, 16 {"type": "jetstream", "builder": "mba", "platform": "Trunk Sierra MacBookAir"}, 17 {"type": "jetstream", "builder": "mbp", "platform": "Trunk Sierra MacBookPro"}, 18 19 more concisely as: 20 21 {"builder": "mba", "types": ["speedometer", "jetstream"], 22 "platforms": ["Trunk El Capitan MacBookAir", "Trunk Sierra MacBookAir"]}, 23 {"builder": "mbp", "types": ["speedometer", "jetstream"], 24 "platforms": ["Trunk El Capitan MacBookPro", "Trunk Sierra MacBookPro"]}, 25 26 * tools/js/buildbot-syncer.js: 27 (BuildbotSyncer._loadConfig): 28 (BuildbotSyncer._expandTypesAndPlatforms): Added. Clones a new configuration entry for each type 29 and platform. 30 (BuildbotSyncer._createTestConfiguration): Extracted from _loadConfig. 31 (BuildbotSyncer._validateAndMergeConfig): Added a new argument that specifies a property that 32 shouldn't be merged into the configuration. Also added the support for 'types' and 'platforms', 33 and merged the code for verify an array of strings. Finally, allow the appearance of 'properties' 34 since this function can now be called on a cloned configuration in which 'arguments' had already 35 been renamed to 'properties'. 36 37 * unit-tests/buildbot-syncer-tests.js: Added a test case to parse a consolidated configuration. 38 (sampleiOSConfigWithExpansions): Added. 39 40 * unit-tests/resources/mock-v3-models.js: 41 (MockModels.inject): Added a few more mock models for the newly added test. 42 1 43 2016-07-26 Ryosuke Niwa <rniwa@webkit.org> 2 44 -
trunk/Websites/perf.webkit.org/tools/js/buildbot-syncer.js
r199388 r204151 263 263 let newConfig = {}; 264 264 this._validateAndMergeConfig(newConfig, shared); 265 266 265 this._validateAndMergeConfig(newConfig, entry); 267 266 268 let type = entry['type']; 269 if (type) { 270 assert(types[type]); 271 this._validateAndMergeConfig(newConfig, types[type]); 272 } 273 274 let builder = entry['builder']; 275 if (builders[builder]) 276 this._validateAndMergeConfig(newConfig, builders[builder]); 277 278 assert('platform' in newConfig, 'configuration must specify a platform'); 279 assert('test' in newConfig, 'configuration must specify a test'); 280 assert('builder' in newConfig, 'configuration must specify a builder'); 281 assert('properties' in newConfig, 'configuration must specify arguments to post on a builder'); 282 assert('buildRequestArgument' in newConfig, 'configuration must specify buildRequestArgument'); 283 284 let test = Test.findByPath(newConfig.test); 285 assert(test, `${newConfig.test} is not a valid test path`); 286 287 let platform = Platform.findByName(newConfig.platform); 288 assert(platform, `${newConfig.platform} is not a valid platform name`); 289 290 let syncer = syncerByBuilder.get(newConfig.builder); 291 if (!syncer) { 292 syncer = new BuildbotSyncer(remote, newConfig); 293 syncerByBuilder.set(newConfig.builder, syncer); 294 } 295 syncer.addTestConfiguration(test, platform, newConfig.properties); 267 let expandedConfigurations = this._expandTypesAndPlatforms(newConfig); 268 for (let config of expandedConfigurations) { 269 if ('type' in config) { 270 let type = config['type']; 271 assert(type, `${type} is not a valid type in the configuration`); 272 this._validateAndMergeConfig(config, types[type]); 273 } 274 275 let builder = entry['builder']; 276 if (builders[builder]) 277 this._validateAndMergeConfig(config, builders[builder]); 278 279 this._createTestConfiguration(remote, syncerByBuilder, config); 280 } 296 281 } 297 282 … … 299 284 } 300 285 301 static _validateAndMergeConfig(config, valuesToMerge) 286 static _expandTypesAndPlatforms(unresolvedConfig) 287 { 288 let typeExpanded = []; 289 if ('types' in unresolvedConfig) { 290 for (let type of unresolvedConfig['types']) 291 typeExpanded.push(this._validateAndMergeConfig({'type': type}, unresolvedConfig, 'types')); 292 } else 293 typeExpanded.push(unresolvedConfig); 294 295 let configurations = []; 296 for (let config of typeExpanded) { 297 if ('platforms' in config) { 298 for (let platform of config['platforms']) 299 configurations.push(this._validateAndMergeConfig({'platform': platform}, config, 'platforms')); 300 } else 301 configurations.push(config); 302 } 303 304 return configurations; 305 } 306 307 static _createTestConfiguration(remote, syncerByBuilder, newConfig) 308 { 309 assert('platform' in newConfig, 'configuration must specify a platform'); 310 assert('test' in newConfig, 'configuration must specify a test'); 311 assert('builder' in newConfig, 'configuration must specify a builder'); 312 assert('properties' in newConfig, 'configuration must specify arguments to post on a builder'); 313 assert('buildRequestArgument' in newConfig, 'configuration must specify buildRequestArgument'); 314 315 let test = Test.findByPath(newConfig.test); 316 assert(test, `${newConfig.test} is not a valid test path`); 317 318 let platform = Platform.findByName(newConfig.platform); 319 assert(platform, `${newConfig.platform} is not a valid platform name`); 320 321 let syncer = syncerByBuilder.get(newConfig.builder); 322 if (!syncer) { 323 syncer = new BuildbotSyncer(remote, newConfig); 324 syncerByBuilder.set(newConfig.builder, syncer); 325 } 326 syncer.addTestConfiguration(test, platform, newConfig.properties); 327 } 328 329 static _validateAndMergeConfig(config, valuesToMerge, excludedProperty) 302 330 { 303 331 for (let name in valuesToMerge) { 304 332 let value = valuesToMerge[name]; 333 if (name == excludedProperty) 334 continue; 335 305 336 switch (name) { 337 case 'properties': // fallthrough 306 338 case 'arguments': 307 339 assert.equal(typeof(value), 'object', 'arguments should be a dictionary'); … … 310 342 this._validateAndMergeProperties(config['properties'], value); 311 343 break; 312 case 'test': 313 assert(value instanceof Array, 'test should be an array'); 314 assert(value.every(function (part) { return typeof part == 'string'; }), 'test should be an array of strings'); 344 case 'test': // fallthrough 345 case 'slaveList': // fallthrough 346 case 'platforms': 347 case 'types': 348 assert(value instanceof Array, `${name} should be an array`); 349 assert(value.every(function (part) { return typeof part == 'string'; }), `${name} should be an array of strings`); 315 350 config[name] = value.slice(); 316 break;317 case 'slaveList':318 assert(value instanceof Array, 'slaveList should be an array');319 assert(value.every(function (part) { return typeof part == 'string'; }), 'slaveList should be an array of strings');320 config[name] = value;321 351 break; 322 352 case 'type': // fallthrough … … 332 362 } 333 363 } 364 return config; 334 365 } 335 366 -
trunk/Websites/perf.webkit.org/unit-tests/buildbot-syncer-tests.js
r199388 r204151 57 57 ] 58 58 }; 59 } 60 61 function sampleiOSConfigWithExpansions() 62 { 63 return { 64 "triggerableName": "build-webkit-ios", 65 "shared": 66 { 67 "arguments": { 68 "webkit-revision": {"root": "WebKit"}, 69 "os-version": {"root": "iOS"} 70 }, 71 "buildRequestArgument": "build-request-id" 72 }, 73 "types": { 74 "iphone-plt": { 75 "test": ["PLT-iPhone"], 76 "arguments": {"test_name": "plt"} 77 }, 78 "ipad-plt": { 79 "test": ["PLT-iPad"], 80 "arguments": {"test_name": "plt"} 81 }, 82 "speedometer": { 83 "test": ["Speedometer"], 84 "arguments": {"tests": "speedometer"} 85 }, 86 }, 87 "builders": { 88 "iphone": { 89 "builder": "iPhone AB Tests", 90 "arguments": {"forcescheduler": "force-iphone-ab-tests"} 91 }, 92 "ipad": { 93 "builder": "iPad AB Tests", 94 "arguments": {"forcescheduler": "force-ipad-ab-tests"} 95 }, 96 }, 97 "configurations": [ 98 { 99 "builder": "iphone", 100 "platforms": ["iPhone", "iOS 10 iPhone"], 101 "types": ["iphone-plt", "speedometer"], 102 }, 103 { 104 "builder": "ipad", 105 "platforms": ["iPad"], 106 "types": ["ipad-plt", "speedometer"], 107 }, 108 ] 109 } 110 59 111 } 60 112 … … 483 535 assert.equal(configurations[1].test, MockModels.jetstream); 484 536 }); 537 538 it('should parse test configurations with types and platforms expansions correctly', function () { 539 let syncers = BuildbotSyncer._loadConfig(RemoteAPI, sampleiOSConfigWithExpansions()); 540 541 assert.equal(syncers.length, 2); 542 543 let configurations = syncers[0].testConfigurations(); 544 assert.equal(configurations.length, 4); 545 assert.equal(configurations[0].platform, MockModels.iphone); 546 assert.equal(configurations[0].test, MockModels.iPhonePLT); 547 assert.equal(configurations[1].platform, MockModels.iOS10iPhone); 548 assert.equal(configurations[1].test, MockModels.iPhonePLT); 549 assert.equal(configurations[2].platform, MockModels.iphone); 550 assert.equal(configurations[2].test, MockModels.speedometer); 551 assert.equal(configurations[3].platform, MockModels.iOS10iPhone); 552 assert.equal(configurations[3].test, MockModels.speedometer); 553 554 configurations = syncers[1].testConfigurations(); 555 assert.equal(configurations.length, 2); 556 assert.equal(configurations[0].platform, MockModels.ipad); 557 assert.equal(configurations[0].test, MockModels.iPadPLT); 558 assert.equal(configurations[1].platform, MockModels.ipad); 559 assert.equal(configurations[1].test, MockModels.speedometer); 560 }); 485 561 }); 486 562 -
trunk/Websites/perf.webkit.org/unit-tests/resources/mock-v3-models.js
r199123 r204151 32 32 MockModels.iphone = Platform.ensureSingleton(12, {name: 'iPhone', metrics: []}); 33 33 MockModels.ipad = Platform.ensureSingleton(13, {name: 'iPad', metrics: []}); 34 MockModels.iOS10iPhone = Platform.ensureSingleton(14, {name: 'iOS 10 iPhone', metrics: []}); 34 35 35 36 MockModels.plt = Test.ensureSingleton(844, {name: 'Page Load Test'}); 37 MockModels.iPadPLT = Test.ensureSingleton(1444, {name: 'PLT-iPad'}); 38 MockModels.iPhonePLT = Test.ensureSingleton(1500, {name: 'PLT-iPhone'}); 36 39 MockModels.pltMean = Metric.ensureSingleton(1158, {name: 'Time', aggregator: 'Arithmetic', test: MockModels.plt}); 37 40 MockModels.elCapitan = Platform.ensureSingleton(31, {name: 'El Capitan', metrics: [MockModels.pltMean]});
Note:
See TracChangeset
for help on using the changeset viewer.