@@ -40,17 +40,14 @@ class Result {
40
40
class Event {
41
41
final Result before;
42
42
final Result after;
43
- final Result approved;
44
43
45
- Event (this .before, this .after, this .approved );
44
+ Event (this .before, this .after);
46
45
47
46
bool get isNew => before == null ;
48
47
bool get isNewPassing => before == null && after.matches;
49
48
bool get isNewFailing => before == null && ! after.matches;
50
49
bool get changed => ! unchanged;
51
50
bool get unchanged => before != null && before.outcome == after.outcome;
52
- bool get isApproved => approved != null && approved.outcome == after.outcome;
53
- bool get isUnapproved => ! isApproved;
54
51
bool get remainedPassing => before.matches && after.matches;
55
52
bool get remainedFailing => ! before.matches && ! after.matches;
56
53
bool get flaked => after.flaked;
@@ -81,7 +78,6 @@ bool firstSection = true;
81
78
bool search (
82
79
String description,
83
80
String searchForStatus,
84
- String searchForApproval,
85
81
List <Event > events,
86
82
ArgResults options,
87
83
Map <String , Map <String , dynamic >> logs,
@@ -103,12 +99,6 @@ bool search(
103
99
(event.after.flaked || event.after.matches)) {
104
100
continue ;
105
101
}
106
- if (searchForApproval == "approved" && ! event.isApproved) {
107
- continue ;
108
- }
109
- if (searchForApproval == "unapproved" && ! event.isUnapproved) {
110
- continue ;
111
- }
112
102
if (options["unchanged" ] && ! event.unchanged) continue ;
113
103
if (options["changed" ] && ! event.changed) continue ;
114
104
if (! beganSection) {
@@ -177,8 +167,6 @@ bool search(
177
167
178
168
main (List <String > args) async {
179
169
final parser = new ArgParser ();
180
- parser.addFlag ("approved" ,
181
- abbr: 'A' , negatable: false , help: "Show approved tests." );
182
170
parser.addFlag ("changed" ,
183
171
abbr: 'c' ,
184
172
negatable: false ,
@@ -197,14 +185,9 @@ main(List<String> args) async {
197
185
parser.addFlag ("flaky" ,
198
186
abbr: 'F' , negatable: false , help: "Show flaky tests." );
199
187
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 );
204
189
parser.addFlag ("passing" ,
205
190
abbr: 'p' , negatable: false , help: "Show passing tests." );
206
- parser.addFlag ("unapproved" ,
207
- abbr: 'U' , negatable: false , help: "Show unapproved tests." );
208
191
parser.addFlag ("unchanged" ,
209
192
abbr: 'u' ,
210
193
negatable: false ,
@@ -222,9 +205,8 @@ main(List<String> args) async {
222
205
final options = parser.parse (args);
223
206
if (options["help" ]) {
224
207
print ("""
225
- Usage: compare_results.dart [OPTION]... BEFORE AFTER [APPROVED]
208
+ Usage: compare_results.dart [OPTION]... BEFORE AFTER
226
209
Compare the old and new test results and list tests that pass the filters.
227
- Three-way compare with the approved results if provided.
228
210
All tests are listed if no filters are given.
229
211
230
212
The options are as follows:
@@ -241,19 +223,16 @@ ${parser.usage}""");
241
223
}
242
224
243
225
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)" );
247
229
exitCode = 2 ;
248
230
return ;
249
231
}
250
232
251
233
// Load the input and the flakiness data if specified.
252
234
final before = await loadResultsMap (parameters[0 ]);
253
235
final after = await loadResultsMap (parameters[1 ]);
254
- final approved = 3 <= parameters.length
255
- ? await loadResultsMap (parameters[2 ])
256
- : < String , Map <String , dynamic >> {};
257
236
final logs = options['logs' ] == null
258
237
? < String , Map <String , dynamic >> {}
259
238
: await loadResultsMap (options['logs' ]);
@@ -268,15 +247,11 @@ ${parser.usage}""");
268
247
for (final name in names) {
269
248
final mapBefore = before[name];
270
249
final mapAfter = after[name];
271
- final mapApproved = approved[name];
272
250
final resultBefore = mapBefore != null
273
251
? new Result .fromMap (mapBefore, flakinessData[name])
274
252
: null ;
275
253
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);
280
255
events.add (event);
281
256
}
282
257
@@ -306,57 +281,24 @@ ${parser.usage}""");
306
281
final searchForStatuses =
307
282
["passing" , "flaky" , "failing" ].where ((option) => options[option]);
308
283
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
-
335
284
// Report tests matching the filters.
336
285
final logSection = < String > [];
337
286
bool judgement = false ;
338
287
for (final searchForStatus
339
288
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;
360
302
}
361
303
}
362
304
0 commit comments