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

Unified Diff: lib/src/runner/configuration/load.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, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/runner/configuration.dart ('k') | lib/src/runner/plugin/platform_helpers.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/configuration/load.dart
diff --git a/lib/src/runner/configuration/load.dart b/lib/src/runner/configuration/load.dart
index f66f0fc4a6dcfc241707f34fdfd5df0cad38c987..93cc7296ab260f76eb8dc3969b34dccfdde52dde 100644
--- a/lib/src/runner/configuration/load.dart
+++ b/lib/src/runner/configuration/load.dart
@@ -10,10 +10,12 @@ import 'package:path/path.dart' as p;
import 'package:source_span/source_span.dart';
import 'package:yaml/yaml.dart';
+import '../../backend/operating_system.dart';
import '../../backend/platform_selector.dart';
import '../../backend/test_platform.dart';
import '../../frontend/timeout.dart';
import '../../utils.dart';
+import '../../util/io.dart';
import '../configuration.dart';
import 'values.dart';
@@ -88,7 +90,25 @@ class _ConfigurationLoader {
value: (valueNode) =>
_nestedConfig(valueNode, "tag value", runnerConfig: false));
- return new Configuration(
+ var onPlatform = _getMap("on_platform",
+ key: (keyNode) => _parseNode(keyNode, "on_platform key",
+ (value) => new PlatformSelector.parse(value)),
+ value: (valueNode) =>
+ _nestedConfig(valueNode, "on_platform value", runnerConfig: false));
+
+ var onOS = _getMap("on_os", key: (keyNode) {
+ _validate(keyNode, "on_os key must be a string.",
+ (value) => value is String);
+
+ var os = OperatingSystem.find(keyNode.value);
+ if (os != null) return os;
+
+ throw new SourceSpanFormatException(
+ 'Invalid on_os key: No such operating system.',
+ keyNode.span, _source);
+ }, value: (valueNode) => _nestedConfig(valueNode, "on_os value"));
+
+ var config = new Configuration(
verboseTrace: verboseTrace,
jsTrace: jsTrace,
skip: skip,
@@ -96,7 +116,11 @@ class _ConfigurationLoader {
testOn: testOn,
timeout: timeout,
addTags: addTags,
- tags: tags);
+ tags: tags,
+ onPlatform: onPlatform);
+
+ var osConfig = onOS[currentOS];
+ return osConfig == null ? config : config.merge(osConfig);
}
/// Loads runner configuration (but not test configuration).
« no previous file with comments | « lib/src/runner/configuration.dart ('k') | lib/src/runner/plugin/platform_helpers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698