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

Side by Side Diff: tools/testing/dart/test_suite.dart

Issue 10392023: Change dart:io to use Future for one-shot operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adding stable test binaries Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « tools/testing/dart/test_runner.dart ('k') | utils/compiler/build_helper.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * Classes and methods for enumerating and preparing tests. 6 * Classes and methods for enumerating and preparing tests.
7 * 7 *
8 * This library includes: 8 * This library includes:
9 * 9 *
10 * - Creating tests by listing all the Dart files in certain directories, 10 * - Creating tests by listing all the Dart files in certain directories,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 void forEachTest(Function onTest, Map testCache, String globalTempDir(), 52 void forEachTest(Function onTest, Map testCache, String globalTempDir(),
53 [Function onDone]); 53 [Function onDone]);
54 } 54 }
55 55
56 56
57 class CCTestListerIsolate extends Isolate { 57 class CCTestListerIsolate extends Isolate {
58 CCTestListerIsolate() : super.heavy(); 58 CCTestListerIsolate() : super.heavy();
59 59
60 void main() { 60 void main() {
61 port.receive((String runnerPath, SendPort replyTo) { 61 port.receive((String runnerPath, SendPort replyTo) {
62 var p = new Process.start(runnerPath, ["--list"]); 62 var p = Process.start(runnerPath, ["--list"]);
63 StringInputStream stdoutStream = new StringInputStream(p.stdout); 63 StringInputStream stdoutStream = new StringInputStream(p.stdout);
64 List<String> tests = new List<String>(); 64 List<String> tests = new List<String>();
65 stdoutStream.onLine = () { 65 stdoutStream.onLine = () {
66 String line = stdoutStream.readLine(); 66 String line = stdoutStream.readLine();
67 while (line != null) { 67 while (line != null) {
68 tests.add(line); 68 tests.add(line);
69 line = stdoutStream.readLine(); 69 line = stdoutStream.readLine();
70 } 70 }
71 }; 71 };
72 p.onError = (error) { 72 p.onError = (error) {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 ReadTestExpectationsInto(testExpectations, 325 ReadTestExpectationsInto(testExpectations,
326 '$dartDir/$statusFilePath', 326 '$dartDir/$statusFilePath',
327 configuration, 327 configuration,
328 statusFileRead); 328 statusFileRead);
329 } 329 }
330 } 330 }
331 331
332 void processDirectory() { 332 void processDirectory() {
333 directoryPath = '$dartDir/$directoryPath'; 333 directoryPath = '$dartDir/$directoryPath';
334 Directory dir = new Directory(directoryPath); 334 Directory dir = new Directory(directoryPath);
335 dir.onError = (s) { 335 dir.exists().then((exists) {
336 throw s;
337 };
338 dir.exists((bool exists) {
339 if (!exists) { 336 if (!exists) {
340 print('Directory containing tests not found: $directoryPath'); 337 print('Directory containing tests not found: $directoryPath');
341 directoryListingDone(false); 338 directoryListingDone(false);
342 } else { 339 } else {
343 dir.onFile = processFile; 340 var lister = dir.list(recursive: listRecursively());
344 dir.onDone = directoryListingDone; 341 lister.onFile = processFile;
345 dir.list(recursive: listRecursively()); 342 lister.onDone = directoryListingDone;
346 } 343 }
347 }); 344 });
348 } 345 }
349 346
350 void enqueueTestCaseFromTestInformation(TestInformation info) { 347 void enqueueTestCaseFromTestInformation(TestInformation info) {
351 var filename = info.filename; 348 var filename = info.filename;
352 var optionsFromFile = info.optionsFromFile; 349 var optionsFromFile = info.optionsFromFile;
353 var isNegative = info.isNegative; 350 var isNegative = info.isNegative;
354 351
355 // Look up expectations in status files using a modified file path. 352 // Look up expectations in status files using a modified file path.
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 directoryPath = '$dartDir/$directoryPath'; 1044 directoryPath = '$dartDir/$directoryPath';
1048 // Enqueueing the directory listers is an activity. 1045 // Enqueueing the directory listers is an activity.
1049 activityStarted(); 1046 activityStarted();
1050 for (String testDir in _testDirs) { 1047 for (String testDir in _testDirs) {
1051 Directory dir = new Directory("$directoryPath/$testDir"); 1048 Directory dir = new Directory("$directoryPath/$testDir");
1052 if (dir.existsSync()) { 1049 if (dir.existsSync()) {
1053 activityStarted(); 1050 activityStarted();
1054 dir.onError = (s) { 1051 dir.onError = (s) {
1055 throw s; 1052 throw s;
1056 }; 1053 };
1057 dir.onFile = processFile; 1054 var lister = dir.list(recursive: listRecursively());
1058 dir.onDone = (ignore) => activityCompleted(); 1055 lister.onFile = processFile;
1059 dir.list(recursive: listRecursively()); 1056 lister.onDone = (ignore) => activityCompleted();
1060 } 1057 }
1061 } 1058 }
1062 // Completed the enqueueing of listers. 1059 // Completed the enqueueing of listers.
1063 activityCompleted(); 1060 activityCompleted();
1064 } 1061 }
1065 } 1062 }
1066 1063
1067 1064
1068 class JUnitTestSuite implements TestSuite { 1065 class JUnitTestSuite implements TestSuite {
1069 Map configuration; 1066 Map configuration;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 processDirectory(); 1111 processDirectory();
1115 } 1112 }
1116 1113
1117 void processDirectory() { 1114 void processDirectory() {
1118 directoryPath = '$dartDir/$directoryPath'; 1115 directoryPath = '$dartDir/$directoryPath';
1119 Directory dir = new Directory(directoryPath); 1116 Directory dir = new Directory(directoryPath);
1120 1117
1121 dir.onError = (s) { 1118 dir.onError = (s) {
1122 throw s; 1119 throw s;
1123 }; 1120 };
1124 dir.onFile = processFile; 1121 var lister = dir.list(recursive: true);
1125 dir.onDone = createTest; 1122 lister.onFile = processFile;
1126 dir.list(recursive: true); 1123 lister.onDone = createTest;
1127 } 1124 }
1128 1125
1129 void processFile(String filename) { 1126 void processFile(String filename) {
1130 if (!isTestFile(filename)) return; 1127 if (!isTestFile(filename)) return;
1131 1128
1132 int index = filename.indexOf('compiler/javatests/com/google/dart'); 1129 int index = filename.indexOf('compiler/javatests/com/google/dart');
1133 if (index != -1) { 1130 if (index != -1) {
1134 String testRelativePath = 1131 String testRelativePath =
1135 filename.substring(index + 'compiler/javatests/'.length, 1132 filename.substring(index + 'compiler/javatests/'.length,
1136 filename.length - '.java'.length); 1133 filename.length - '.java'.length);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 * $noCrash tests are expected to be flaky but not crash 1399 * $noCrash tests are expected to be flaky but not crash
1403 * $pass tests are expected to pass 1400 * $pass tests are expected to pass
1404 * $failOk tests are expected to fail that we won't fix 1401 * $failOk tests are expected to fail that we won't fix
1405 * $fail tests are expected to fail that we should fix 1402 * $fail tests are expected to fail that we should fix
1406 * $crash tests are expected to crash that we should fix 1403 * $crash tests are expected to crash that we should fix
1407 * $timeout tests are allowed to timeout 1404 * $timeout tests are allowed to timeout
1408 """; 1405 """;
1409 print(report); 1406 print(report);
1410 } 1407 }
1411 } 1408 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_runner.dart ('k') | utils/compiler/build_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698