Switch flutter_build_apk_health_tests
to use a subset of current tests. (#159004)
Towards https://github.com/flutter/flutter/issues/159000 as part of debugging issues such as https://github.com/flutter/flutter/issues/158560. On a `bringup: true` shard, run a number of `flutter build apk` tests in succession to try and routinely trigger timeouts and crashes, so we can test other hypotheses on how to fix this problem (i.e. potentially around increasing memory, changing daemon configuration, aggressively killing processes, etc).
This commit is contained in:
parent
4d3bbf30c8
commit
ec2ab541dd
@ -236,16 +236,15 @@ Future<void> _runIntegrationToolTests() async {
|
||||
}
|
||||
|
||||
Future<void> _runFlutterBuildApkHealthTests() async {
|
||||
final List<String> allTests = Directory(path.join(_toolsPath, 'test', 'flutter_build_apk.shard'))
|
||||
.listSync(recursive: true).whereType<File>()
|
||||
.map<String>((FileSystemEntity entry) => path.relative(entry.path, from: _toolsPath))
|
||||
.where((String testPath) => path.basename(testPath).endsWith('_test.dart')).toList();
|
||||
|
||||
await runDartTest(
|
||||
_toolsPath,
|
||||
forceSingleCore: true,
|
||||
testPaths: selectIndexOfTotalSubshard<String>(allTests),
|
||||
testPaths: <String>[
|
||||
path.join(_toolsPath, 'test', 'integration.shard'),
|
||||
],
|
||||
collectMetrics: true,
|
||||
runSkipped: true,
|
||||
tags: <String>['flutter-build-apk'],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -342,6 +342,8 @@ Future<void> runDartTest(String workingDirectory, {
|
||||
bool ensurePrecompiledTool = true,
|
||||
bool shuffleTests = true,
|
||||
bool collectMetrics = false,
|
||||
List<String>? tags,
|
||||
bool runSkipped = false,
|
||||
}) async {
|
||||
int? cpus;
|
||||
final String? cpuVariable = Platform.environment['CPU']; // CPU is set in cirrus.yml
|
||||
@ -379,6 +381,10 @@ Future<void> runDartTest(String workingDirectory, {
|
||||
'--coverage=$coverage',
|
||||
if (perTestTimeout != null)
|
||||
'--timeout=${perTestTimeout.inMilliseconds}ms',
|
||||
if (runSkipped)
|
||||
'--run-skipped',
|
||||
if (tags != null)
|
||||
...tags.map((String t) => '--tags=$t'),
|
||||
if (testPaths != null)
|
||||
for (final String testPath in testPaths)
|
||||
testPath,
|
||||
|
@ -1,3 +0,0 @@
|
||||
# `flutter_build_apk.shard`
|
||||
|
||||
Integration tests that debug why `flutter build apk` sometimes stalls on CI.
|
@ -1,87 +0,0 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:io' as io;
|
||||
|
||||
import 'package:file/file.dart';
|
||||
|
||||
import '../integration.shard/test_utils.dart';
|
||||
import '../src/common.dart';
|
||||
|
||||
void main() {
|
||||
final String flutterRoot = getFlutterRoot();
|
||||
final String flutterBin = fileSystem.path.join(flutterRoot, 'bin', 'flutter');
|
||||
|
||||
late Directory tmpDir;
|
||||
|
||||
setUp(() {
|
||||
tmpDir = fileSystem.systemTempDirectory.createTempSync();
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
tryToDelete(tmpDir);
|
||||
});
|
||||
|
||||
Future<void> setGradleLoggingLevel(
|
||||
String level, {
|
||||
required Directory projectDir,
|
||||
}) async {
|
||||
// Open gradle.properties and append to it.
|
||||
final Directory androidDir = projectDir.childDirectory('android');
|
||||
final File gradleDotProperties = androidDir.childFile('gradle.properties');
|
||||
final io.IOSink sink = gradleDotProperties.openWrite(mode: FileMode.append);
|
||||
|
||||
sink.writeln('org.gradle.logging.level=$level');
|
||||
await sink.flush();
|
||||
await sink.close();
|
||||
|
||||
// For debugging, print the current output.
|
||||
io.stderr.writeln('${gradleDotProperties.path}:');
|
||||
io.stderr.writeln(gradleDotProperties.readAsStringSync());
|
||||
}
|
||||
|
||||
// Normally these tests should take about a minute, but sometimes for
|
||||
// unknown reasons they can take 30m+ and timeout. The intent behind this loop
|
||||
// is to get more information on what exactly is happening.
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
test('flutter build apk | attempt $i of 10', () async {
|
||||
final String package = 'flutter_build_apk_test_$i';
|
||||
|
||||
// Create a new Flutter app.
|
||||
await expectLater(
|
||||
processManager.run(
|
||||
<String>[
|
||||
flutterBin,
|
||||
'create',
|
||||
package,
|
||||
],
|
||||
workingDirectory: tmpDir.path,
|
||||
),
|
||||
completion(const ProcessResultMatcher()),
|
||||
reason: 'Should create a new blank Flutter project',
|
||||
);
|
||||
|
||||
// Tweak verbosity of just gradle.
|
||||
final Directory projectDir = tmpDir.childDirectory(package);
|
||||
await setGradleLoggingLevel('debug', projectDir: projectDir);
|
||||
|
||||
// Build the APK.
|
||||
final List<String> args = <String>[
|
||||
flutterBin,
|
||||
'--verbose',
|
||||
'build',
|
||||
'apk',
|
||||
'--debug',
|
||||
];
|
||||
io.stderr.writeln('Running $args...');
|
||||
|
||||
final io.Process process = await processManager.start(
|
||||
args,
|
||||
workingDirectory: projectDir.path,
|
||||
mode: io.ProcessStartMode.inheritStdio,
|
||||
);
|
||||
await expectLater(process.exitCode, completion(0));
|
||||
});
|
||||
}
|
||||
}
|
@ -2,6 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(matanlurey): Remove after debugging https://github.com/flutter/flutter/issues/159000.
|
||||
@Tags(<String>['flutter-build-apk'])
|
||||
library;
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart';
|
||||
|
||||
|
@ -2,6 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(matanlurey): Remove after debugging https://github.com/flutter/flutter/issues/159000.
|
||||
@Tags(<String>['flutter-build-apk'])
|
||||
library;
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:file/file.dart';
|
||||
|
@ -2,6 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(matanlurey): Remove after debugging https://github.com/flutter/flutter/issues/159000.
|
||||
@Tags(<String>['flutter-build-apk'])
|
||||
library;
|
||||
|
||||
// This test can be removed once https://github.com/flutter/flutter/issues/155484 is resolved.
|
||||
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
|
@ -2,6 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(matanlurey): Remove after debugging https://github.com/flutter/flutter/issues/159000.
|
||||
@Tags(<String>['flutter-build-apk'])
|
||||
library;
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
|
@ -2,6 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(matanlurey): Remove after debugging https://github.com/flutter/flutter/issues/159000.
|
||||
@Tags(<String>['flutter-build-apk'])
|
||||
library;
|
||||
|
||||
import 'package:file_testing/file_testing.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart';
|
||||
|
@ -2,6 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(matanlurey): Remove after debugging https://github.com/flutter/flutter/issues/159000.
|
||||
@Tags(<String>['flutter-build-apk'])
|
||||
library;
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart';
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(matanlurey): Remove after debugging https://github.com/flutter/flutter/issues/159000.
|
||||
@Tags(<String>['flutter-build-apk'])
|
||||
@Timeout(Duration(minutes: 10))
|
||||
library;
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
// contain the native assets mapping.
|
||||
// When doing a hot reload, this mapping must stay in place.
|
||||
|
||||
// TODO(matanlurey): Remove after debugging https://github.com/flutter/flutter/issues/159000.
|
||||
@Tags(<String>['flutter-build-apk'])
|
||||
@Timeout(Duration(minutes: 10))
|
||||
library;
|
||||
|
||||
@ -224,6 +226,7 @@ void main() {
|
||||
// TODO(matanlurey): Debug why flutter build apk often timesout.
|
||||
// See https://github.com/flutter/flutter/issues/158560 for details.
|
||||
skip: buildSubcommand == 'apk' ? 'flutter build apk times out' : false, // Temporary workaround for https://github.com/flutter/flutter/issues/158560.
|
||||
tags: <String>['flutter-build-apk'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(matanlurey): Remove after debugging https://github.com/flutter/flutter/issues/159000.
|
||||
@Tags(<String>['flutter-build-apk'])
|
||||
library;
|
||||
|
||||
import 'dart:io' as io;
|
||||
|
||||
import 'package:file/file.dart';
|
||||
@ -143,6 +147,7 @@ void main(List<String> args) async {
|
||||
// TODO(matanlurey): Debug why flutter build apk often timesout.
|
||||
// See https://github.com/flutter/flutter/issues/158560 for details.
|
||||
skip: buildCommand == 'apk' ? 'flutter build apk times out' : false, // Temporary workaround for https://github.com/flutter/flutter/issues/158560.
|
||||
tags: <String>['flutter-build-apk'],
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user