@@ -341,6 +341,39 @@ def HasRun(self, output):
341
341
def Done (self ):
342
342
pass
343
343
344
+ class DeoptsCheckProgressIndicator (SimpleProgressIndicator ):
345
+
346
+ def Starting (self ):
347
+ pass
348
+
349
+ def AboutToRun (self , case ):
350
+ pass
351
+
352
+ def HasRun (self , output ):
353
+ # Print test name as (for example) "parallel/test-assert". Tests that are
354
+ # scraped from the addons documentation are all named test.js, making it
355
+ # hard to decipher what test is running when only the filename is printed.
356
+ prefix = abspath (join (dirname (__file__ ), '../test' )) + os .sep
357
+ command = output .command [- 1 ]
358
+ if command .endswith ('.js' ): command = command [:- 3 ]
359
+ if command .startswith (prefix ): command = command [len (prefix ):]
360
+ command = command .replace ('\\ ' , '/' )
361
+
362
+ stdout = output .output .stdout .strip ()
363
+ printed_file = False
364
+ for line in stdout .splitlines ():
365
+ if (line .startswith ("[aborted optimiz" ) or \
366
+ line .startswith ("[disabled optimiz" )) and \
367
+ ("because:" in line or "reason:" in line ):
368
+ if not printed_file :
369
+ printed_file = True
370
+ print '==== %s ====' % command
371
+ self .failed .append (output )
372
+ print ' %s' % line
373
+
374
+ def Done (self ):
375
+ pass
376
+
344
377
345
378
class CompactProgressIndicator (ProgressIndicator ):
346
379
@@ -433,7 +466,8 @@ def ClearLine(self, last_line_length):
433
466
'dots' : DotsProgressIndicator ,
434
467
'color' : ColorProgressIndicator ,
435
468
'tap' : TapProgressIndicator ,
436
- 'mono' : MonochromeProgressIndicator
469
+ 'mono' : MonochromeProgressIndicator ,
470
+ 'deopts' : DeoptsCheckProgressIndicator
437
471
}
438
472
439
473
@@ -1383,6 +1417,8 @@ def BuildOptions():
1383
1417
help = "Expect test cases to fail" , default = False , action = "store_true" )
1384
1418
result .add_option ("--valgrind" , help = "Run tests through valgrind" ,
1385
1419
default = False , action = "store_true" )
1420
+ result .add_option ("--check-deopts" , help = "Check tests for permanent deoptimizations" ,
1421
+ default = False , action = "store_true" )
1386
1422
result .add_option ("--cat" , help = "Print the source of the tests" ,
1387
1423
default = False , action = "store_true" )
1388
1424
result .add_option ("--flaky-tests" ,
@@ -1586,6 +1622,14 @@ def Main():
1586
1622
run_valgrind = join (workspace , "tools" , "run-valgrind.py" )
1587
1623
options .special_command = "python -u " + run_valgrind + " @"
1588
1624
1625
+ if options .check_deopts :
1626
+ options .node_args .append ("--trace-opt" )
1627
+ options .node_args .append ("--trace-file-names" )
1628
+ # --always-opt is needed because many tests do not run long enough for the
1629
+ # optimizer to kick in, so this flag will force it to run.
1630
+ options .node_args .append ("--always-opt" )
1631
+ options .progress = "deopts"
1632
+
1589
1633
shell = abspath (options .shell )
1590
1634
buildspace = dirname (shell )
1591
1635
0 commit comments