Skip to content

Commit 99861b0

Browse files
authored
[web] fix --ab option for web benchmarks (#154574)
Fix the `--ab` option in the benchmark harness: - Make `--local-engine-host` optional. The web engine doesn't need it, so it doesn't build it. But the tool crashes by failing to find it. - Disable icon tree shaking because `--ab` runs against local engine build, whose Dart kernel version is out of sync with the framework, which crashes the const finder.
1 parent cfa3b08 commit 99861b0

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

dev/devicelab/bin/run.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ Future<void> main(List<String> rawArgs) async {
9999
stderr.writeln(argParser.usage);
100100
exit(1);
101101
}
102-
if (localEngineHost == null) {
103-
stderr.writeln('When running in A/B test mode --local-engine-host is required.\n');
102+
if (localWebSdk == null && localEngineHost == null) {
103+
stderr.writeln('When running in A/B test mode for mobile --local-engine-host is required.\n');
104104
stderr.writeln(argParser.usage);
105105
exit(1);
106106
}
@@ -137,7 +137,7 @@ Future<void> _runABTest({
137137
required int runsPerTest,
138138
required bool silent,
139139
required String? localEngine,
140-
required String localEngineHost,
140+
required String? localEngineHost,
141141
required String? localWebSdk,
142142
required String? localEngineSrcPath,
143143
required String? deviceId,

dev/devicelab/lib/framework/ab.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ class ABTest {
3232

3333
ABTest.fromJsonMap(Map<String, dynamic> jsonResults)
3434
: localEngine = jsonResults[kLocalEngineKeyName] as String,
35-
localEngineHost = jsonResults[kLocalEngineHostKeyName] as String,
35+
localEngineHost = jsonResults[kLocalEngineHostKeyName] as String?,
3636
taskName = jsonResults[kTaskNameKeyName] as String,
3737
runStart = DateTime.parse(jsonResults[kRunStartKeyName] as String),
3838
_runEnd = DateTime.parse(jsonResults[kRunEndKeyName] as String),
3939
_aResults = _convertFrom(jsonResults[kAResultsKeyName] as Map<String, dynamic>),
4040
_bResults = _convertFrom(jsonResults[kBResultsKeyName] as Map<String, dynamic>);
4141

4242
final String localEngine;
43-
final String localEngineHost;
43+
final String? localEngineHost;
4444
final String taskName;
4545
final DateTime runStart;
4646
DateTime? _runEnd;
@@ -89,7 +89,8 @@ class ABTest {
8989
kBenchmarkTypeKeyName: kBenchmarkResultsType,
9090
kBenchmarkVersionKeyName: kBenchmarkABVersion,
9191
kLocalEngineKeyName: localEngine,
92-
kLocalEngineHostKeyName: localEngineHost,
92+
if (localEngineHost != null)
93+
kLocalEngineHostKeyName: localEngineHost,
9394
kTaskNameKeyName: taskName,
9495
kRunStartKeyName: runStart.toIso8601String(),
9596
kRunEndKeyName: runEnd!.toIso8601String(),

dev/devicelab/lib/tasks/web_benchmarks.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Future<TaskResult> runWebBenchmark(WebBenchmarkOptions benchmarkOptions) async {
3434
await flutter('clean');
3535
await evalFlutter('build', options: <String>[
3636
'web',
37+
'--no-tree-shake-icons', // local engine builds are frequently out of sync with the Dart Kernel version
3738
if (benchmarkOptions.useWasm) ...<String>[
3839
'-O4',
3940
'--wasm',

0 commit comments

Comments
 (0)