Shard web tests; enable semantics tests on the Web (#42203)
Shard web tests; enable semantics tests on the Web
This commit is contained in:
25
.cirrus.yml
25
.cirrus.yml
@@ -152,10 +152,31 @@ task:
|
||||
container:
|
||||
cpu: 8
|
||||
memory: 24G
|
||||
- name: web_tests-linux
|
||||
allow_failures: true
|
||||
- name: web_tests-linux-shard-0
|
||||
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true'
|
||||
env:
|
||||
SHARD: web_tests
|
||||
WEB_SHARD: 0
|
||||
test_script:
|
||||
- dart --enable-asserts ./dev/bots/test.dart
|
||||
container:
|
||||
cpu: 4
|
||||
memory: 12G
|
||||
- name: web_tests-linux-shard-1
|
||||
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true'
|
||||
env:
|
||||
SHARD: web_tests
|
||||
WEB_SHARD: 1
|
||||
test_script:
|
||||
- dart --enable-asserts ./dev/bots/test.dart
|
||||
container:
|
||||
cpu: 4
|
||||
memory: 12G
|
||||
- name: web_tests-linux-shard-2
|
||||
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true'
|
||||
env:
|
||||
SHARD: web_tests
|
||||
WEB_SHARD: 2
|
||||
test_script:
|
||||
- dart --enable-asserts ./dev/bots/test.dart
|
||||
container:
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user