57
57
58
58
class ProgressIndicator (object ):
59
59
60
- def __init__ (self , cases , flaky_tests_mode ):
60
+ def __init__ (self , cases ):
61
61
self .cases = cases
62
- self .flaky_tests_mode = flaky_tests_mode
63
62
self .parallel_queue = Queue (len (cases ))
64
63
self .sequential_queue = Queue (len (cases ))
65
64
for case in cases :
@@ -248,19 +247,13 @@ def HasRun(self, output):
248
247
self ._done += 1
249
248
command = basename (output .command [- 1 ])
250
249
if output .UnexpectedOutput ():
251
- status_line = 'not ok %i - %s' % (self ._done , command )
252
- if FLAKY in output .test .outcomes and self .flaky_tests_mode == "dontcare" :
253
- status_line = status_line + " # TODO : Fix flaky test"
254
- print status_line
250
+ print 'not ok %i - %s' % (self ._done , command )
255
251
for l in output .output .stderr .splitlines ():
256
252
print '#' + l
257
253
for l in output .output .stdout .splitlines ():
258
254
print '#' + l
259
255
else :
260
- status_line = 'ok %i - %s' % (self ._done , command )
261
- if FLAKY in output .test .outcomes :
262
- status_line = status_line + " # TODO : Fix flaky test"
263
- print status_line
256
+ print 'ok %i - %s' % (self ._done , command )
264
257
265
258
duration = output .test .duration
266
259
@@ -278,8 +271,8 @@ def Done(self):
278
271
279
272
class CompactProgressIndicator (ProgressIndicator ):
280
273
281
- def __init__ (self , cases , flaky_tests_mode , templates ):
282
- super (CompactProgressIndicator , self ).__init__ (cases , flaky_tests_mode )
274
+ def __init__ (self , cases , templates ):
275
+ super (CompactProgressIndicator , self ).__init__ (cases )
283
276
self .templates = templates
284
277
self .last_status_length = 0
285
278
self .start_time = time .time ()
@@ -334,29 +327,29 @@ def PrintProgress(self, name):
334
327
335
328
class ColorProgressIndicator (CompactProgressIndicator ):
336
329
337
- def __init__ (self , cases , flaky_tests_mode ):
330
+ def __init__ (self , cases ):
338
331
templates = {
339
332
'status_line' : "[%(mins)02i:%(secs)02i|\033 [34m%%%(remaining) 4d\033 [0m|\033 [32m+%(passed) 4d\033 [0m|\033 [31m-%(failed) 4d\033 [0m]: %(test)s" ,
340
333
'stdout' : "\033 [1m%s\033 [0m" ,
341
334
'stderr' : "\033 [31m%s\033 [0m" ,
342
335
}
343
- super (ColorProgressIndicator , self ).__init__ (cases , flaky_tests_mode , templates )
336
+ super (ColorProgressIndicator , self ).__init__ (cases , templates )
344
337
345
338
def ClearLine (self , last_line_length ):
346
339
print "\033 [1K\r " ,
347
340
348
341
349
342
class MonochromeProgressIndicator (CompactProgressIndicator ):
350
343
351
- def __init__ (self , cases , flaky_tests_mode ):
344
+ def __init__ (self , cases ):
352
345
templates = {
353
346
'status_line' : "[%(mins)02i:%(secs)02i|%%%(remaining) 4d|+%(passed) 4d|-%(failed) 4d]: %(test)s" ,
354
347
'stdout' : '%s' ,
355
348
'stderr' : '%s' ,
356
349
'clear' : lambda last_line_length : ("\r " + (" " * last_line_length ) + "\r " ),
357
350
'max_length' : 78
358
351
}
359
- super (MonochromeProgressIndicator , self ).__init__ (cases , flaky_tests_mode , templates )
352
+ super (MonochromeProgressIndicator , self ).__init__ (cases , templates )
360
353
361
354
def ClearLine (self , last_line_length ):
362
355
print ("\r " + (" " * last_line_length ) + "\r " ),
@@ -776,8 +769,8 @@ def GetVmFlags(self, testcase, mode):
776
769
def GetTimeout (self , mode ):
777
770
return self .timeout * TIMEOUT_SCALEFACTOR [mode ]
778
771
779
- def RunTestCases (cases_to_run , progress , tasks , flaky_tests_mode ):
780
- progress = PROGRESS_INDICATORS [progress ](cases_to_run , flaky_tests_mode )
772
+ def RunTestCases (cases_to_run , progress , tasks ):
773
+ progress = PROGRESS_INDICATORS [progress ](cases_to_run )
781
774
return progress .Run (tasks )
782
775
783
776
@@ -801,7 +794,6 @@ def BuildRequirements(context, requirements, mode, scons_flags):
801
794
TIMEOUT = 'timeout'
802
795
CRASH = 'crash'
803
796
SLOW = 'slow'
804
- FLAKY = 'flaky'
805
797
806
798
807
799
class Expression (object ):
@@ -1248,9 +1240,6 @@ def BuildOptions():
1248
1240
default = False , action = "store_true" )
1249
1241
result .add_option ("--cat" , help = "Print the source of the tests" ,
1250
1242
default = False , action = "store_true" )
1251
- result .add_option ("--flaky-tests" ,
1252
- help = "Regard tests marked as flaky (run|skip|dontcare)" ,
1253
- default = "run" )
1254
1243
result .add_option ("--warn-unused" , help = "Report unused rules" ,
1255
1244
default = False , action = "store_true" )
1256
1245
result .add_option ("-j" , help = "The number of parallel tasks to run" ,
@@ -1280,35 +1269,24 @@ def ProcessOptions(options):
1280
1269
options .mode = options .mode .split (',' )
1281
1270
if options .J :
1282
1271
options .j = multiprocessing .cpu_count ()
1283
- def CheckTestMode (name , option ):
1284
- if not option in ["run" , "skip" , "dontcare" ]:
1285
- print "Unknown %s mode %s" % (name , option )
1286
- return False
1287
- return True
1288
- if not CheckTestMode ("--flaky-tests" , options .flaky_tests ):
1289
- return False
1290
1272
return True
1291
1273
1292
1274
1293
1275
REPORT_TEMPLATE = """\
1294
1276
Total: %(total)i tests
1295
1277
* %(skipped)4d tests will be skipped
1296
- * %(nocrash)4d tests are expected to be flaky but not crash
1297
1278
* %(pass)4d tests are expected to pass
1298
1279
* %(fail_ok)4d tests are expected to fail that we won't fix
1299
1280
* %(fail)4d tests are expected to fail that we should fix\
1300
1281
"""
1301
1282
1302
1283
def PrintReport (cases ):
1303
- def IsFlaky (o ):
1304
- return (PASS in o ) and (FAIL in o ) and (not CRASH in o ) and (not OKAY in o )
1305
1284
def IsFailOk (o ):
1306
1285
return (len (o ) == 2 ) and (FAIL in o ) and (OKAY in o )
1307
1286
unskipped = [c for c in cases if not SKIP in c .outcomes ]
1308
1287
print REPORT_TEMPLATE % {
1309
1288
'total' : len (cases ),
1310
1289
'skipped' : len (cases ) - len (unskipped ),
1311
- 'nocrash' : len ([t for t in unskipped if IsFlaky (t .outcomes )]),
1312
1290
'pass' : len ([t for t in unskipped if list (t .outcomes ) == [PASS ]]),
1313
1291
'fail_ok' : len ([t for t in unskipped if IsFailOk (t .outcomes )]),
1314
1292
'fail' : len ([t for t in unskipped if list (t .outcomes ) == [FAIL ]])
@@ -1486,15 +1464,15 @@ def Main():
1486
1464
1487
1465
result = None
1488
1466
def DoSkip (case ):
1489
- return SKIP in case .outcomes or SLOW in case .outcomes or ( FLAKY in case . outcomes and options . flaky_tests == "skip" )
1467
+ return SKIP in case .outcomes or SLOW in case .outcomes
1490
1468
cases_to_run = [ c for c in all_cases if not DoSkip (c ) ]
1491
1469
if len (cases_to_run ) == 0 :
1492
1470
print "No tests to run."
1493
1471
return 1
1494
1472
else :
1495
1473
try :
1496
1474
start = time .time ()
1497
- if RunTestCases (cases_to_run , options .progress , options .j , options . flaky_tests ):
1475
+ if RunTestCases (cases_to_run , options .progress , options .j ):
1498
1476
result = 0
1499
1477
else :
1500
1478
result = 1
0 commit comments