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

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

Issue 1092153003: Support an @OnPlatform annotation. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 8 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/frontend/on_platform.dart ('k') | lib/src/runner/parse_metadata.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 library test.runner.loader; 5 library test.runner.loader;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 return loadFile(entry.path); 107 return loadFile(entry.path);
108 })); 108 }));
109 } 109 }
110 110
111 /// Loads a test suite from the file at [path]. 111 /// Loads a test suite from the file at [path].
112 /// 112 ///
113 /// This will emit a [LoadException] if the file fails to load. 113 /// This will emit a [LoadException] if the file fails to load.
114 Stream<Suite> loadFile(String path) { 114 Stream<Suite> loadFile(String path) {
115 var metadata; 115 var suiteMetadata;
116 try { 116 try {
117 metadata = parseMetadata(path); 117 suiteMetadata = parseMetadata(path);
118 } on AnalyzerErrorGroup catch (_) { 118 } on AnalyzerErrorGroup catch (_) {
119 // Ignore the analyzer's error, since its formatting is much worse than 119 // Ignore the analyzer's error, since its formatting is much worse than
120 // the VM's or dart2js's. 120 // the VM's or dart2js's.
121 metadata = new Metadata(); 121 suiteMetadata = new Metadata();
122 } on FormatException catch (error, stackTrace) { 122 } on FormatException catch (error, stackTrace) {
123 return new Stream.fromFuture( 123 return new Stream.fromFuture(
124 new Future.error(new LoadException(path, error), stackTrace)); 124 new Future.error(new LoadException(path, error), stackTrace));
125 } 125 }
126 126
127 var controller = new StreamController(); 127 var controller = new StreamController();
128 Future.forEach(_platforms, (platform) { 128 Future.forEach(_platforms, (platform) {
129 if (!metadata.testOn.evaluate(platform, os: currentOS)) { 129 if (!suiteMetadata.testOn.evaluate(platform, os: currentOS)) {
130 return null; 130 return null;
131 } 131 }
132 132
133 var metadata = suiteMetadata.forPlatform(platform, os: currentOS);
134
133 // Don't load a skipped suite. 135 // Don't load a skipped suite.
134 if (metadata.skip) { 136 if (metadata.skip) {
135 controller.add(new Suite([ 137 controller.add(new Suite([
136 new LocalTest(path, metadata, () {}) 138 new LocalTest(path, metadata, () {})
137 ], path: path, platform: platform.name, metadata: metadata)); 139 ], path: path, platform: platform.name, metadata: metadata));
138 return null; 140 return null;
139 } 141 }
140 142
141 return new Future.sync(() { 143 return new Future.sync(() {
142 if (_pubServeUrl != null && !p.isWithin('test', path)) { 144 if (_pubServeUrl != null && !p.isWithin('test', path)) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 Future close() { 239 Future close() {
238 for (var isolate in _isolates) { 240 for (var isolate in _isolates) {
239 isolate.kill(); 241 isolate.kill();
240 } 242 }
241 _isolates.clear(); 243 _isolates.clear();
242 244
243 if (_browserServerCompleter == null) return new Future.value(); 245 if (_browserServerCompleter == null) return new Future.value();
244 return _browserServer.then((browserServer) => browserServer.close()); 246 return _browserServer.then((browserServer) => browserServer.close());
245 } 247 }
246 } 248 }
OLDNEW
« no previous file with comments | « lib/src/frontend/on_platform.dart ('k') | lib/src/runner/parse_metadata.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698