Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #library("test_options_parser"); | 5 #library("test_options_parser"); |
| 6 | 6 |
| 7 #import("dart:io"); | 7 #import("dart:io"); |
| 8 #import("dart:builtin"); | 8 #import("dart:builtin"); |
| 9 #import("drt_updater.dart"); | 9 #import("drt_updater.dart"); |
| 10 | 10 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 new _TestOptionSpecification( | 88 new _TestOptionSpecification( |
| 89 'runtime', | 89 'runtime', |
| 90 '''Where the tests should be run. | 90 '''Where the tests should be run. |
| 91 vm: Run Dart code on the standalone dart vm. | 91 vm: Run Dart code on the standalone dart vm. |
| 92 | 92 |
| 93 d8: Run JavaScript from the command line using v8. | 93 d8: Run JavaScript from the command line using v8. |
| 94 | 94 |
| 95 drt: Run Dart or JavaScript in the headless version of Chrome, | 95 drt: Run Dart or JavaScript in the headless version of Chrome, |
| 96 DumpRenderTree. | 96 DumpRenderTree. |
| 97 | 97 |
| 98 dartium: Run Dart or JavaScript in Dartium. | |
| 99 | |
| 98 [ff | chrome | safari | ie | opera]: Run JavaScript in the specified | 100 [ff | chrome | safari | ie | opera]: Run JavaScript in the specified |
| 99 browser. | 101 browser. |
| 100 | 102 |
| 101 none: No runtime, compile only (for example, used for dartc static analysis | 103 none: No runtime, compile only (for example, used for dartc static analysis |
| 102 tests).''', | 104 tests).''', |
| 103 ['-r', '--runtime'], | 105 ['-r', '--runtime'], |
| 104 ['vm', 'd8', 'drt', 'ff', 'firefox', 'chrome', | 106 ['vm', 'd8', 'drt', 'dartium', 'ff', 'firefox', 'chrome', |
| 105 'safari', 'ie', 'opera', 'none'], | 107 'safari', 'ie', 'opera', 'none'], |
| 106 'vm'), | 108 'vm'), |
| 107 new _TestOptionSpecification( | 109 new _TestOptionSpecification( |
| 108 'arch', | 110 'arch', |
| 109 'The architecture to run tests for', | 111 'The architecture to run tests for', |
| 110 ['-a', '--arch'], | 112 ['-a', '--arch'], |
| 111 ['all', 'ia32', 'x64', 'simarm'], | 113 ['all', 'ia32', 'x64', 'simarm'], |
| 112 'ia32'), | 114 'ia32'), |
| 113 new _TestOptionSpecification( | 115 new _TestOptionSpecification( |
| 114 'system', | 116 'system', |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 ['--frog'], | 228 ['--frog'], |
| 227 [], | 229 [], |
| 228 ''), | 230 ''), |
| 229 new _TestOptionSpecification( | 231 new _TestOptionSpecification( |
| 230 'drt', | 232 'drt', |
| 231 'Path to DumpRenderTree executable', | 233 'Path to DumpRenderTree executable', |
| 232 ['--drt'], | 234 ['--drt'], |
| 233 [], | 235 [], |
| 234 ''), | 236 ''), |
| 235 new _TestOptionSpecification( | 237 new _TestOptionSpecification( |
| 238 'dartium', | |
| 239 'Path to Dartium Chrome executable', | |
| 240 ['--dartium'], | |
| 241 [], | |
| 242 ''), | |
| 243 new _TestOptionSpecification( | |
| 236 'froglib', | 244 'froglib', |
| 237 'Path to frog library', | 245 'Path to frog library', |
| 238 ['--froglib'], | 246 ['--froglib'], |
| 239 [], | 247 [], |
| 240 ''), | 248 ''), |
| 241 new _TestOptionSpecification( | 249 new _TestOptionSpecification( |
| 242 'noBatch', | 250 'noBatch', |
| 243 'Do not run browser tests in batch mode', | 251 'Do not run browser tests in batch mode', |
| 244 ['-n', '--nobatch'], | 252 ['-n', '--nobatch'], |
| 245 [], | 253 [], |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 bool _isValidConfig(Map config) { | 382 bool _isValidConfig(Map config) { |
| 375 bool isValid = true; | 383 bool isValid = true; |
| 376 switch (config['compiler']) { | 384 switch (config['compiler']) { |
| 377 case 'frog': | 385 case 'frog': |
| 378 case 'dart2js': | 386 case 'dart2js': |
| 379 case 'frogsh': | 387 case 'frogsh': |
| 380 // Note: by adding 'none' as a configuration, if the user | 388 // Note: by adding 'none' as a configuration, if the user |
| 381 // runs test.py -c dart2js -r drt,none the dart2js_none and | 389 // runs test.py -c dart2js -r drt,none the dart2js_none and |
| 382 // dart2js_drt will be duplicating work. If later we don't need 'none' | 390 // dart2js_drt will be duplicating work. If later we don't need 'none' |
| 383 // with dart2js, we should remove it from here. | 391 // with dart2js, we should remove it from here. |
| 384 isValid = (const ['d8', 'drt', 'ff', 'chrome', 'safari', 'ie', | 392 isValid = (const ['d8', 'drt', 'dartium', 'ff', |
| 385 'opera', 'none']).indexOf(config['runtime']) >= 0; | 393 'chrome', 'safari', |
| 394 'ie', 'opera', 'none']).indexOf(config['runtime']) > = 0; | |
|
Emily Fortuna
2012/04/09 23:56:20
> 80 char
vsm
2012/04/10 20:00:45
Done.
| |
| 386 break; | 395 break; |
| 387 case 'dartc': | 396 case 'dartc': |
| 388 isValid = config['runtime'] == 'none'; | 397 isValid = config['runtime'] == 'none'; |
| 389 break; | 398 break; |
| 390 case 'none': | 399 case 'none': |
| 391 isValid = (const ['vm', 'drt']).indexOf(config['runtime']) >= 0; | 400 isValid = (const ['vm', 'drt', |
| 401 'dartium']).indexOf(config['runtime']) >= 0; | |
| 392 } | 402 } |
| 393 if (!isValid) { | 403 if (!isValid) { |
| 394 print("Warning: combination of ${config['compiler']} and " + | 404 print("Warning: combination of ${config['compiler']} and " + |
| 395 "${config['runtime']} is invalid. Skipping this combination."); | 405 "${config['runtime']} is invalid. Skipping this combination."); |
| 396 } | 406 } |
| 397 if (config['runtime'] == 'ie' && | 407 if (config['runtime'] == 'ie' && |
| 398 new Platform().operatingSystem() != 'windows') { | 408 new Platform().operatingSystem() != 'windows') { |
| 399 isValid = false; | 409 isValid = false; |
| 400 print("Warning cannot run Internet Explorer on non-Windows operating" + | 410 print("Warning cannot run Internet Explorer on non-Windows operating" + |
| 401 " system."); | 411 " system."); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 if (configuration['compiler'].contains(',')) { | 502 if (configuration['compiler'].contains(',')) { |
| 493 return _expandHelper('compiler', configuration); | 503 return _expandHelper('compiler', configuration); |
| 494 } | 504 } |
| 495 | 505 |
| 496 // Expand runtimes. | 506 // Expand runtimes. |
| 497 var runtimes = configuration['runtime']; | 507 var runtimes = configuration['runtime']; |
| 498 if (runtimes.contains(',')) { | 508 if (runtimes.contains(',')) { |
| 499 return _expandHelper('runtime', configuration); | 509 return _expandHelper('runtime', configuration); |
| 500 } else { | 510 } else { |
| 501 // All runtimes eventually go through this path, after expansion. | 511 // All runtimes eventually go through this path, after expansion. |
| 502 if (runtimes == 'drt') { | 512 var updater = runtimeUpdater(runtimes); |
| 503 DumpRenderTreeUpdater.update(); | 513 if (updater !== null) { |
| 514 updater.update(); | |
| 504 } | 515 } |
| 505 } | 516 } |
| 506 | 517 |
| 507 // Adjust default timeout based on mode, compiler, and sometimes runtime. | 518 // Adjust default timeout based on mode, compiler, and sometimes runtime. |
| 508 if (configuration['timeout'] == -1) { | 519 if (configuration['timeout'] == -1) { |
| 509 var timeout = 60; | 520 var timeout = 60; |
| 510 switch (configuration['compiler']) { | 521 switch (configuration['compiler']) { |
| 511 case 'dartc': | 522 case 'dartc': |
| 512 timeout *= 4; | 523 timeout *= 4; |
| 513 break; | 524 break; |
| 514 case 'dart2js': | 525 case 'dart2js': |
| 515 case 'frog': | 526 case 'frog': |
| 516 if (configuration['mode'] == 'debug') { | 527 if (configuration['mode'] == 'debug') { |
| 517 timeout *= 8; | 528 timeout *= 8; |
| 518 } | 529 } |
| 519 if (configuration['host_checked']) { | 530 if (configuration['host_checked']) { |
| 520 timeout *= 16; | 531 timeout *= 16; |
| 521 } | 532 } |
| 522 if ((const ['ie', 'ff', 'chrome', 'safari', | 533 if ((const ['ie', 'ff', 'chrome', 'safari', |
| 523 'opera']).indexOf(configuration['runtime']) >= 0) { | 534 'opera']).indexOf(configuration['runtime']) >= 0) { |
| 524 timeout *= 4; // Allow additional time for browser testing to run. | 535 timeout *= 4; // Allow additional time for browser testing to run. |
| 525 } | 536 } |
| 526 break; | 537 break; |
| 527 default: | 538 default: |
| 528 if (configuration['mode'] == 'debug') { | 539 if (configuration['mode'] == 'debug') { |
| 529 timeout *= 2; | 540 timeout *= 2; |
| 530 } | 541 } |
| 531 if (configuration['runtime'] == 'drt') { | 542 if ((const ['drt', 'dartium']).indexOf(configuration['runtime']) |
| 532 timeout *= 4; | 543 >= 0) { |
| 544 timeout *= 4; // Allow additional time for browser testing to run. | |
| 533 } | 545 } |
| 534 break; | 546 break; |
| 535 } | 547 } |
| 536 configuration['timeout'] = timeout; | 548 configuration['timeout'] = timeout; |
| 537 } | 549 } |
| 538 | 550 |
| 539 return [configuration]; | 551 return [configuration]; |
| 540 } | 552 } |
| 541 | 553 |
| 542 /** | 554 /** |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 607 return option; | 619 return option; |
| 608 } | 620 } |
| 609 } | 621 } |
| 610 print('Unknown test option $name'); | 622 print('Unknown test option $name'); |
| 611 exit(1); | 623 exit(1); |
| 612 } | 624 } |
| 613 | 625 |
| 614 | 626 |
| 615 List<_TestOptionSpecification> _options; | 627 List<_TestOptionSpecification> _options; |
| 616 } | 628 } |
| OLD | NEW |