Run "pub global activate devtools" before overall_experience_test (#85812)

This commit is contained in:
Ian Hickson
2021-07-12 14:36:05 -07:00
committed by GitHub
parent 3eca034ffd
commit d3c17acf9d
11 changed files with 131 additions and 69 deletions

View File

@@ -129,7 +129,7 @@ Future<Command> startCommand(String executable, List<String> arguments, {
switch (outputMode) {
case OutputMode.print:
stdoutSource.listen(io.stdout.add);
process.stderr.listen(io.stderr.add);
process.stderr.listen(io.stdout.add);
break;
case OutputMode.capture:
savedStdout = stdoutSource.toList();
@@ -190,7 +190,7 @@ Future<CommandResult> runCommand(String executable, List<String> arguments, {
break;
case OutputMode.capture:
io.stdout.writeln(result.flattenedStdout);
io.stderr.writeln(result.flattenedStderr);
io.stdout.writeln(result.flattenedStderr);
break;
}
exitWithError(<String>[
@@ -213,7 +213,7 @@ String _flattenToString(List<List<int>> chunks) =>
/// Specifies what to do with the command output from [runCommand] and [startCommand].
enum OutputMode {
/// Forwards standard output and standard error streams to the test process'
/// respective standard streams.
/// standard output stream (i.e. stderr is redirected to stdout).
///
/// Use this mode if all you want is print the output of the command to the
/// console. The output is no longer available after the process exits.

View File

@@ -302,6 +302,25 @@ Future<void> _runIntegrationToolTests() async {
.map<String>((FileSystemEntity entry) => path.relative(entry.path, from: toolsPath))
.where((String testPath) => path.basename(testPath).endsWith('_test.dart')).toList();
// Make sure devtools is ready first, because that might take a while and we don't
// want any of the tests to time out while they themselves try to activate devtools.
final Map<String, String> pubEnvironment = <String, String>{
'FLUTTER_ROOT': flutterRoot,
};
if (Directory(pubCache).existsSync()) {
pubEnvironment['PUB_CACHE'] = pubCache;
}
await runCommand(
pub,
<String>[
'global',
'activate',
'devtools',
File(path.join(flutterRoot, 'bin', 'internal', 'devtools.version')).readAsStringSync(),
],
environment: pubEnvironment,
);
await _pubRunTest(
toolsPath,
forceSingleCore: true,
@@ -703,7 +722,7 @@ Future<void> _runFrameworkTests() async {
Future<void> runMisc() async {
print('${green}Running package tests$reset for directories other than packages/flutter');
await _pubRunTest(path.join(flutterRoot, 'dev', 'bots'));
await _pubRunTest(path.join(flutterRoot, 'dev', 'devicelab'));
await _pubRunTest(path.join(flutterRoot, 'dev', 'devicelab'), ensurePrecompiledTool: false);
await _pubRunTest(path.join(flutterRoot, 'dev', 'snippets'));
// TODO(fujino): Move this to its own test shard
await _pubRunTest(path.join(flutterRoot, 'dev', 'conductor'), forceSingleCore: true);
@@ -1417,6 +1436,7 @@ Future<void> _pubRunTest(String workingDirectory, {
bool forceSingleCore = false,
Duration perTestTimeout,
bool includeLocalEngineEnv = false,
bool ensurePrecompiledTool = true,
}) async {
int cpus;
final String cpuVariable = Platform.environment['CPU']; // CPU is set in cirrus.yml
@@ -1473,6 +1493,12 @@ Future<void> _pubRunTest(String workingDirectory, {
deleteFile(path.join(flutterRoot, 'bin', 'cache', 'flutter_tools.snapshot'));
deleteFile(path.join(flutterRoot, 'bin', 'cache', 'flutter_tools.stamp'));
}
if (ensurePrecompiledTool) {
// We rerun the `flutter` tool here just to make sure that it is compiled
// before tests run, because the tests might time out if they have to rebuild
// the tool themselves.
await runCommand(flutter, <String>['--version'], environment: pubEnvironment);
}
if (useFlutterTestFormatter) {
final FlutterCompactFormatter formatter = FlutterCompactFormatter();
Stream<String> testOutput;