From 9cd9680b5e58857584adb817301ff807f1a05f4a Mon Sep 17 00:00:00 2001 From: Yegor Date: Thu, 10 Oct 2019 07:04:38 -0700 Subject: [PATCH] Shard web tests; enable semantics tests on the Web (#42203) Shard web tests; enable semantics tests on the Web --- .cirrus.yml | 25 +++++++++++++++++++++++-- dev/bots/test.dart | 23 +++++++++++++++++++++-- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 3cd9ad8752..eb5ad4c242 100644 --- a/.cirrus.yml +++ b/.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: diff --git a/dev/bots/test.dart b/dev/bots/test.dart index 9d0d28f995..6ba5ef13f7 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -445,7 +445,6 @@ Future _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 _runFlutterWebTest(String workingDirectory, { List tests, }) async { - final List allTests = []; + List allTests = []; for (String testDirPath in tests) { final Directory testDir = Directory(path.join(workingDirectory, testDirPath)); allTests.addAll( @@ -699,6 +704,20 @@ Future _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 shard = []; + for (int i = webShard; i < allTests.length; i += _kWebShardCount) { + shard.add(allTests[i]); + } + allTests = shard; + } + print(allTests.join('\n')); print('${allTests.length} tests total');