| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // This test forks a second vm process that runs the script tools/coverage.dart | 5 // This test forks a second vm process that runs the script tools/coverage.dart |
| 6 // and verifies that the coverage tool produces its expected output. | 6 // and verifies that the coverage tool produces its expected output. |
| 7 // This test is mainly here to ensure that the coverage tool compiles and | 7 // This test is mainly here to ensure that the coverage tool compiles and |
| 8 // runs. | 8 // runs. |
| 9 | 9 |
| 10 import "dart:async"; | 10 import "dart:async"; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 print("Successfully matched all lines of '$targPath'"); | 45 print("Successfully matched all lines of '$targPath'"); |
| 46 } else { | 46 } else { |
| 47 print("Error: could not match all source code lines of '$targPath'"); | 47 print("Error: could not match all source code lines of '$targPath'"); |
| 48 exit(-1); | 48 exit(-1); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 void main() { | 52 void main() { |
| 53 // Compute paths for coverage tool and coverage target relative | 53 // Compute paths for coverage tool and coverage target relative |
| 54 // the the path of this script. | 54 // the the path of this script. |
| 55 var scriptPath = dirname(Platform.script); | 55 var scriptPath = dirname(Platform.script.toFilePath()); |
| 56 var toolPath = normalize(join(scriptPath, coverageToolScript)); | 56 var toolPath = normalize(join(scriptPath, coverageToolScript)); |
| 57 targPath = normalize(join(scriptPath, coverageTargetScript)); | 57 targPath = normalize(join(scriptPath, coverageTargetScript)); |
| 58 | 58 |
| 59 sourceLines = new File(targPath).readAsLinesSync(); | 59 sourceLines = new File(targPath).readAsLinesSync(); |
| 60 assert(sourceLines != null); | 60 assert(sourceLines != null); |
| 61 | 61 |
| 62 var processOpts = [ "--compile_all", toolPath, targPath ]; | 62 var processOpts = [ "--compile_all", toolPath, targPath ]; |
| 63 | 63 |
| 64 Process.start(Platform.executable, processOpts).then((Process process) { | 64 Process.start(Platform.executable, processOpts).then((Process process) { |
| 65 coverageToolProcess = process; | 65 coverageToolProcess = process; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 79 futures.add(subscription.asFuture(true)); | 79 futures.add(subscription.asFuture(true)); |
| 80 subscription = stderrStringStream.listen(onCoverageOutput); | 80 subscription = stderrStringStream.listen(onCoverageOutput); |
| 81 futures.add(subscription.asFuture(true)); | 81 futures.add(subscription.asFuture(true)); |
| 82 futures.add(coverageToolProcess.exitCode.then(checkExitCode)); | 82 futures.add(coverageToolProcess.exitCode.then(checkExitCode)); |
| 83 Future.wait(futures).then((results) { | 83 Future.wait(futures).then((results) { |
| 84 checkSuccess(); | 84 checkSuccess(); |
| 85 if (results.contains(false)) exit(-1); | 85 if (results.contains(false)) exit(-1); |
| 86 }); | 86 }); |
| 87 }); | 87 }); |
| 88 } | 88 } |
| OLD | NEW |