From 57b0b02e4d7da8c902dc30f81c95dbca8dc325d9 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 14 Nov 2024 16:45:50 -0800 Subject: [PATCH] Try running historically flaky tests first to make `flutter build apk` health tests time out more often? (#158967) I have no idea if this will work, but `6_6` is currently the suite that seems to have the most problems. Towards https://github.com/flutter/flutter/issues/158560. --- dev/bots/test.dart | 19 +++++++++++++++++-- dev/bots/utils.dart | 3 +++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/dev/bots/test.dart b/dev/bots/test.dart index 7073a9f3b0..fc659ea180 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -236,7 +236,8 @@ Future _runIntegrationToolTests() async { } Future _runFlutterBuildApkHealthTests() async { - final List allTests = Directory(path.join(_toolsPath, 'test', 'flutter_build_apk.shard')) + // Try "priming" the test environment by running historically problematic tests first. + final List toolIntegrationTests = Directory(path.join(_toolsPath, 'test', 'integration.shard')) .listSync(recursive: true).whereType() .map((FileSystemEntity entry) => path.relative(entry.path, from: _toolsPath)) .where((String testPath) => path.basename(testPath).endsWith('_test.dart')).toList(); @@ -244,7 +245,21 @@ Future _runFlutterBuildApkHealthTests() async { await runDartTest( _toolsPath, forceSingleCore: true, - testPaths: selectIndexOfTotalSubshard(allTests), + testPaths: selectIndexOfTotalSubshard(toolIntegrationTests, subshardKey: '6_6'), + collectMetrics: true, + runSkipped: true, + ); + + // Then run the health tests after. + final List flutterBuildApkTests = Directory(path.join(_toolsPath, 'test', 'flutter_build_apk.shard')) + .listSync(recursive: true).whereType() + .map((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(flutterBuildApkTests), collectMetrics: true, ); } diff --git a/dev/bots/utils.dart b/dev/bots/utils.dart index be8ab9b028..76832ba17a 100644 --- a/dev/bots/utils.dart +++ b/dev/bots/utils.dart @@ -342,6 +342,7 @@ Future runDartTest(String workingDirectory, { bool ensurePrecompiledTool = true, bool shuffleTests = true, bool collectMetrics = false, + bool runSkipped = false, }) async { int? cpus; final String? cpuVariable = Platform.environment['CPU']; // CPU is set in cirrus.yml @@ -379,6 +380,8 @@ Future runDartTest(String workingDirectory, { '--coverage=$coverage', if (perTestTimeout != null) '--timeout=${perTestTimeout.inMilliseconds}ms', + if (runSkipped) + '--run-skipped', if (testPaths != null) for (final String testPath in testPaths) testPath,