Start logger in startProgress to avoid assertion failure (#20814)
* Start logger in startProgress to avoid assertion failure There are lots of places that create a Status() and all but two of them call ..start() immediately. This is one of the places that doesn't, which causes an assertion failure when running with --enable-asserts and the other is in the same file (I suspect it's also incorrect, but possibly it's never used - I'll look at that separately when I can trace some code that calls it). Fixes #20812. * Enable asserts for tools tests * Fix lint * Rename enableAsserts -> enableFlutterToolAsserts To make it clearer that it only enables asserts for flutter_tools when set.
This commit is contained in:
@@ -294,7 +294,10 @@ Future<Null> _runSmokeTests() async {
|
||||
Future<Null> _runToolTests() async {
|
||||
await _runSmokeTests();
|
||||
|
||||
await _pubRunTest(path.join(flutterRoot, 'packages', 'flutter_tools'));
|
||||
await _pubRunTest(
|
||||
path.join(flutterRoot, 'packages', 'flutter_tools'),
|
||||
enableFlutterToolAsserts: true,
|
||||
);
|
||||
|
||||
print('${bold}DONE: All tests successful.$reset');
|
||||
}
|
||||
@@ -346,6 +349,7 @@ Future<Null> _runCoverage() async {
|
||||
Future<Null> _pubRunTest(
|
||||
String workingDirectory, {
|
||||
String testPath,
|
||||
bool enableFlutterToolAsserts = false
|
||||
}) {
|
||||
final List<String> args = <String>['run', 'test', '-j1', '-rcompact'];
|
||||
if (!hasColor)
|
||||
@@ -356,6 +360,14 @@ Future<Null> _pubRunTest(
|
||||
if (new Directory(pubCache).existsSync()) {
|
||||
pubEnvironment['PUB_CACHE'] = pubCache;
|
||||
}
|
||||
if (enableFlutterToolAsserts) {
|
||||
// If an existing env variable exists append to it, but only if
|
||||
// it doesn't appear to already include enable-asserts.
|
||||
String toolsArgs = Platform.environment['FLUTTER_TOOL_ARGS'] ?? '';
|
||||
if (!toolsArgs.contains('--enable-asserts'))
|
||||
toolsArgs += ' --enable-asserts';
|
||||
pubEnvironment['FLUTTER_TOOL_ARGS'] = toolsArgs.trim();
|
||||
}
|
||||
return _runCommand(
|
||||
pub, args,
|
||||
workingDirectory: workingDirectory,
|
||||
|
||||
@@ -908,7 +908,7 @@ class _AppRunLogger extends Logger {
|
||||
'progressId': progressId,
|
||||
'finished': true
|
||||
});
|
||||
});
|
||||
})..start();
|
||||
return _status;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user