| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // These tests fork a second VM process that runs the script | 5 // These tests fork a second VM process that runs the script |
| 6 // ``tools/full-coverage.dart'' and verifies that the tool | 6 // ``tools/full-coverage.dart'' and verifies that the tool |
| 7 // produces the expeced output. | 7 // produces the expeced output. |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:convert'; | 10 import 'dart:convert'; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 destroyEnv(base) => new Directory(base).deleteSync(recursive: true); | 86 destroyEnv(base) => new Directory(base).deleteSync(recursive: true); |
| 87 | 87 |
| 88 | 88 |
| 89 generateCoverage(String workingDirectory) { | 89 generateCoverage(String workingDirectory) { |
| 90 for (var coverageProg in coverageTests) { | 90 for (var coverageProg in coverageTests) { |
| 91 var progPath = path.join(workingDirectory, coverageProg['name']); | 91 var progPath = path.join(workingDirectory, coverageProg['name']); |
| 92 var script = path.join(progPath, "${coverageProg['name']}.dart"); | 92 var script = path.join(progPath, "${coverageProg['name']}.dart"); |
| 93 var dartArgs = new List.from(dartBaseArgs) | 93 var dartArgs = new List.from(dartBaseArgs) |
| 94 ..addAll(['--coverage-dir=${progPath}', '${script}']); | 94 ..addAll(['--coverage-dir=${progPath}', '${script}']); |
| 95 var result = Process.runSync(Platform.executable, dartArgs); | 95 var result = Process.runSync(Platform.executable, dartArgs); |
| 96 expect(result.exitCode, 0); | 96 if (result.exitCode != 0) { |
| 97 print("Coverage generator returned exitCode: ${result.exitCode}."); |
| 98 print("stderr:\n${result.stderr}\n"); |
| 99 expect(result.exitCode, 0); |
| 100 } |
| 97 } | 101 } |
| 98 } | 102 } |
| 99 | 103 |
| 100 | 104 |
| 101 Future<Process> convertCoverage(String programDir, String format) { | 105 Future<Process> convertCoverage(String programDir, String format) { |
| 102 var dartArgs = new List.from(dartBaseArgs) | 106 var dartArgs = new List.from(dartBaseArgs) |
| 103 ..addAll([ | 107 ..addAll([ |
| 104 coverageScript, | 108 coverageScript, |
| 105 '--package-root=${packageRoot}', | 109 '--package-root=${packageRoot}', |
| 106 '--in=${programDir}', | 110 '--in=${programDir}', |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 String programPath = path.join(programDir, "${cTest['name']}.dart"); | 227 String programPath = path.join(programDir, "${cTest['name']}.dart"); |
| 224 testCoverage(programDir, programPath, | 228 testCoverage(programDir, programPath, |
| 225 new LcovDescriptor(programPath), | 229 new LcovDescriptor(programPath), |
| 226 new List.from(cTest['expectedHits'])); | 230 new List.from(cTest['expectedHits'])); |
| 227 testCoverage(programDir, programPath, | 231 testCoverage(programDir, programPath, |
| 228 new PrettyPrintDescriptor(programPath), | 232 new PrettyPrintDescriptor(programPath), |
| 229 new List.from(cTest['expectedHits'])); | 233 new List.from(cTest['expectedHits'])); |
| 230 }); | 234 }); |
| 231 }); | 235 }); |
| 232 } | 236 } |
| OLD | NEW |