Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: tools/testing/dart/test_options.dart

Issue 2522513002: Update test script short reproduction command to not print --packages flag. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/test_options.dart
diff --git a/tools/testing/dart/test_options.dart b/tools/testing/dart/test_options.dart
index bee1a2c5fc814f797a04c723ab0abff380334119..e9802e942e86d9e57e0fda7630133a93e97741dc 100644
--- a/tools/testing/dart/test_options.dart
+++ b/tools/testing/dart/test_options.dart
@@ -83,8 +83,16 @@ class TestOptionsParser {
dartkp: Compiler the Dart source into Kernel and then Kernel into AOT
snapshot before running the test.''',
['-c', '--compiler'],
- ['none', 'precompiler', 'dart2js', 'dart2analyzer', 'dart2app',
- 'dart2appjit', 'dartk', 'dartkp'],
+ [
+ 'none',
+ 'precompiler',
+ 'dart2js',
+ 'dart2analyzer',
+ 'dart2app',
+ 'dart2appjit',
+ 'dartk',
+ 'dartkp'
+ ],
'none'),
// TODO(antonm): fix the option drt.
new _TestOptionSpecification(
@@ -198,21 +206,29 @@ class TestOptionsParser {
'noopt', 'Run an in-place precompilation', ['--noopt'], [], false,
type: 'bool'),
new _TestOptionSpecification(
- 'fast_startup', 'Pass the --fast-startup flag to dart2js',
- ['--fast-startup'], [], false,
+ 'fast_startup',
+ 'Pass the --fast-startup flag to dart2js',
+ ['--fast-startup'],
+ [],
+ false,
+ type: 'bool'),
+ new _TestOptionSpecification('hot_reload', 'Run hot reload stress tests',
+ ['--hot-reload'], [], false,
type: 'bool'),
- new _TestOptionSpecification(
- 'hot_reload', 'Run hot reload stress tests', ['--hot-reload'], [],
- false, type: 'bool'),
new _TestOptionSpecification(
'hot_reload_rollback',
- 'Run hot reload rollback stress tests', ['--hot-reload-rollback'],
+ 'Run hot reload rollback stress tests',
+ ['--hot-reload-rollback'],
[],
- false, type: 'bool'),
+ false,
+ type: 'bool'),
eernst 2016/11/21 16:41:50 Confusing! Just to check that my understanding mat
new _TestOptionSpecification(
'use_blobs',
'Use mmap instead of shared libraries for precompilation',
- ['--use-blobs'], [], false, type: 'bool'),
+ ['--use-blobs'],
+ [],
+ false,
+ type: 'bool'),
new _TestOptionSpecification(
'timeout', 'Timeout in seconds', ['-t', '--timeout'], [], -1,
type: 'int'),
@@ -611,34 +627,30 @@ Note: currently only implemented for dart2js.''',
List<String> _constructReproducingCommandArguments(Map config) {
var arguments = new List<String>();
- for (var configKey in config.keys) {
- if (!_blacklistedOptions.contains(configKey)) {
- for (var option in _options) {
- var configValue = config[configKey];
- // We only include entries of [conf] if we find an option for it.
- if (configKey == option.name && configValue != option.defaultValue) {
- var isBooleanOption = option.type == 'bool';
- // Sort by length, so we get the shortest variant.
- var possibleOptions = new List.from(option.keys);
- possibleOptions.sort((a, b) => (a.length < b.length ? -1 : 1));
- var key = possibleOptions[0];
- if (key.startsWith('--')) {
- // long version
- arguments.add(key);
- if (!isBooleanOption) {
- arguments.add("$configValue");
- }
- } else {
- // short version
- assert(key.startsWith('-'));
- if (!isBooleanOption) {
- arguments.add("$key$configValue");
- } else {
- arguments.add(key);
- }
- }
- }
- }
+ for (var option in _options) {
+ var name = option.name;
+ if (!config.containsKey(name) || _blacklistedOptions.contains(name)) {
+ continue;
+ }
+ var value = config[name];
+ if (config[name] == option.defaultValue ||
+ (name == 'packages' &&
+ value ==
+ TestUtils.dartDirUri.resolve('.packages').toFilePath())) {
+ continue;
+ }
+ shortest(String a, String b) => a.length <= b.length ? a : b;
+ var key = option.keys.reduce(shortest);
+ if (option.type == 'bool') {
+ arguments.add(key);
+ } else if (key.startsWith('--')) {
+ // long version
+ arguments.add(key);
+ arguments.add("$value");
+ } else {
+ // short version
+ assert(key.startsWith('-'));
+ arguments.add("$key$value");
}
}
return arguments;
@@ -826,20 +838,23 @@ Note: currently only implemented for dart2js.''',
if (selectors.containsKey('observatory_ui')) {
if (selectors.length == 1) {
configuration['packages'] = TestUtils.dartDirUri
- .resolve('runtime/observatory/.packages').toFilePath();
+ .resolve('runtime/observatory/.packages')
+ .toFilePath();
} else {
// Make a new configuration whose selectors map only contains
// observatory_ui, and remove the key from the original selectors.
// The only mutable value in the map is the selectors, so a
// shallow copy is safe.
var observatoryConfiguration = new Map.from(configuration);
- observatoryConfiguration['selectors'] =
- {'observatory_ui': selectors['observatory_ui']};
+ observatoryConfiguration['selectors'] = {
+ 'observatory_ui': selectors['observatory_ui']
+ };
selectors.remove('observatory_ui');
// Set the packages flag.
observatoryConfiguration['packages'] = TestUtils.dartDirUri
- .resolve('runtime/observatory/.packages').toFilePath();
+ .resolve('runtime/observatory/.packages')
+ .toFilePath();
// Return the expansions of both configurations. Neither will reach
// this line in the recursive call to _expandConfigurations.
@@ -851,7 +866,7 @@ Note: currently only implemented for dart2js.''',
if (configuration['package_root'] == null &&
configuration['packages'] == null) {
configuration['packages'] =
- TestUtils.dartDirUri.resolve('.packages').toFilePath();
+ TestUtils.dartDirUri.resolve('.packages').toFilePath();
}
// Expand the architectures.
@@ -883,8 +898,8 @@ Note: currently only implemented for dart2js.''',
// Adjust default timeout based on mode, compiler, and sometimes runtime.
if (configuration['timeout'] == -1) {
- var isReload = configuration['hot_reload'] ||
- configuration['hot_reload_rollback'];
+ var isReload =
+ configuration['hot_reload'] || configuration['hot_reload_rollback'];
int compilerMulitiplier =
new CompilerConfiguration(configuration).computeTimeoutMultiplier();
int runtimeMultiplier = new RuntimeConfiguration(configuration)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698