| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]); | 58 void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]); |
| 59 } | 59 } |
| 60 | 60 |
| 61 | 61 |
| 62 // TODO(1030): remove once in the corelib. | 62 // TODO(1030): remove once in the corelib. |
| 63 bool Contains(element, collection) => collection.indexOf(element) >= 0; | 63 bool Contains(element, collection) => collection.indexOf(element) >= 0; |
| 64 | 64 |
| 65 | 65 |
| 66 void ccTestLister() { | 66 void ccTestLister() { |
| 67 port.receive((String runnerPath, SendPort replyTo) { | 67 port.receive((String runnerPath, SendPort replyTo) { |
| 68 void processErrorHandler(error) { | |
| 69 } | |
| 70 Future processFuture = Process.start(runnerPath, ["--list"]); | 68 Future processFuture = Process.start(runnerPath, ["--list"]); |
| 71 processFuture.then((p) { | 69 processFuture.then((p) { |
| 72 StringInputStream stdoutStream = new StringInputStream(p.stdout); | 70 StringInputStream stdoutStream = new StringInputStream(p.stdout); |
| 73 List<String> tests = new List<String>(); | 71 var streamDone = false; |
| 72 var processExited = false; |
| 73 checkDone() { |
| 74 if (streamDone && processExited) { |
| 75 replyTo.send(""); |
| 76 } |
| 77 } |
| 74 stdoutStream.onLine = () { | 78 stdoutStream.onLine = () { |
| 75 String line = stdoutStream.readLine(); | 79 String line = stdoutStream.readLine(); |
| 76 while (line != null) { | 80 replyTo.send(line); |
| 77 tests.add(line); | 81 }; |
| 78 line = stdoutStream.readLine(); | 82 stdoutStream.onClosed = () { |
| 79 } | 83 streamDone = true; |
| 84 checkDone(); |
| 80 }; | 85 }; |
| 81 p.onExit = (code) { | 86 p.onExit = (code) { |
| 82 if (code < 0) { | 87 if (code < 0) { |
| 83 print("Failed to list tests: $runnerPath --list"); | 88 print("Failed to list tests: $runnerPath --list"); |
| 84 replyTo.send(""); | 89 replyTo.send(""); |
| 90 } else { |
| 91 processExited = true; |
| 92 checkDone(); |
| 85 } | 93 } |
| 86 for (String test in tests) { | |
| 87 replyTo.send(test); | |
| 88 } | |
| 89 replyTo.send(""); | |
| 90 }; | 94 }; |
| 91 port.close(); | 95 port.close(); |
| 92 }); | 96 }); |
| 93 processFuture.handleException((e) { | 97 processFuture.handleException((e) { |
| 94 print("Failed to list tests: $runnerPath --list"); | 98 print("Failed to list tests: $runnerPath --list"); |
| 95 replyTo.send(""); | 99 replyTo.send(""); |
| 96 return true; | 100 return true; |
| 97 }); | 101 }); |
| 98 }); | 102 }); |
| 99 } | 103 } |
| (...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 * $noCrash tests are expected to be flaky but not crash | 1479 * $noCrash tests are expected to be flaky but not crash |
| 1476 * $pass tests are expected to pass | 1480 * $pass tests are expected to pass |
| 1477 * $failOk tests are expected to fail that we won't fix | 1481 * $failOk tests are expected to fail that we won't fix |
| 1478 * $fail tests are expected to fail that we should fix | 1482 * $fail tests are expected to fail that we should fix |
| 1479 * $crash tests are expected to crash that we should fix | 1483 * $crash tests are expected to crash that we should fix |
| 1480 * $timeout tests are allowed to timeout | 1484 * $timeout tests are allowed to timeout |
| 1481 """; | 1485 """; |
| 1482 print(report); | 1486 print(report); |
| 1483 } | 1487 } |
| 1484 } | 1488 } |
| OLD | NEW |