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

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

Issue 10837070: Remove old isolate API and update all code in the repository to use (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 4 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 | « tests/standalone/io/testing_server.dart ('k') | no next file » | 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 * to be listed each time. 48 * to be listed each time.
49 */ 49 */
50 void forEachTest(Function onTest, Map testCache, [Function onDone]); 50 void forEachTest(Function onTest, Map testCache, [Function onDone]);
51 } 51 }
52 52
53 53
54 // TODO(1030): remove once in the corelib. 54 // TODO(1030): remove once in the corelib.
55 bool Contains(element, collection) => collection.indexOf(element) >= 0; 55 bool Contains(element, collection) => collection.indexOf(element) >= 0;
56 56
57 57
58 class CCTestListerIsolate extends Isolate { 58 void ccTestLister() {
59 CCTestListerIsolate() : super.heavy(); 59 port.receive((String runnerPath, SendPort replyTo) {
60 60 var p = Process.start(runnerPath, ["--list"]);
61 void main() { 61 StringInputStream stdoutStream = new StringInputStream(p.stdout);
62 port.receive((String runnerPath, SendPort replyTo) { 62 List<String> tests = new List<String>();
63 var p = Process.start(runnerPath, ["--list"]); 63 stdoutStream.onLine = () {
64 StringInputStream stdoutStream = new StringInputStream(p.stdout); 64 String line = stdoutStream.readLine();
65 List<String> tests = new List<String>(); 65 while (line != null) {
66 stdoutStream.onLine = () { 66 tests.add(line);
67 String line = stdoutStream.readLine(); 67 line = stdoutStream.readLine();
68 while (line != null) { 68 }
69 tests.add(line); 69 };
70 line = stdoutStream.readLine(); 70 p.onError = (error) {
71 } 71 print("Failed to list tests: $runnerPath --list");
72 }; 72 replyTo.send("");
73 p.onError = (error) { 73 };
74 p.onExit = (code) {
75 if (code < 0) {
74 print("Failed to list tests: $runnerPath --list"); 76 print("Failed to list tests: $runnerPath --list");
75 replyTo.send(""); 77 replyTo.send("");
76 }; 78 }
77 p.onExit = (code) { 79 for (String test in tests) {
78 if (code < 0) { 80 replyTo.send(test);
79 print("Failed to list tests: $runnerPath --list"); 81 }
80 replyTo.send(""); 82 replyTo.send("");
81 } 83 };
82 for (String test in tests) { 84 port.close();
83 replyTo.send(test); 85 });
84 }
85 replyTo.send("");
86 };
87 port.close();
88 });
89 }
90 } 86 }
91 87
92 88
93 /** 89 /**
94 * A specialized [TestSuite] that runs tests written in C to unit test 90 * A specialized [TestSuite] that runs tests written in C to unit test
95 * the Dart virtual machine and its API. 91 * the Dart virtual machine and its API.
96 * 92 *
97 * The tests are compiled into a monolithic executable by the build step. 93 * The tests are compiled into a monolithic executable by the build step.
98 * The executable lists its tests when run with the --list command line flag. 94 * The executable lists its tests when run with the --list command line flag.
99 * Individual tests are run by specifying them on the command line. 95 * Individual tests are run by specifying them on the command line.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 150
155 void forEachTest(Function onTest, Map testCache, [Function onDone]) { 151 void forEachTest(Function onTest, Map testCache, [Function onDone]) {
156 doTest = onTest; 152 doTest = onTest;
157 doDone = (ignore) => (onDone != null) ? onDone() : null; 153 doDone = (ignore) => (onDone != null) ? onDone() : null;
158 154
159 var filesRead = 0; 155 var filesRead = 0;
160 void statusFileRead() { 156 void statusFileRead() {
161 filesRead++; 157 filesRead++;
162 if (filesRead == statusFilePaths.length) { 158 if (filesRead == statusFilePaths.length) {
163 receiveTestName = new ReceivePort(); 159 receiveTestName = new ReceivePort();
164 new CCTestListerIsolate().spawn().then((port) { 160 var port = spawnFunction(ccTestLister);
165 port.send(runnerPath, receiveTestName.toSendPort()); 161 port.send(runnerPath, receiveTestName.toSendPort());
166 receiveTestName.receive(testNameHandler); 162 receiveTestName.receive(testNameHandler);
167 });
168 } 163 }
169 } 164 }
170 165
171 testExpectations = new TestExpectations(); 166 testExpectations = new TestExpectations();
172 for (var statusFilePath in statusFilePaths) { 167 for (var statusFilePath in statusFilePaths) {
173 ReadTestExpectationsInto(testExpectations, 168 ReadTestExpectationsInto(testExpectations,
174 '$dartDir/$statusFilePath', 169 '$dartDir/$statusFilePath',
175 configuration, 170 configuration,
176 statusFileRead); 171 statusFileRead);
177 } 172 }
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 * $noCrash tests are expected to be flaky but not crash 1427 * $noCrash tests are expected to be flaky but not crash
1433 * $pass tests are expected to pass 1428 * $pass tests are expected to pass
1434 * $failOk tests are expected to fail that we won't fix 1429 * $failOk tests are expected to fail that we won't fix
1435 * $fail tests are expected to fail that we should fix 1430 * $fail tests are expected to fail that we should fix
1436 * $crash tests are expected to crash that we should fix 1431 * $crash tests are expected to crash that we should fix
1437 * $timeout tests are allowed to timeout 1432 * $timeout tests are allowed to timeout
1438 """; 1433 """;
1439 print(report); 1434 print(report);
1440 } 1435 }
1441 } 1436 }
OLDNEW
« no previous file with comments | « tests/standalone/io/testing_server.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698