Skip to content

Commit

Permalink
switch tool tests to build runner (flutter#28759)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahwilliams committed Mar 2, 2019
1 parent 778e95a commit d91cfff
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion dev/bots/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ Future<void> _runSmokeTests() async {
Future<void> _runToolTests() async {
await _runSmokeTests();

await _pubRunTest(
await _buildRunnerTest(
path.join(flutterRoot, 'packages', 'flutter_tools'),
flutterRoot,
enableFlutterToolAsserts: true,
);

Expand Down Expand Up @@ -306,6 +307,41 @@ Future<void> _runCoverage() async {
print('${bold}DONE: Coverage collection successful.$reset');
}

Future<void> _buildRunnerTest(
String workingDirectory,
String flutterRoot, {
String testPath,
bool enableFlutterToolAsserts = false,
}
) {
final List<String> args = <String>['run', 'build_runner', 'test', '--', '-rcompact', '-j1'];
if (!hasColor) {
args.add('--no-color');
}
if (testPath != null) {
args.add(testPath);
}
final Map<String, String> pubEnvironment = <String, String>{
'FLUTTER_ROOT': flutterRoot,
};
if (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,
environment: pubEnvironment,
);
}

Future<void> _pubRunTest(
String workingDirectory, {
String testPath,
Expand Down

0 comments on commit d91cfff

Please sign in to comment.