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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 } | 884 } |
886 | 885 |
887 void processDirectory() { | 886 void processDirectory() { |
888 directoryPath = '$dartDir/$directoryPath'; | 887 directoryPath = '$dartDir/$directoryPath'; |
889 // Enqueueing the directory listers is an activity. | 888 // Enqueueing the directory listers is an activity. |
890 activityStarted(); | 889 activityStarted(); |
891 for (String testDir in _testDirs) { | 890 for (String testDir in _testDirs) { |
892 Directory dir = new Directory("$directoryPath/$testDir"); | 891 Directory dir = new Directory("$directoryPath/$testDir"); |
893 if (dir.existsSync()) { | 892 if (dir.existsSync()) { |
894 activityStarted(); | 893 activityStarted(); |
895 dir.errorHandler = (s) { | 894 dir.onError = (s) { |
896 throw s; | 895 throw s; |
897 }; | 896 }; |
898 dir.fileHandler = processFile; | 897 dir.onFile = processFile; |
899 dir.doneHandler = (ignore) => activityCompleted(); | 898 dir.onDone = (ignore) => activityCompleted(); |
900 dir.list(recursive: listRecursively()); | 899 dir.list(recursive: listRecursively()); |
901 } | 900 } |
902 } | 901 } |
903 // Completed the enqueueing of listers. | 902 // Completed the enqueueing of listers. |
904 activityCompleted(); | 903 activityCompleted(); |
905 } | 904 } |
906 } | 905 } |
907 | 906 |
908 | 907 |
909 class JUnitTestSuite implements TestSuite { | 908 class JUnitTestSuite implements TestSuite { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 testClasses = <String>[]; | 951 testClasses = <String>[]; |
953 // Do not read the status file. | 952 // Do not read the status file. |
954 // All exclusions are hardcoded in this script, as they are in testcfg.py. | 953 // All exclusions are hardcoded in this script, as they are in testcfg.py. |
955 processDirectory(); | 954 processDirectory(); |
956 } | 955 } |
957 | 956 |
958 void processDirectory() { | 957 void processDirectory() { |
959 directoryPath = '$dartDir/$directoryPath'; | 958 directoryPath = '$dartDir/$directoryPath'; |
960 Directory dir = new Directory(directoryPath); | 959 Directory dir = new Directory(directoryPath); |
961 | 960 |
962 dir.errorHandler = (s) { | 961 dir.onError = (s) { |
963 throw s; | 962 throw s; |
964 }; | 963 }; |
965 dir.fileHandler = processFile; | 964 dir.onFile = processFile; |
966 dir.doneHandler = createTest; | 965 dir.onDone = createTest; |
967 dir.list(recursive: true); | 966 dir.list(recursive: true); |
968 } | 967 } |
969 | 968 |
970 void processFile(String filename) { | 969 void processFile(String filename) { |
971 if (!isTestFile(filename)) return; | 970 if (!isTestFile(filename)) return; |
972 | 971 |
973 int index = filename.indexOf('compiler/javatests/com/google/dart'); | 972 int index = filename.indexOf('compiler/javatests/com/google/dart'); |
974 if (index != -1) { | 973 if (index != -1) { |
975 String testRelativePath = | 974 String testRelativePath = |
976 filename.substring(index + 'compiler/javatests/'.length, | 975 filename.substring(index + 'compiler/javatests/'.length, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 * $noCrash tests are expected to be flaky but not crash | 1170 * $noCrash tests are expected to be flaky but not crash |
1172 * $pass tests are expected to pass | 1171 * $pass tests are expected to pass |
1173 * $failOk tests are expected to fail that we won't fix | 1172 * $failOk tests are expected to fail that we won't fix |
1174 * $fail tests are expected to fail that we should fix | 1173 * $fail tests are expected to fail that we should fix |
1175 * $crash tests are expected to crash that we should fix | 1174 * $crash tests are expected to crash that we should fix |
1176 * $timeout tests are allowed to timeout | 1175 * $timeout tests are allowed to timeout |
1177 """; | 1176 """; |
1178 print(report); | 1177 print(report); |
1179 } | 1178 } |
1180 } | 1179 } |
OLD | NEW |