[dart2js] Split deferred_load_id_map tests into 3 shards to avoid timeouts.

Change-Id: I9cf3665be8df64ee80a9890747398faa49cfa79f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362680
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
This commit is contained in:
Nate Biggs 2024-04-12 21:50:39 +00:00 committed by Commit Queue
parent aa4aa6975d
commit 8e275a4c6d
7 changed files with 54 additions and 7 deletions

View file

@ -1,9 +1,9 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'deferred_load_id_map_helper.dart';
main(List<String> args) {
mainHelper('base', const [], args);
mainHelper('base', 0, const [], args);
}

View file

@ -0,0 +1,9 @@
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'deferred_load_id_map_helper.dart';
main(List<String> args) {
mainHelper('base', 1, const [], args);
}

View file

@ -0,0 +1,9 @@
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'deferred_load_id_map_helper.dart';
main(List<String> args) {
mainHelper('base', 2, const [], args);
}

View file

@ -14,21 +14,27 @@ import 'package:expect/expect.dart';
const resultFilename = 'deferred.data';
const cfeFilename = 'cfe.dill';
void mainHelper(String testGroup, List<String> flags, List<String> args) {
const shardCount = 3;
void mainHelper(
String testGroup, int shard, List<String> flags, List<String> args) {
if (shard < 0 || shard > shardCount) throw 'Invalid shard $shard.';
final generateGoldens = args.contains('-g');
asyncTest(() async {
await runTest(testGroup, flags, generateGoldens: generateGoldens);
await runTest(testGroup, shard, flags, generateGoldens: generateGoldens);
});
}
Future<void> runTest(String testGroup, List<String> options,
Future<void> runTest(String testGroup, int shard, List<String> options,
{required bool generateGoldens}) async {
Directory dataDir = Directory.fromUri(Platform.script.resolve('data'));
Directory goldensDir = Directory.fromUri(
Platform.script.resolve('load_id_map_goldens/').resolve(testGroup));
final goldenFiles = goldensDir.listSync();
int counter = 0;
for (final testDir in dataDir.listSync()) {
if (testDir is! Directory) continue;
if (counter++ % shardCount != shard) continue;
final testName = testDir.uri.pathSegments.lastWhere((s) => s.isNotEmpty);
print('-- Testing deferred load id map for: $testName ($testGroup) --');
late Compiler compiler;
@ -57,6 +63,7 @@ Future<void> runTest(String testGroup, List<String> options,
options: [
'${Flags.stage}=deferred-load-ids',
'${Flags.deferredLoadIdMapUri}=$resultFilename',
'${Flags.stage}=deferred-load-ids',
'--input-dill=memory:$cfeFilename',
...options,
],

View file

@ -1,4 +1,4 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@ -7,5 +7,5 @@ import 'package:compiler/src/commandline_options.dart';
import 'deferred_load_id_map_helper.dart';
main(List<String> args) {
mainHelper('simple_ids', [Flags.useSimpleLoadIds], args);
mainHelper('simple_ids', 0, const [Flags.useSimpleLoadIds], args);
}

View file

@ -0,0 +1,11 @@
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:compiler/src/commandline_options.dart';
import 'deferred_load_id_map_helper.dart';
main(List<String> args) {
mainHelper('simple_ids', 1, const [Flags.useSimpleLoadIds], args);
}

View file

@ -0,0 +1,11 @@
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:compiler/src/commandline_options.dart';
import 'deferred_load_id_map_helper.dart';
main(List<String> args) {
mainHelper('simple_ids', 2, const [Flags.useSimpleLoadIds], args);
}