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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 ReadTestExpectationsInto(testExpectations, | 257 ReadTestExpectationsInto(testExpectations, |
258 '$dartDir/$statusFilePath', | 258 '$dartDir/$statusFilePath', |
259 configuration, | 259 configuration, |
260 statusFileRead); | 260 statusFileRead); |
261 } | 261 } |
262 } | 262 } |
263 | 263 |
264 void processDirectory() { | 264 void processDirectory() { |
265 directoryPath = '$dartDir/$directoryPath'; | 265 directoryPath = '$dartDir/$directoryPath'; |
266 Directory dir = new Directory(directoryPath); | 266 Directory dir = new Directory(directoryPath); |
267 dir.errorHandler = (s) { | 267 dir.onError = (s) { |
268 throw s; | 268 throw s; |
269 }; | 269 }; |
270 dir.existsHandler = (bool exists) { | 270 dir.onExists = (bool exists) { |
271 if (!exists) { | 271 if (!exists) { |
272 print('Directory containing tests not found: $directoryPath'); | 272 print('Directory containing tests not found: $directoryPath'); |
273 directoryListingDone(false); | 273 directoryListingDone(false); |
274 } else { | 274 } else { |
275 dir.fileHandler = processFile; | 275 dir.onFile = processFile; |
276 dir.doneHandler = directoryListingDone; | 276 dir.onDone = directoryListingDone; |
277 dir.list(recursive: listRecursively()); | 277 dir.list(recursive: listRecursively()); |
278 } | 278 } |
279 }; | 279 }; |
280 dir.exists(); | 280 dir.exists(); |
281 } | 281 } |
282 | 282 |
283 void enqueueTestCaseFromTestInformation(TestInformation info) { | 283 void enqueueTestCaseFromTestInformation(TestInformation info) { |
284 var filename = info.filename; | 284 var filename = info.filename; |
285 var optionsFromFile = info.optionsFromFile; | 285 var optionsFromFile = info.optionsFromFile; |
286 var isNegative = info.isNegative; | 286 var isNegative = info.isNegative; |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 } | 853 } |
854 | 854 |
855 void processDirectory() { | 855 void processDirectory() { |
856 directoryPath = '$dartDir/$directoryPath'; | 856 directoryPath = '$dartDir/$directoryPath'; |
857 // Enqueueing the directory listers is an activity. | 857 // Enqueueing the directory listers is an activity. |
858 activityStarted(); | 858 activityStarted(); |
859 for (String testDir in _testDirs) { | 859 for (String testDir in _testDirs) { |
860 Directory dir = new Directory("$directoryPath/$testDir"); | 860 Directory dir = new Directory("$directoryPath/$testDir"); |
861 if (dir.existsSync()) { | 861 if (dir.existsSync()) { |
862 activityStarted(); | 862 activityStarted(); |
863 dir.errorHandler = (s) { | 863 dir.onError = (s) { |
864 throw s; | 864 throw s; |
865 }; | 865 }; |
866 dir.fileHandler = processFile; | 866 dir.onFile = processFile; |
867 dir.doneHandler = (ignore) => activityCompleted(); | 867 dir.onDone = (ignore) => activityCompleted(); |
868 dir.list(recursive: listRecursively()); | 868 dir.list(recursive: listRecursively()); |
869 } | 869 } |
870 } | 870 } |
871 // Completed the enqueueing of listers. | 871 // Completed the enqueueing of listers. |
872 activityCompleted(); | 872 activityCompleted(); |
873 } | 873 } |
874 } | 874 } |
875 | 875 |
876 | 876 |
877 class JUnitTestSuite implements TestSuite { | 877 class JUnitTestSuite implements TestSuite { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 testClasses = <String>[]; | 920 testClasses = <String>[]; |
921 // Do not read the status file. | 921 // Do not read the status file. |
922 // All exclusions are hardcoded in this script, as they are in testcfg.py. | 922 // All exclusions are hardcoded in this script, as they are in testcfg.py. |
923 processDirectory(); | 923 processDirectory(); |
924 } | 924 } |
925 | 925 |
926 void processDirectory() { | 926 void processDirectory() { |
927 directoryPath = '$dartDir/$directoryPath'; | 927 directoryPath = '$dartDir/$directoryPath'; |
928 Directory dir = new Directory(directoryPath); | 928 Directory dir = new Directory(directoryPath); |
929 | 929 |
930 dir.errorHandler = (s) { | 930 dir.onError = (s) { |
931 throw s; | 931 throw s; |
932 }; | 932 }; |
933 dir.fileHandler = processFile; | 933 dir.onFile = processFile; |
934 dir.doneHandler = createTest; | 934 dir.onDone = createTest; |
935 dir.list(recursive: true); | 935 dir.list(recursive: true); |
936 } | 936 } |
937 | 937 |
938 void processFile(String filename) { | 938 void processFile(String filename) { |
939 if (!isTestFile(filename)) return; | 939 if (!isTestFile(filename)) return; |
940 | 940 |
941 int index = filename.indexOf('compiler/javatests/com/google/dart'); | 941 int index = filename.indexOf('compiler/javatests/com/google/dart'); |
942 if (index != -1) { | 942 if (index != -1) { |
943 String testRelativePath = | 943 String testRelativePath = |
944 filename.substring(index + 'compiler/javatests/'.length, | 944 filename.substring(index + 'compiler/javatests/'.length, |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 * $noCrash tests are expected to be flaky but not crash | 1140 * $noCrash tests are expected to be flaky but not crash |
1141 * $pass tests are expected to pass | 1141 * $pass tests are expected to pass |
1142 * $failOk tests are expected to fail that we won't fix | 1142 * $failOk tests are expected to fail that we won't fix |
1143 * $fail tests are expected to fail that we should fix | 1143 * $fail tests are expected to fail that we should fix |
1144 * $crash tests are expected to crash that we should fix | 1144 * $crash tests are expected to crash that we should fix |
1145 * $timeout tests are allowed to timeout | 1145 * $timeout tests are allowed to timeout |
1146 """; | 1146 """; |
1147 print(report); | 1147 print(report); |
1148 } | 1148 } |
1149 } | 1149 } |
OLD | NEW |