OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 | 47 |
48 class CCTestListerIsolate extends Isolate { | 48 class CCTestListerIsolate extends Isolate { |
49 CCTestListerIsolate() : super.heavy(); | 49 CCTestListerIsolate() : super.heavy(); |
50 | 50 |
51 void main() { | 51 void main() { |
52 port.receive((String runnerPath, SendPort replyTo) { | 52 port.receive((String runnerPath, SendPort replyTo) { |
53 var p = new Process.start(runnerPath, ["--list"]); | 53 var p = new Process.start(runnerPath, ["--list"]); |
54 StringInputStream stdoutStream = new StringInputStream(p.stdout); | 54 StringInputStream stdoutStream = new StringInputStream(p.stdout); |
55 List<String> tests = new List<String>(); | 55 List<String> tests = new List<String>(); |
56 stdoutStream.lineHandler = () { | 56 stdoutStream.onLine = () { |
57 String line = stdoutStream.readLine(); | 57 String line = stdoutStream.readLine(); |
58 while (line != null) { | 58 while (line != null) { |
59 tests.add(line); | 59 tests.add(line); |
60 line = stdoutStream.readLine(); | 60 line = stdoutStream.readLine(); |
61 } | 61 } |
62 }; | 62 }; |
63 p.errorHandler = (error) { | 63 p.onError = (error) { |
64 print("Failed to list tests: $runnerPath --list"); | 64 print("Failed to list tests: $runnerPath --list"); |
65 replyTo.send(""); | 65 replyTo.send(""); |
66 }; | 66 }; |
67 p.exitHandler = (code) { | 67 p.onExit = (code) { |
68 if (code < 0) { | 68 if (code < 0) { |
69 print("Failed to list tests: $runnerPath --list"); | 69 print("Failed to list tests: $runnerPath --list"); |
70 replyTo.send(""); | 70 replyTo.send(""); |
71 } | 71 } |
72 for (String test in tests) { | 72 for (String test in tests) { |
73 replyTo.send(test); | 73 replyTo.send(test); |
74 } | 74 } |
75 replyTo.send(""); | 75 replyTo.send(""); |
76 }; | 76 }; |
77 port.close(); | 77 port.close(); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 ReadTestExpectationsInto(testExpectations, | 256 ReadTestExpectationsInto(testExpectations, |
257 '$dartDir/$statusFilePath', | 257 '$dartDir/$statusFilePath', |
258 configuration, | 258 configuration, |
259 statusFileRead); | 259 statusFileRead); |
260 } | 260 } |
261 } | 261 } |
262 | 262 |
263 void processDirectory() { | 263 void processDirectory() { |
264 directoryPath = '$dartDir/$directoryPath'; | 264 directoryPath = '$dartDir/$directoryPath'; |
265 Directory dir = new Directory(directoryPath); | 265 Directory dir = new Directory(directoryPath); |
266 dir.errorHandler = (s) { | 266 dir.onError = (s) { |
267 throw s; | 267 throw s; |
268 }; | 268 }; |
269 dir.existsHandler = (bool exists) { | 269 dir.exists((bool exists) { |
270 if (!exists) { | 270 if (!exists) { |
271 print('Directory containing tests not found: $directoryPath'); | 271 print('Directory containing tests not found: $directoryPath'); |
272 directoryListingDone(false); | 272 directoryListingDone(false); |
273 } else { | 273 } else { |
274 dir.fileHandler = processFile; | 274 dir.onFile = processFile; |
275 dir.doneHandler = directoryListingDone; | 275 dir.onDone = directoryListingDone; |
276 dir.list(recursive: listRecursively()); | 276 dir.list(recursive: listRecursively()); |
277 } | 277 } |
278 }; | 278 }); |
279 dir.exists(); | |
280 } | 279 } |
281 | 280 |
282 void enqueueTestCaseFromTestInformation(TestInformation info) { | 281 void enqueueTestCaseFromTestInformation(TestInformation info) { |
283 var filename = info.filename; | 282 var filename = info.filename; |
284 var optionsFromFile = info.optionsFromFile; | 283 var optionsFromFile = info.optionsFromFile; |
285 var isNegative = info.isNegative; | 284 var isNegative = info.isNegative; |
286 | 285 |
287 // Look up expectations in status files using a modified file path. | 286 // Look up expectations in status files using a modified file path. |
288 String testName; | 287 String testName; |
289 filename = filename.replaceAll('\\', '/'); | 288 filename = filename.replaceAll('\\', '/'); |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 } | 880 } |
882 | 881 |
883 void processDirectory() { | 882 void processDirectory() { |
884 directoryPath = '$dartDir/$directoryPath'; | 883 directoryPath = '$dartDir/$directoryPath'; |
885 // Enqueueing the directory listers is an activity. | 884 // Enqueueing the directory listers is an activity. |
886 activityStarted(); | 885 activityStarted(); |
887 for (String testDir in _testDirs) { | 886 for (String testDir in _testDirs) { |
888 Directory dir = new Directory("$directoryPath/$testDir"); | 887 Directory dir = new Directory("$directoryPath/$testDir"); |
889 if (dir.existsSync()) { | 888 if (dir.existsSync()) { |
890 activityStarted(); | 889 activityStarted(); |
891 dir.errorHandler = (s) { | 890 dir.onError = (s) { |
892 throw s; | 891 throw s; |
893 }; | 892 }; |
894 dir.fileHandler = processFile; | 893 dir.onFile = processFile; |
895 dir.doneHandler = (ignore) => activityCompleted(); | 894 dir.onDone = (ignore) => activityCompleted(); |
896 dir.list(recursive: listRecursively()); | 895 dir.list(recursive: listRecursively()); |
897 } | 896 } |
898 } | 897 } |
899 // Completed the enqueueing of listers. | 898 // Completed the enqueueing of listers. |
900 activityCompleted(); | 899 activityCompleted(); |
901 } | 900 } |
902 } | 901 } |
903 | 902 |
904 | 903 |
905 class JUnitTestSuite implements TestSuite { | 904 class JUnitTestSuite implements TestSuite { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 testClasses = <String>[]; | 947 testClasses = <String>[]; |
949 // Do not read the status file. | 948 // Do not read the status file. |
950 // All exclusions are hardcoded in this script, as they are in testcfg.py. | 949 // All exclusions are hardcoded in this script, as they are in testcfg.py. |
951 processDirectory(); | 950 processDirectory(); |
952 } | 951 } |
953 | 952 |
954 void processDirectory() { | 953 void processDirectory() { |
955 directoryPath = '$dartDir/$directoryPath'; | 954 directoryPath = '$dartDir/$directoryPath'; |
956 Directory dir = new Directory(directoryPath); | 955 Directory dir = new Directory(directoryPath); |
957 | 956 |
958 dir.errorHandler = (s) { | 957 dir.onError = (s) { |
959 throw s; | 958 throw s; |
960 }; | 959 }; |
961 dir.fileHandler = processFile; | 960 dir.onFile = processFile; |
962 dir.doneHandler = createTest; | 961 dir.onDone = createTest; |
963 dir.list(recursive: true); | 962 dir.list(recursive: true); |
964 } | 963 } |
965 | 964 |
966 void processFile(String filename) { | 965 void processFile(String filename) { |
967 if (!isTestFile(filename)) return; | 966 if (!isTestFile(filename)) return; |
968 | 967 |
969 int index = filename.indexOf('compiler/javatests/com/google/dart'); | 968 int index = filename.indexOf('compiler/javatests/com/google/dart'); |
970 if (index != -1) { | 969 if (index != -1) { |
971 String testRelativePath = | 970 String testRelativePath = |
972 filename.substring(index + 'compiler/javatests/'.length, | 971 filename.substring(index + 'compiler/javatests/'.length, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 * $noCrash tests are expected to be flaky but not crash | 1166 * $noCrash tests are expected to be flaky but not crash |
1168 * $pass tests are expected to pass | 1167 * $pass tests are expected to pass |
1169 * $failOk tests are expected to fail that we won't fix | 1168 * $failOk tests are expected to fail that we won't fix |
1170 * $fail tests are expected to fail that we should fix | 1169 * $fail tests are expected to fail that we should fix |
1171 * $crash tests are expected to crash that we should fix | 1170 * $crash tests are expected to crash that we should fix |
1172 * $timeout tests are allowed to timeout | 1171 * $timeout tests are allowed to timeout |
1173 """; | 1172 """; |
1174 print(report); | 1173 print(report); |
1175 } | 1174 } |
1176 } | 1175 } |
OLD | NEW |