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

Side by Side Diff: test/worker/worker_test.dart

Issue 2176763002: fix #606, allow specifying the summary file extension (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:bazel_worker/bazel_worker.dart'; 9 import 'package:bazel_worker/bazel_worker.dart';
10 // TODO(jakemac): Remove once this is a part of the testing library. 10 // TODO(jakemac): Remove once this is a part of the testing library.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 expect((await futureProcessOutput).join(), isEmpty); 94 expect((await futureProcessOutput).join(), isEmpty);
95 expect(outputJsFile.existsSync(), isTrue); 95 expect(outputJsFile.existsSync(), isTrue);
96 }); 96 });
97 }); 97 });
98 98
99 group('Hello World with Summaries', () { 99 group('Hello World with Summaries', () {
100 final greetingDart = new File('test/worker/greeting.dart').absolute; 100 final greetingDart = new File('test/worker/greeting.dart').absolute;
101 final helloDart = new File('test/worker/hello.dart').absolute; 101 final helloDart = new File('test/worker/hello.dart').absolute;
102 102
103 final greetingJS = new File('test/worker/greeting.js').absolute; 103 final greetingJS = new File('test/worker/greeting.js').absolute;
104 final greetingSummary = new File('test/worker/greeting.sum').absolute; 104 final greetingSummary = new File('test/worker/greeting.api.ds').absolute;
105 final helloJS = new File('test/worker/hello_world.js').absolute; 105 final helloJS = new File('test/worker/hello_world.js').absolute;
106 106
107 setUp(() { 107 setUp(() {
108 greetingDart.writeAsStringSync('String greeting = "hello";'); 108 greetingDart.writeAsStringSync('String greeting = "hello";');
109 helloDart.writeAsStringSync('import "greeting.dart";' 109 helloDart.writeAsStringSync('import "greeting.dart";'
110 'main() => print(greeting);'); 110 'main() => print(greeting);');
111 }); 111 });
112 112
113 tearDown(() { 113 tearDown(() {
114 if (greetingDart.existsSync()) greetingDart.deleteSync(); 114 if (greetingDart.existsSync()) greetingDart.deleteSync();
115 if (helloDart.existsSync()) helloDart.deleteSync(); 115 if (helloDart.existsSync()) helloDart.deleteSync();
116 if (greetingJS.existsSync()) greetingJS.deleteSync(); 116 if (greetingJS.existsSync()) greetingJS.deleteSync();
117 if (greetingSummary.existsSync()) greetingSummary.deleteSync(); 117 if (greetingSummary.existsSync()) greetingSummary.deleteSync();
118 if (helloJS.existsSync()) helloJS.deleteSync(); 118 if (helloJS.existsSync()) helloJS.deleteSync();
119 }); 119 });
120 120
121 test('can compile in basic mode', () { 121 test('can compile in basic mode', () {
122 var result = Process.runSync('dart', [ 122 var result = Process.runSync('dart', [
123 'bin/dartdevc.dart', 123 'bin/dartdevc.dart',
124 'compile', 124 'compile',
125 '--summary-extension=api.ds',
125 '--no-source-map', 126 '--no-source-map',
126 '-o', 127 '-o',
127 greetingJS.path, 128 greetingJS.path,
128 greetingDart.path, 129 greetingDart.path,
129 ]); 130 ]);
130 expect(result.exitCode, EXIT_CODE_OK); 131 expect(result.exitCode, EXIT_CODE_OK);
131 expect(result.stdout, isEmpty); 132 expect(result.stdout, isEmpty);
132 expect(result.stderr, isEmpty); 133 expect(result.stderr, isEmpty);
133 expect(greetingJS.existsSync(), isTrue); 134 expect(greetingJS.existsSync(), isTrue);
134 expect(greetingSummary.existsSync(), isTrue); 135 expect(greetingSummary.existsSync(), isTrue);
135 136
136 result = Process.runSync('dart', [ 137 result = Process.runSync('dart', [
137 'bin/dartdevc.dart', 138 'bin/dartdevc.dart',
138 'compile', 139 'compile',
139 '--no-source-map', 140 '--no-source-map',
140 '--no-summarize', 141 '--no-summarize',
142 '--summary-extension=api.ds',
141 '-s', 143 '-s',
142 greetingSummary.path, 144 greetingSummary.path,
143 '-o', 145 '-o',
144 helloJS.path, 146 helloJS.path,
145 helloDart.path, 147 helloDart.path,
146 ]); 148 ]);
147 expect(result.exitCode, EXIT_CODE_OK); 149 expect(result.exitCode, EXIT_CODE_OK);
148 expect(result.stdout, isEmpty); 150 expect(result.stdout, isEmpty);
149 expect(result.stderr, isEmpty); 151 expect(result.stderr, isEmpty);
150 expect(helloJS.existsSync(), isTrue); 152 expect(helloJS.existsSync(), isTrue);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 Future<WorkResponse> _readResponse(MessageGrouper messageGrouper) async { 265 Future<WorkResponse> _readResponse(MessageGrouper messageGrouper) async {
264 var buffer = (await messageGrouper.next) as List<int>; 266 var buffer = (await messageGrouper.next) as List<int>;
265 try { 267 try {
266 return new WorkResponse.fromBuffer(buffer); 268 return new WorkResponse.fromBuffer(buffer);
267 } catch (_) { 269 } catch (_) {
268 var bufferAsString = 270 var bufferAsString =
269 buffer == null ? '' : 'String: ${UTF8.decode(buffer)}\n'; 271 buffer == null ? '' : 'String: ${UTF8.decode(buffer)}\n';
270 throw 'Failed to parse response:\nbytes: $buffer\n$bufferAsString'; 272 throw 'Failed to parse response:\nbytes: $buffer\n$bufferAsString';
271 } 273 }
272 } 274 }
OLDNEW
« lib/src/compiler/command.dart ('K') | « lib/src/compiler/compiler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698