Index: tools/testing/dart/test_options.dart |
diff --git a/tools/testing/dart/test_options.dart b/tools/testing/dart/test_options.dart |
index 567df63a1b0302aac32495638af9a7f647c25342..ed9b13b6c9600b19992b5ebbce3933daff9dc2bc 100644 |
--- a/tools/testing/dart/test_options.dart |
+++ b/tools/testing/dart/test_options.dart |
@@ -462,9 +462,56 @@ Note: currently only implemented for dart2js.''', |
List<Map> expandedConfigs = _expandConfigurations(configuration); |
List<Map> result = expandedConfigs.where(_isValidConfig).toList(); |
+ for (var config in result) { |
+ config['_reproducing_arguments_'] = |
ricow1
2013/06/20 13:54:50
why are you prefixing and postfixing it with _
kustermann
2013/06/20 14:17:24
Because all values we put in the configuration obj
|
+ _constructReproducingCommandArguments(config); |
+ } |
return result.isEmpty ? null : result; |
} |
+ // For printing out reproducing command lines, we don't want to add these |
+ // options. |
+ Set<String> _blacklistedOptions = new Set<String>.from([ |
+ 'progress', 'failure-summary', 'step_name', 'report', 'tasks', 'verbose', |
+ 'time', 'dart', 'drt', 'dartium', 'build_directory', 'append_logs', |
+ 'write_debug_log', 'local_ip', |
ricow1
2013/06/20 13:54:50
maybe add shards and shard?
kustermann
2013/06/20 14:17:24
Good idea. Done.
|
+ ]); |
+ |
+ 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); |
+ } |
+ } |
+ } |
+ } |
+ } |
+ } |
+ return arguments; |
+ } |
+ |
/** |
* Determine if a particular configuration has a valid combination of compiler |
* and runtime elements. |