Skip to content

Commit d5086e4

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Check that --flutter-repository is absolute and normalized, rename shorter.
Change-Id: I737dd5ea5ba83124b308f979bff50ed15cefcdf8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220063 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 2001b00 commit d5086e4

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

pkg/analysis_server/benchmark/benchmarks.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,14 @@ class RunCommand extends Command {
241241

242242
if (benchmark is FlutterBenchmark) {
243243
if (flutterRepository != null) {
244-
(benchmark as FlutterBenchmark).flutterRepositoryPath =
245-
flutterRepository;
244+
if (path.isAbsolute(flutterRepository) &&
245+
path.normalize(flutterRepository) == flutterRepository) {
246+
(benchmark as FlutterBenchmark).flutterRepositoryPath =
247+
flutterRepository;
248+
} else {
249+
print('The path must be absolute and normalized: $flutterRepository');
250+
exit(1);
251+
}
246252
} else {
247253
print('The option --flutter-repository is required to '
248254
"run '$benchmarkId'.");

pkg/analysis_server/benchmark/perf/flutter_completion_benchmark.dart

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,18 @@ class FlutterCompletionBenchmark extends Benchmark implements FlutterBenchmark {
7777
// time analyzing, and do apply the filter.
7878
// Total number of suggestions: 2322.
7979
// Filtered to: 82.
80+
// Long name: completion-smallFile-body
81+
var name = 'completion-1';
8082
result.add(
81-
'completion-smallFile-body',
83+
name,
8284
BenchMarkResult(
8385
'micros',
8486
await _completionTiming(
8587
test,
8688
filePath: '$flutterPkgPath/lib/src/material/flutter_logo.dart',
8789
uniquePrefix: 'Widget build(BuildContext context) {',
8890
insertStringGenerator: () => 'M',
89-
name: 'completion-smallFile-body',
91+
name: name,
9092
),
9193
),
9294
);
@@ -98,16 +100,18 @@ class FlutterCompletionBenchmark extends Benchmark implements FlutterBenchmark {
98100
// JSON in the server, and deserializing on the client.
99101
// Total number of suggestions: 2322.
100102
// Filtered to: 2322.
103+
// Long name: completion-smallFile-body-withoutPrefix
104+
name = 'completion-2';
101105
result.add(
102-
'completion-smallFile-body-withoutPrefix',
106+
name,
103107
BenchMarkResult(
104108
'micros',
105109
await _completionTiming(
106110
test,
107111
filePath: '$flutterPkgPath/lib/src/material/flutter_logo.dart',
108112
uniquePrefix: 'Widget build(BuildContext context) {',
109113
insertStringGenerator: null,
110-
name: 'completion-smallFile-body-withoutPrefix',
114+
name: name,
111115
),
112116
),
113117
);
@@ -118,16 +122,18 @@ class FlutterCompletionBenchmark extends Benchmark implements FlutterBenchmark {
118122
// The target method body is small, so something could be optimized.
119123
// Total number of suggestions: 4654.
120124
// Filtered to: 182.
125+
// Long name: completion-smallLibraryCycle-largeFile-smallBody
126+
name = 'completion-3';
121127
result.add(
122-
'completion-smallLibraryCycle-largeFile-smallBody',
128+
name,
123129
BenchMarkResult(
124130
'micros',
125131
await _completionTiming(
126132
test,
127133
filePath: '$flutterPkgPath/test/material/text_field_test.dart',
128134
uniquePrefix: 'getOpacity(WidgetTester tester, Finder finder) {',
129135
insertStringGenerator: () => 'M',
130-
name: 'completion-smallLibraryCycle-largeFile-smallBody',
136+
name: name,
131137
),
132138
),
133139
);
@@ -143,16 +149,18 @@ class FlutterCompletionBenchmark extends Benchmark implements FlutterBenchmark {
143149
// TODO(scheglov) Remove the previous sentence when improved.
144150
// Total number of suggestions: 3429.
145151
// Filtered to: 133.
152+
// Long name: completion-mediumLibraryCycle-mediumFile-smallBody
153+
name = 'completion-4';
146154
result.add(
147-
'completion-mediumLibraryCycle-mediumFile-smallBody',
155+
name,
148156
BenchMarkResult(
149157
'micros',
150158
await _completionTiming(
151159
test,
152160
filePath: '$flutterPkgPath/lib/src/material/app_bar.dart',
153161
uniquePrefix: 'computeDryLayout(BoxConstraints constraints) {',
154162
insertStringGenerator: () => 'M',
155-
name: 'completion-mediumLibraryCycle-mediumFile-smallBody',
163+
name: name,
156164
),
157165
),
158166
);
@@ -163,16 +171,18 @@ class FlutterCompletionBenchmark extends Benchmark implements FlutterBenchmark {
163171
// cycle. This is expensive.
164172
// Total number of suggestions: 1510.
165173
// Filtered to: 0.
174+
// Long name: completion-mediumLibraryCycle-mediumFile-api-parameterType
175+
name = 'completion-5';
166176
result.add(
167-
'completion-mediumLibraryCycle-mediumFile-api-parameterType',
177+
name,
168178
BenchMarkResult(
169179
'micros',
170180
await _completionTiming(
171181
test,
172182
filePath: '$flutterPkgPath/lib/src/material/app_bar.dart',
173183
uniquePrefix: 'computeDryLayout(BoxConstraints',
174184
insertStringGenerator: _IncrementingStringGenerator(),
175-
name: 'completion-mediumLibraryCycle-mediumFile-api-parameterType',
185+
name: name,
176186
),
177187
),
178188
);

0 commit comments

Comments
 (0)