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

Side by Side Diff: lib/src/runner/configuration.dart

Issue 1730173004: Add on_os and on_platform fields. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 4 years, 9 months 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 unified diff | Download patch
« no previous file with comments | « lib/src/backend/operating_system.dart ('k') | lib/src/runner/configuration/load.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'dart:io'; 5 import 'dart:io';
6 6
7 import 'package:boolean_selector/boolean_selector.dart'; 7 import 'package:boolean_selector/boolean_selector.dart';
8 import 'package:collection/collection.dart'; 8 import 'package:collection/collection.dart';
9 import 'package:glob/glob.dart'; 9 import 'package:glob/glob.dart';
10 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 final Set<String> addTags; 132 final Set<String> addTags;
133 133
134 /// The global test metadata derived from this configuration. 134 /// The global test metadata derived from this configuration.
135 Metadata get metadata => new Metadata( 135 Metadata get metadata => new Metadata(
136 timeout: timeout, 136 timeout: timeout,
137 verboseTrace: verboseTrace, 137 verboseTrace: verboseTrace,
138 skip: skip, 138 skip: skip,
139 skipReason: skipReason, 139 skipReason: skipReason,
140 testOn: testOn, 140 testOn: testOn,
141 tags: addTags, 141 tags: addTags,
142 forTag: mapMap(tags, value: (_, config) => config.metadata)); 142 forTag: mapMap(tags, value: (_, config) => config.metadata),
143 onPlatform: mapMap(onPlatform, value: (_, config) => config.metadata));
143 144
144 /// The set of tags that have been declaredin any way in this configuration. 145 /// The set of tags that have been declaredin any way in this configuration.
145 Set<String> get knownTags { 146 Set<String> get knownTags {
146 if (_knownTags != null) return _knownTags; 147 if (_knownTags != null) return _knownTags;
147 148
148 var known = includeTags.variables.toSet() 149 var known = includeTags.variables.toSet()
149 ..addAll(excludeTags.variables) 150 ..addAll(excludeTags.variables)
150 ..addAll(addTags); 151 ..addAll(addTags);
151 tags.forEach((selector, config) { 152 tags.forEach((selector, config) {
152 known.addAll(selector.variables); 153 known.addAll(selector.variables);
153 known.addAll(config.knownTags); 154 known.addAll(config.knownTags);
154 }); 155 });
155 156
156 _knownTags = new UnmodifiableSetView(known); 157 _knownTags = new UnmodifiableSetView(known);
157 return _knownTags; 158 return _knownTags;
158 } 159 }
159 Set<String> _knownTags; 160 Set<String> _knownTags;
160 161
162 /// Configuration for particular platforms.
163 ///
164 /// The keys are platform selectors, and the values are configurations for
165 /// those platforms. These configuration should only contain test-level
166 /// configuration fields, but that isn't enforced.
167 final Map<PlatformSelector, Configuration> onPlatform;
168
161 /// Parses the configuration from [args]. 169 /// Parses the configuration from [args].
162 /// 170 ///
163 /// Throws a [FormatException] if [args] are invalid. 171 /// Throws a [FormatException] if [args] are invalid.
164 factory Configuration.parse(List<String> arguments) => args.parse(arguments); 172 factory Configuration.parse(List<String> arguments) => args.parse(arguments);
165 173
166 /// Loads the configuration from [path]. 174 /// Loads the configuration from [path].
167 /// 175 ///
168 /// Throws an [IOException] if [path] does not exist or cannot be read. Throws 176 /// Throws an [IOException] if [path] does not exist or cannot be read. Throws
169 /// a [FormatException] if its contents are invalid. 177 /// a [FormatException] if its contents are invalid.
170 factory Configuration.load(String path) => load(path); 178 factory Configuration.load(String path) => load(path);
(...skipping 13 matching lines...) Expand all
184 int pubServePort, 192 int pubServePort,
185 int concurrency, 193 int concurrency,
186 Timeout timeout, 194 Timeout timeout,
187 this.pattern, 195 this.pattern,
188 Iterable<TestPlatform> platforms, 196 Iterable<TestPlatform> platforms,
189 Iterable<String> paths, 197 Iterable<String> paths,
190 Glob filename, 198 Glob filename,
191 BooleanSelector includeTags, 199 BooleanSelector includeTags,
192 BooleanSelector excludeTags, 200 BooleanSelector excludeTags,
193 Iterable addTags, 201 Iterable addTags,
194 Map<BooleanSelector, Configuration> tags}) 202 Map<BooleanSelector, Configuration> tags,
203 Map<PlatformSelector, Configuration> onPlatform})
195 : _help = help, 204 : _help = help,
196 _version = version, 205 _version = version,
197 _verboseTrace = verboseTrace, 206 _verboseTrace = verboseTrace,
198 _jsTrace = jsTrace, 207 _jsTrace = jsTrace,
199 _skip = skip, 208 _skip = skip,
200 testOn = testOn ?? PlatformSelector.all, 209 testOn = testOn ?? PlatformSelector.all,
201 _pauseAfterLoad = pauseAfterLoad, 210 _pauseAfterLoad = pauseAfterLoad,
202 _color = color, 211 _color = color,
203 _packageRoot = packageRoot, 212 _packageRoot = packageRoot,
204 _reporter = reporter, 213 _reporter = reporter,
205 pubServeUrl = pubServePort == null 214 pubServeUrl = pubServePort == null
206 ? null 215 ? null
207 : Uri.parse("http://localhost:$pubServePort"), 216 : Uri.parse("http://localhost:$pubServePort"),
208 _concurrency = concurrency, 217 _concurrency = concurrency,
209 timeout = (pauseAfterLoad ?? false) 218 timeout = (pauseAfterLoad ?? false)
210 ? Timeout.none 219 ? Timeout.none
211 : (timeout == null ? new Timeout.factor(1) : timeout), 220 : (timeout == null ? new Timeout.factor(1) : timeout),
212 _platforms = _list(platforms), 221 _platforms = _list(platforms),
213 _paths = _list(paths), 222 _paths = _list(paths),
214 _filename = filename, 223 _filename = filename,
215 includeTags = includeTags ?? BooleanSelector.all, 224 includeTags = includeTags ?? BooleanSelector.all,
216 excludeTags = excludeTags ?? BooleanSelector.none, 225 excludeTags = excludeTags ?? BooleanSelector.none,
217 addTags = addTags?.toSet() ?? new Set(), 226 addTags = addTags?.toSet() ?? new Set(),
218 tags = tags == null ? const {} : new Map.unmodifiable(tags) { 227 tags = tags == null ? const {} : new Map.unmodifiable(tags),
228 onPlatform = onPlatform == null
229 ? const {}
230 : new Map.unmodifiable(onPlatform) {
219 if (_filename != null && _filename.context.style != p.style) { 231 if (_filename != null && _filename.context.style != p.style) {
220 throw new ArgumentError( 232 throw new ArgumentError(
221 "filename's context must match the current operating system, was " 233 "filename's context must match the current operating system, was "
222 "${_filename.context.style}."); 234 "${_filename.context.style}.");
223 } 235 }
224 } 236 }
225 237
226 /// Returns a [input] as a list or `null`. 238 /// Returns a [input] as a list or `null`.
227 /// 239 ///
228 /// If [input] is `null` or empty, this returns `null`. Otherwise, it returns 240 /// If [input] is `null` or empty, this returns `null`. Otherwise, it returns
(...skipping 27 matching lines...) Expand all
256 concurrency: other._concurrency ?? _concurrency, 268 concurrency: other._concurrency ?? _concurrency,
257 timeout: timeout.merge(other.timeout), 269 timeout: timeout.merge(other.timeout),
258 pattern: other.pattern ?? pattern, 270 pattern: other.pattern ?? pattern,
259 platforms: other._platforms ?? _platforms, 271 platforms: other._platforms ?? _platforms,
260 paths: other._paths ?? _paths, 272 paths: other._paths ?? _paths,
261 filename: other._filename ?? _filename, 273 filename: other._filename ?? _filename,
262 includeTags: includeTags.intersection(other.includeTags), 274 includeTags: includeTags.intersection(other.includeTags),
263 excludeTags: excludeTags.union(other.excludeTags), 275 excludeTags: excludeTags.union(other.excludeTags),
264 addTags: other.addTags.union(addTags), 276 addTags: other.addTags.union(addTags),
265 tags: mergeMaps(tags, other.tags, 277 tags: mergeMaps(tags, other.tags,
278 value: (config1, config2) => config1.merge(config2)),
279 onPlatform: mergeMaps(onPlatform, other.onPlatform,
266 value: (config1, config2) => config1.merge(config2))); 280 value: (config1, config2) => config1.merge(config2)));
267 } 281 }
268 } 282 }
OLDNEW
« no previous file with comments | « lib/src/backend/operating_system.dart ('k') | lib/src/runner/configuration/load.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698