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

Side by Side Diff: tests/standalone/coverage_test.dart

Issue 17406010: Move getters from Options to Platform (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed Dart_GetType Created 7 years, 5 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
OLDNEW
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:io"; 10 import "dart:io";
(...skipping 29 matching lines...) Expand all
40 void checkSuccess() { 40 void checkSuccess() {
41 if (nextLineToMatch == sourceLines.length) { 41 if (nextLineToMatch == sourceLines.length) {
42 print("Successfully matched all lines of '$targPath'"); 42 print("Successfully matched all lines of '$targPath'");
43 } else { 43 } else {
44 print("Error: could not match all source code lines of '$targPath'"); 44 print("Error: could not match all source code lines of '$targPath'");
45 exit(-1); 45 exit(-1);
46 } 46 }
47 } 47 }
48 48
49 void main() { 49 void main() {
50 var options = new Options();
51
52 // Compute paths for coverage tool and coverage target relative 50 // Compute paths for coverage tool and coverage target relative
53 // the the path of this script. 51 // the the path of this script.
54 var scriptPath = new Path(options.script).directoryPath; 52 var scriptPath = new Path(Platform.script).directoryPath;
55 var toolPath = scriptPath.join(new Path(coverageToolScript)).canonicalize(); 53 var toolPath = scriptPath.join(new Path(coverageToolScript)).canonicalize();
56 targPath = scriptPath.join(new Path(coverageTargetScript)).canonicalize(); 54 targPath = scriptPath.join(new Path(coverageTargetScript)).canonicalize();
57 55
58 sourceLines = new File(targPath.toNativePath()).readAsLinesSync(); 56 sourceLines = new File(targPath.toNativePath()).readAsLinesSync();
59 assert(sourceLines != null); 57 assert(sourceLines != null);
60 58
61 var processOpts = [ "--compile_all", 59 var processOpts = [ "--compile_all",
62 toolPath.toNativePath(), 60 toolPath.toNativePath(),
63 targPath.toNativePath() ]; 61 targPath.toNativePath() ];
64 62
65 Process.start(options.executable, processOpts).then((Process process) { 63 Process.start(Platform.executable, processOpts).then((Process process) {
66 coverageToolProcess = process; 64 coverageToolProcess = process;
67 coverageToolProcess.stdin.close(); 65 coverageToolProcess.stdin.close();
68 var stdoutStringStream = coverageToolProcess.stdout 66 var stdoutStringStream = coverageToolProcess.stdout
69 .transform(new StringDecoder()) 67 .transform(new StringDecoder())
70 .transform(new LineTransformer()); 68 .transform(new LineTransformer());
71 69
72 var stderrStringStream = coverageToolProcess.stderr 70 var stderrStringStream = coverageToolProcess.stderr
73 .transform(new StringDecoder()) 71 .transform(new StringDecoder())
74 .transform(new LineTransformer()); 72 .transform(new LineTransformer());
75 73
76 // Wait for 3 future events: stdout and stderr streams of the coverage 74 // Wait for 3 future events: stdout and stderr streams of the coverage
77 // tool process closed, and coverage tool process terminated. 75 // tool process closed, and coverage tool process terminated.
78 var futures = []; 76 var futures = [];
79 var subscription = stdoutStringStream.listen(onCoverageOutput); 77 var subscription = stdoutStringStream.listen(onCoverageOutput);
80 futures.add(subscription.asFuture(true)); 78 futures.add(subscription.asFuture(true));
81 subscription = stderrStringStream.listen(onCoverageOutput); 79 subscription = stderrStringStream.listen(onCoverageOutput);
82 futures.add(subscription.asFuture(true)); 80 futures.add(subscription.asFuture(true));
83 futures.add(coverageToolProcess.exitCode.then(checkExitCode)); 81 futures.add(coverageToolProcess.exitCode.then(checkExitCode));
84 Future.wait(futures).then((results) { 82 Future.wait(futures).then((results) {
85 checkSuccess(); 83 checkSuccess();
86 if (results.contains(false)) exit(-1); 84 if (results.contains(false)) exit(-1);
87 }); 85 });
88 }); 86 });
89 } 87 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/library_uri_io_test.dart ('k') | tests/standalone/debugger/breakpoint_resolved_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698