Shard web tests; enable semantics tests on the Web (#42203)

Shard web tests; enable semantics tests on the Web
This commit is contained in:
Yegor
2019-10-10 07:04:38 -07:00
committed by GitHub
parent 991153ada0
commit 9cd9680b5e
2 changed files with 44 additions and 4 deletions

View File

@@ -445,7 +445,6 @@ Future<void> _runWebTests() async {
'test/material',
'test/painting',
'test/rendering',
'test/semantics',
'test/widgets',
];
@@ -686,10 +685,16 @@ class EvalResult {
final int exitCode;
}
/// The number of Cirrus jobs that run web tests in parallel.
///
/// WARNING: if you change this number, also change .cirrus.yml
/// and make sure it runs _all_ shards.
const int _kWebShardCount = 3;
Future<void> _runFlutterWebTest(String workingDirectory, {
List<String> tests,
}) async {
final List<String> allTests = <String>[];
List<String> allTests = <String>[];
for (String testDirPath in tests) {
final Directory testDir = Directory(path.join(workingDirectory, testDirPath));
allTests.addAll(
@@ -699,6 +704,20 @@ Future<void> _runFlutterWebTest(String workingDirectory, {
.map((File file) => path.relative(file.path, from: workingDirectory))
);
}
// If a shard is specified only run tests in that shard.
final int webShard = int.tryParse(Platform.environment['WEB_SHARD'] ?? 'n/a');
if (webShard != null) {
if (webShard >= _kWebShardCount) {
throw 'WEB_SHARD must be <= _kWebShardCount, but was $webShard';
}
final List<String> shard = <String>[];
for (int i = webShard; i < allTests.length; i += _kWebShardCount) {
shard.add(allTests[i]);
}
allTests = shard;
}
print(allTests.join('\n'));
print('${allTests.length} tests total');