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

Side by Side Diff: lib/src/executable.dart

Issue 1206033004: Only load a certain number of test suites at once. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 6 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
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 // TODO(nweiz): This is under lib so that it can be used by the unittest dummy 5 // TODO(nweiz): This is under lib so that it can be used by the unittest dummy
6 // package. Once that package is no longer being updated, move this back into 6 // package. Once that package is no longer being updated, move this back into
7 // bin. 7 // bin.
8 library test.executable; 8 library test.executable;
9 9
10 import 'dart:async'; 10 import 'dart:async';
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 mergeStreams(paths.map((path) { 314 mergeStreams(paths.map((path) {
315 if (new Directory(path).existsSync()) return loader.loadDir(path); 315 if (new Directory(path).existsSync()) return loader.loadDir(path);
316 if (new File(path).existsSync()) return loader.loadFile(path); 316 if (new File(path).existsSync()) return loader.loadFile(path);
317 317
318 return new Stream.fromIterable([ 318 return new Stream.fromIterable([
319 new LoadSuite("loading $path", () => 319 new LoadSuite("loading $path", () =>
320 throw new LoadException(path, 'Does not exist.')) 320 throw new LoadException(path, 'Does not exist.'))
321 ]); 321 ]);
322 })).listen((loadSuite) { 322 })).listen((loadSuite) {
323 group.add(new Future.sync(() async { 323 group.add(new Future.sync(() {
324 engine.suiteSink.add(loadSuite); 324 engine.suiteSink.add(loadSuite.changeSuite((suite) {
325 325 if (pattern == null) return suite;
326 var suite = await loadSuite.suite; 326 return suite.change(
327 if (suite == null) return;
328 if (pattern != null) {
329 suite = suite.change(
330 tests: suite.tests.where((test) => test.name.contains(pattern))); 327 tests: suite.tests.where((test) => test.name.contains(pattern)));
331 } 328 }));
332
333 engine.suiteSink.add(suite);
334 })); 329 }));
335 }, onError: (error, stackTrace) { 330 }, onError: (error, stackTrace) {
336 group.add(new Future.error(error, stackTrace)); 331 group.add(new Future.error(error, stackTrace));
337 }, onDone: group.close); 332 }, onDone: group.close);
338 333
339 await group.future; 334 await group.future;
340 335
341 // Once we've loaded all the suites, notify the engine that no more will be 336 // Once we've loaded all the suites, notify the engine that no more will be
342 // coming. 337 // coming.
343 engine.suiteSink.close(); 338 engine.suiteSink.close();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 if (description is! Map) return false; 409 if (description is! Map) return false;
415 var path = description["path"]; 410 var path = description["path"];
416 if (path is! String) return false; 411 if (path is! String) return false;
417 412
418 print("$version (from $path)"); 413 print("$version (from $path)");
419 return true; 414 return true;
420 415
421 default: return false; 416 default: return false;
422 } 417 }
423 } 418 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698