@@ -340,6 +340,39 @@ def HasRun(self, output):
340
340
def Done (self ):
341
341
pass
342
342
343
+ class DeoptsCheckProgressIndicator (SimpleProgressIndicator ):
344
+
345
+ def Starting (self ):
346
+ pass
347
+
348
+ def AboutToRun (self , case ):
349
+ pass
350
+
351
+ def HasRun (self , output ):
352
+ # Print test name as (for example) "parallel/test-assert". Tests that are
353
+ # scraped from the addons documentation are all named test.js, making it
354
+ # hard to decipher what test is running when only the filename is printed.
355
+ prefix = abspath (join (dirname (__file__ ), '../test' )) + os .sep
356
+ command = output .command [- 1 ]
357
+ if command .endswith ('.js' ): command = command [:- 3 ]
358
+ if command .startswith (prefix ): command = command [len (prefix ):]
359
+ command = command .replace ('\\ ' , '/' )
360
+
361
+ stdout = output .output .stdout .strip ()
362
+ printed_file = False
363
+ for line in stdout .splitlines ():
364
+ if (line .startswith ("[aborted optimiz" ) or \
365
+ line .startswith ("[disabled optimiz" )) and \
366
+ ("because:" in line or "reason:" in line ):
367
+ if not printed_file :
368
+ printed_file = True
369
+ print '==== %s ====' % command
370
+ self .failed .append (output )
371
+ print ' %s' % line
372
+
373
+ def Done (self ):
374
+ pass
375
+
343
376
344
377
class CompactProgressIndicator (ProgressIndicator ):
345
378
@@ -432,7 +465,8 @@ def ClearLine(self, last_line_length):
432
465
'dots' : DotsProgressIndicator ,
433
466
'color' : ColorProgressIndicator ,
434
467
'tap' : TapProgressIndicator ,
435
- 'mono' : MonochromeProgressIndicator
468
+ 'mono' : MonochromeProgressIndicator ,
469
+ 'deopts' : DeoptsCheckProgressIndicator
436
470
}
437
471
438
472
@@ -1367,6 +1401,8 @@ def BuildOptions():
1367
1401
help = "Expect test cases to fail" , default = False , action = "store_true" )
1368
1402
result .add_option ("--valgrind" , help = "Run tests through valgrind" ,
1369
1403
default = False , action = "store_true" )
1404
+ result .add_option ("--check-deopts" , help = "Check tests for permanent deoptimizations" ,
1405
+ default = False , action = "store_true" )
1370
1406
result .add_option ("--cat" , help = "Print the source of the tests" ,
1371
1407
default = False , action = "store_true" )
1372
1408
result .add_option ("--flaky-tests" ,
@@ -1569,6 +1605,14 @@ def Main():
1569
1605
run_valgrind = join (workspace , "tools" , "run-valgrind.py" )
1570
1606
options .special_command = "python -u " + run_valgrind + " @"
1571
1607
1608
+ if options .check_deopts :
1609
+ options .node_args .append ("--trace-opt" )
1610
+ options .node_args .append ("--trace-file-names" )
1611
+ # --always-opt is needed because many tests do not run long enough for the
1612
+ # optimizer to kick in, so this flag will force it to run.
1613
+ options .node_args .append ("--always-opt" )
1614
+ options .progress = "deopts"
1615
+
1572
1616
shell = abspath (options .shell )
1573
1617
buildspace = dirname (shell )
1574
1618
0 commit comments