Unverified Commit 27c61eeb authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

Explicitly report CFE output(when using --preview-dart-2) (#13936)

* Explicitly report CFE output(when using --preview-dart-2)

* Fix test so it looks at errorText

* Fix expected text
parent 467daba4
...@@ -45,7 +45,7 @@ class _StdoutHandler { ...@@ -45,7 +45,7 @@ class _StdoutHandler {
? string.substring(boundaryKey.length + 1) ? string.substring(boundaryKey.length + 1)
: null); : null);
else else
printTrace('compile debug message: $string'); printError('compiler message: $string');
} }
// This is needed to get ready to process next compilation result output, // This is needed to get ready to process next compilation result output,
...@@ -98,14 +98,14 @@ Future<String> compile( ...@@ -98,14 +98,14 @@ Future<String> compile(
final Process server = await processManager final Process server = await processManager
.start(command) .start(command)
.catchError((dynamic error, StackTrace stack) { .catchError((dynamic error, StackTrace stack) {
printTrace('Failed to start frontend server $error, $stack'); printError('Failed to start frontend server $error, $stack');
}); });
final _StdoutHandler stdoutHandler = new _StdoutHandler(); final _StdoutHandler stdoutHandler = new _StdoutHandler();
server.stderr server.stderr
.transform(UTF8.decoder) .transform(UTF8.decoder)
.listen((String s) { printTrace('compile debug message: $s'); }); .listen((String s) { printError('compiler message: $s'); });
server.stdout server.stdout
.transform(UTF8.decoder) .transform(UTF8.decoder)
.transform(const LineSplitter()) .transform(const LineSplitter())
...@@ -171,7 +171,7 @@ class ResidentCompiler { ...@@ -171,7 +171,7 @@ class ResidentCompiler {
_server.stderr _server.stderr
.transform(UTF8.decoder) .transform(UTF8.decoder)
.transform(const LineSplitter()) .transform(const LineSplitter())
.listen((String s) { printTrace('compile debug message: $s'); }); .listen((String s) { printError('compiler message: $s'); });
_server.stdin.writeln('compile $scriptFilename'); _server.stdin.writeln('compile $scriptFilename');
......
...@@ -49,7 +49,7 @@ void main() { ...@@ -49,7 +49,7 @@ void main() {
mainPath: '/path/to/main.dart' mainPath: '/path/to/main.dart'
); );
expect(mockFrontendServerStdIn.getAndClear(), isEmpty); expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
expect(logger.traceText, equals('compile debug message: line1\ncompile debug message: line2\n')); expect(logger.errorText, equals('compiler message: line1\ncompiler message: line2\n'));
expect(output, equals('/path/to/main.dart.dill')); expect(output, equals('/path/to/main.dart.dill'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
...@@ -69,7 +69,7 @@ void main() { ...@@ -69,7 +69,7 @@ void main() {
mainPath: '/path/to/main.dart' mainPath: '/path/to/main.dart'
); );
expect(mockFrontendServerStdIn.getAndClear(), isEmpty); expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
expect(logger.traceText, equals('compile debug message: line1\ncompile debug message: line2\n')); expect(logger.errorText, equals('compiler message: line1\ncompiler message: line2\n'));
expect(output, equals(null)); expect(output, equals(null));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
...@@ -119,7 +119,7 @@ void main() { ...@@ -119,7 +119,7 @@ void main() {
); );
expect(mockFrontendServerStdIn.getAndClear(), 'compile /path/to/main.dart\n'); expect(mockFrontendServerStdIn.getAndClear(), 'compile /path/to/main.dart\n');
verifyNoMoreInteractions(mockFrontendServerStdIn); verifyNoMoreInteractions(mockFrontendServerStdIn);
expect(logger.traceText, equals('compile debug message: line1\ncompile debug message: line2\n')); expect(logger.errorText, equals('compiler message: line1\ncompiler message: line2\n'));
expect(output, equals('/path/to/main.dart.dill')); expect(output, equals('/path/to/main.dart.dill'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
...@@ -140,9 +140,9 @@ void main() { ...@@ -140,9 +140,9 @@ void main() {
verifyNoMoreInteractions(mockFrontendServerStdIn); verifyNoMoreInteractions(mockFrontendServerStdIn);
expect(mockFrontendServerStdIn.getAndClear(), isEmpty); expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
expect(logger.traceText, equals( expect(logger.errorText, equals(
'compile debug message: line0\ncompile debug message: line1\n' 'compiler message: line0\ncompiler message: line1\n'
'compile debug message: line1\ncompile debug message: line2\n' 'compiler message: line1\ncompiler message: line2\n'
)); ));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
...@@ -167,10 +167,10 @@ void main() { ...@@ -167,10 +167,10 @@ void main() {
verifyNoMoreInteractions(mockFrontendServerStdIn); verifyNoMoreInteractions(mockFrontendServerStdIn);
expect(mockFrontendServerStdIn.getAndClear(), isEmpty); expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
expect(logger.traceText, equals( expect(logger.errorText, equals(
'compile debug message: line0\ncompile debug message: line1\n' 'compiler message: line0\ncompiler message: line1\n'
'compile debug message: line1\ncompile debug message: line2\n' 'compiler message: line1\ncompiler message: line2\n'
'compile debug message: line2\ncompile debug message: line3\n' 'compiler message: line2\ncompiler message: line3\n'
)); ));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment