| 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 var p = Process.start(runnerPath, ["--list"]); | 68 void processErrorHandler(error) { |
| 69 StringInputStream stdoutStream = new StringInputStream(p.stdout); | 69 } |
| 70 List<String> tests = new List<String>(); | 70 Future processFuture = Process.start(runnerPath, ["--list"]); |
| 71 stdoutStream.onLine = () { | 71 processFuture.then((p) { |
| 72 String line = stdoutStream.readLine(); | 72 StringInputStream stdoutStream = new StringInputStream(p.stdout); |
| 73 while (line != null) { | 73 List<String> tests = new List<String>(); |
| 74 tests.add(line); | 74 stdoutStream.onLine = () { |
| 75 line = stdoutStream.readLine(); | 75 String line = stdoutStream.readLine(); |
| 76 } | 76 while (line != null) { |
| 77 }; | 77 tests.add(line); |
| 78 p.onError = (error) { | 78 line = stdoutStream.readLine(); |
| 79 } |
| 80 }; |
| 81 p.onExit = (code) { |
| 82 if (code < 0) { |
| 83 print("Failed to list tests: $runnerPath --list"); |
| 84 replyTo.send(""); |
| 85 } |
| 86 for (String test in tests) { |
| 87 replyTo.send(test); |
| 88 } |
| 89 replyTo.send(""); |
| 90 }; |
| 91 port.close(); |
| 92 }); |
| 93 processFuture.handleException((e) { |
| 79 print("Failed to list tests: $runnerPath --list"); | 94 print("Failed to list tests: $runnerPath --list"); |
| 80 replyTo.send(""); | 95 replyTo.send(""); |
| 81 }; | 96 return true; |
| 82 p.onExit = (code) { | 97 }); |
| 83 if (code < 0) { | |
| 84 print("Failed to list tests: $runnerPath --list"); | |
| 85 replyTo.send(""); | |
| 86 } | |
| 87 for (String test in tests) { | |
| 88 replyTo.send(test); | |
| 89 } | |
| 90 replyTo.send(""); | |
| 91 }; | |
| 92 port.close(); | |
| 93 }); | 98 }); |
| 94 } | 99 } |
| 95 | 100 |
| 96 | 101 |
| 97 /** | 102 /** |
| 98 * A specialized [TestSuite] that runs tests written in C to unit test | 103 * A specialized [TestSuite] that runs tests written in C to unit test |
| 99 * the Dart virtual machine and its API. | 104 * the Dart virtual machine and its API. |
| 100 * | 105 * |
| 101 * The tests are compiled into a monolithic executable by the build step. | 106 * The tests are compiled into a monolithic executable by the build step. |
| 102 * The executable lists its tests when run with the --list command line flag. | 107 * The executable lists its tests when run with the --list command line flag. |
| (...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 * $noCrash tests are expected to be flaky but not crash | 1472 * $noCrash tests are expected to be flaky but not crash |
| 1468 * $pass tests are expected to pass | 1473 * $pass tests are expected to pass |
| 1469 * $failOk tests are expected to fail that we won't fix | 1474 * $failOk tests are expected to fail that we won't fix |
| 1470 * $fail tests are expected to fail that we should fix | 1475 * $fail tests are expected to fail that we should fix |
| 1471 * $crash tests are expected to crash that we should fix | 1476 * $crash tests are expected to crash that we should fix |
| 1472 * $timeout tests are allowed to timeout | 1477 * $timeout tests are allowed to timeout |
| 1473 """; | 1478 """; |
| 1474 print(report); | 1479 print(report); |
| 1475 } | 1480 } |
| 1476 } | 1481 } |
| OLD | NEW |