Skip to content

Commit 99144ed

Browse files
karlklosecommit-bot@chromium.org
authored andcommitted
[infra] Remove support for approvals from compare_results
Change-Id: I41d80e8d21da0e272c0410f6f1d1e943bf4ae2d8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152640 Reviewed-by: William Hesse <[email protected]> Commit-Queue: Karl Klose <[email protected]>
1 parent 98324c9 commit 99144ed

File tree

1 file changed

+20
-78
lines changed

1 file changed

+20
-78
lines changed

tools/bots/compare_results.dart

Lines changed: 20 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,14 @@ class Result {
4040
class Event {
4141
final Result before;
4242
final Result after;
43-
final Result approved;
4443

45-
Event(this.before, this.after, this.approved);
44+
Event(this.before, this.after);
4645

4746
bool get isNew => before == null;
4847
bool get isNewPassing => before == null && after.matches;
4948
bool get isNewFailing => before == null && !after.matches;
5049
bool get changed => !unchanged;
5150
bool get unchanged => before != null && before.outcome == after.outcome;
52-
bool get isApproved => approved != null && approved.outcome == after.outcome;
53-
bool get isUnapproved => !isApproved;
5451
bool get remainedPassing => before.matches && after.matches;
5552
bool get remainedFailing => !before.matches && !after.matches;
5653
bool get flaked => after.flaked;
@@ -81,7 +78,6 @@ bool firstSection = true;
8178
bool search(
8279
String description,
8380
String searchForStatus,
84-
String searchForApproval,
8581
List<Event> events,
8682
ArgResults options,
8783
Map<String, Map<String, dynamic>> logs,
@@ -103,12 +99,6 @@ bool search(
10399
(event.after.flaked || event.after.matches)) {
104100
continue;
105101
}
106-
if (searchForApproval == "approved" && !event.isApproved) {
107-
continue;
108-
}
109-
if (searchForApproval == "unapproved" && !event.isUnapproved) {
110-
continue;
111-
}
112102
if (options["unchanged"] && !event.unchanged) continue;
113103
if (options["changed"] && !event.changed) continue;
114104
if (!beganSection) {
@@ -177,8 +167,6 @@ bool search(
177167

178168
main(List<String> args) async {
179169
final parser = new ArgParser();
180-
parser.addFlag("approved",
181-
abbr: 'A', negatable: false, help: "Show approved tests.");
182170
parser.addFlag("changed",
183171
abbr: 'c',
184172
negatable: false,
@@ -197,14 +185,9 @@ main(List<String> args) async {
197185
parser.addFlag("flaky",
198186
abbr: 'F', negatable: false, help: "Show flaky tests.");
199187
parser.addFlag("help", help: "Show the program usage.", negatable: false);
200-
parser.addFlag("human",
201-
abbr: "h",
202-
help: "Prove you can't read machine readable output.",
203-
negatable: false);
188+
parser.addFlag("human", abbr: "h", negatable: false);
204189
parser.addFlag("passing",
205190
abbr: 'p', negatable: false, help: "Show passing tests.");
206-
parser.addFlag("unapproved",
207-
abbr: 'U', negatable: false, help: "Show unapproved tests.");
208191
parser.addFlag("unchanged",
209192
abbr: 'u',
210193
negatable: false,
@@ -222,9 +205,8 @@ main(List<String> args) async {
222205
final options = parser.parse(args);
223206
if (options["help"]) {
224207
print("""
225-
Usage: compare_results.dart [OPTION]... BEFORE AFTER [APPROVED]
208+
Usage: compare_results.dart [OPTION]... BEFORE AFTER
226209
Compare the old and new test results and list tests that pass the filters.
227-
Three-way compare with the approved results if provided.
228210
All tests are listed if no filters are given.
229211
230212
The options are as follows:
@@ -241,19 +223,16 @@ ${parser.usage}""");
241223
}
242224

243225
final parameters = options.rest;
244-
if (parameters.length != 2 && parameters.length != 3) {
245-
print("error: Expected two or three parameters "
246-
"(results before, results after, and (optionally) approved results)");
226+
if (parameters.length != 2) {
227+
print("error: Expected two parameters "
228+
"(results before, results after)");
247229
exitCode = 2;
248230
return;
249231
}
250232

251233
// Load the input and the flakiness data if specified.
252234
final before = await loadResultsMap(parameters[0]);
253235
final after = await loadResultsMap(parameters[1]);
254-
final approved = 3 <= parameters.length
255-
? await loadResultsMap(parameters[2])
256-
: <String, Map<String, dynamic>>{};
257236
final logs = options['logs'] == null
258237
? <String, Map<String, dynamic>>{}
259238
: await loadResultsMap(options['logs']);
@@ -268,15 +247,11 @@ ${parser.usage}""");
268247
for (final name in names) {
269248
final mapBefore = before[name];
270249
final mapAfter = after[name];
271-
final mapApproved = approved[name];
272250
final resultBefore = mapBefore != null
273251
? new Result.fromMap(mapBefore, flakinessData[name])
274252
: null;
275253
final resultAfter = new Result.fromMap(mapAfter, flakinessData[name]);
276-
final resultApproved = mapApproved != null && mapApproved["result"] != null
277-
? new Result.fromMap(mapApproved, flakinessData[name])
278-
: null;
279-
final event = new Event(resultBefore, resultAfter, resultApproved);
254+
final event = new Event(resultBefore, resultAfter);
280255
events.add(event);
281256
}
282257

@@ -306,57 +281,24 @@ ${parser.usage}""");
306281
final searchForStatuses =
307282
["passing", "flaky", "failing"].where((option) => options[option]);
308283

309-
final approvalDescriptions = {
310-
"passing": {
311-
"approved": " (approved)",
312-
"unapproved": " (should be approved)",
313-
null: "",
314-
},
315-
"flaky": {
316-
"approved": " (approved result)",
317-
"unapproved": " (unapproved result)",
318-
null: "",
319-
},
320-
"failing": {
321-
"approved": " (approved)",
322-
"unapproved": " (needs approval)",
323-
null: "",
324-
},
325-
null: {
326-
"approved": " (approved)",
327-
"unapproved": " (needs approval)",
328-
null: "",
329-
},
330-
};
331-
332-
final searchForApprovals =
333-
["approved", "unapproved"].where((option) => options[option]);
334-
335284
// Report tests matching the filters.
336285
final logSection = <String>[];
337286
bool judgement = false;
338287
for (final searchForStatus
339288
in searchForStatuses.isNotEmpty ? searchForStatuses : <String>[null]) {
340-
for (final searchForApproval in searchForApprovals.isNotEmpty
341-
? searchForApprovals
342-
: <String>[null]) {
343-
final searchForChanged = options["unchanged"]
344-
? "unchanged"
345-
: options["changed"] ? "changed" : null;
346-
final aboutStatus = filterDescriptions[searchForStatus][searchForChanged];
347-
final aboutApproval =
348-
approvalDescriptions[searchForStatus][searchForApproval];
349-
final sectionHeader = "The following tests $aboutStatus$aboutApproval:";
350-
final logSectionArg =
351-
searchForStatus == "failing" || searchForStatus == "flaky"
352-
? logSection
353-
: null;
354-
bool possibleJudgement = search(sectionHeader, searchForStatus,
355-
searchForApproval, events, options, logs, logSectionArg);
356-
if ((searchForStatus == null || searchForStatus == "failing") &&
357-
(searchForApproval == null || searchForApproval == "unapproved")) {
358-
judgement = possibleJudgement;
359-
}
289+
final searchForChanged = options["unchanged"]
290+
? "unchanged"
291+
: options["changed"] ? "changed" : null;
292+
final aboutStatus = filterDescriptions[searchForStatus][searchForChanged];
293+
final sectionHeader = "The following tests $aboutStatus:";
294+
final logSectionArg =
295+
searchForStatus == "failing" || searchForStatus == "flaky"
296+
? logSection
297+
: null;
298+
bool possibleJudgement = search(
299+
sectionHeader, searchForStatus, events, options, logs, logSectionArg);
300+
if ((searchForStatus == null || searchForStatus == "failing")) {
301+
judgement = possibleJudgement;
360302
}
361303
}
362304

0 commit comments

Comments
 (0)