build: add target for checking for perm deopts

PR-URL: https://github.com/nodejs/node/pull/12456
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Brian White 2017-04-17 00:01:00 -04:00
parent 91ccea65ea
commit 7a5bac5d36
No known key found for this signature in database
GPG Key ID: 606D7358F94DA209
3 changed files with 60 additions and 2 deletions

View File

@ -205,6 +205,9 @@ test-parallel: all
test-valgrind: all test-valgrind: all
$(PYTHON) tools/test.py --mode=release --valgrind sequential parallel message $(PYTHON) tools/test.py --mode=release --valgrind sequential parallel message
test-check-deopts: all
$(PYTHON) tools/test.py --mode=release --check-deopts parallel sequential -J
# Implicitly depends on $(NODE_EXE). We don't depend on it explicitly because # Implicitly depends on $(NODE_EXE). We don't depend on it explicitly because
# it always triggers a rebuild due to it being a .PHONY rule. See the comment # it always triggers a rebuild due to it being a .PHONY rule. See the comment
# near the build-addons rule for more background. # near the build-addons rule for more background.

View File

@ -341,6 +341,39 @@ class TapProgressIndicator(SimpleProgressIndicator):
def Done(self): def Done(self):
pass pass
class DeoptsCheckProgressIndicator(SimpleProgressIndicator):
def Starting(self):
pass
def AboutToRun(self, case):
pass
def HasRun(self, output):
# Print test name as (for example) "parallel/test-assert". Tests that are
# scraped from the addons documentation are all named test.js, making it
# hard to decipher what test is running when only the filename is printed.
prefix = abspath(join(dirname(__file__), '../test')) + os.sep
command = output.command[-1]
if command.endswith('.js'): command = command[:-3]
if command.startswith(prefix): command = command[len(prefix):]
command = command.replace('\\', '/')
stdout = output.output.stdout.strip()
printed_file = False
for line in stdout.splitlines():
if (line.startswith("[aborted optimiz") or \
line.startswith("[disabled optimiz")) and \
("because:" in line or "reason:" in line):
if not printed_file:
printed_file = True
print '==== %s ====' % command
self.failed.append(output)
print ' %s' % line
def Done(self):
pass
class CompactProgressIndicator(ProgressIndicator): class CompactProgressIndicator(ProgressIndicator):
@ -433,7 +466,8 @@ PROGRESS_INDICATORS = {
'dots': DotsProgressIndicator, 'dots': DotsProgressIndicator,
'color': ColorProgressIndicator, 'color': ColorProgressIndicator,
'tap': TapProgressIndicator, 'tap': TapProgressIndicator,
'mono': MonochromeProgressIndicator 'mono': MonochromeProgressIndicator,
'deopts': DeoptsCheckProgressIndicator
} }
@ -1383,6 +1417,8 @@ def BuildOptions():
help="Expect test cases to fail", default=False, action="store_true") help="Expect test cases to fail", default=False, action="store_true")
result.add_option("--valgrind", help="Run tests through valgrind", result.add_option("--valgrind", help="Run tests through valgrind",
default=False, action="store_true") default=False, action="store_true")
result.add_option("--check-deopts", help="Check tests for permanent deoptimizations",
default=False, action="store_true")
result.add_option("--cat", help="Print the source of the tests", result.add_option("--cat", help="Print the source of the tests",
default=False, action="store_true") default=False, action="store_true")
result.add_option("--flaky-tests", result.add_option("--flaky-tests",
@ -1586,6 +1622,14 @@ def Main():
run_valgrind = join(workspace, "tools", "run-valgrind.py") run_valgrind = join(workspace, "tools", "run-valgrind.py")
options.special_command = "python -u " + run_valgrind + " @" options.special_command = "python -u " + run_valgrind + " @"
if options.check_deopts:
options.node_args.append("--trace-opt")
options.node_args.append("--trace-file-names")
# --always-opt is needed because many tests do not run long enough for the
# optimizer to kick in, so this flag will force it to run.
options.node_args.append("--always-opt")
options.progress = "deopts"
shell = abspath(options.shell) shell = abspath(options.shell)
buildspace = dirname(shell) buildspace = dirname(shell)

View File

@ -42,6 +42,7 @@ set build_addons=
set dll= set dll=
set build_addons_napi= set build_addons_napi=
set test_node_inspect= set test_node_inspect=
set test_check_deopts=
:next-arg :next-arg
if "%1"=="" goto args-done if "%1"=="" goto args-done
@ -74,6 +75,7 @@ if /i "%1"=="test-pummel" set test_args=%test_args% pummel&goto arg-ok
if /i "%1"=="test-all" set test_args=%test_args% sequential parallel message gc inspector internet pummel&set build_testgc_addon=1&set cpplint=1&set jslint=1&goto arg-ok if /i "%1"=="test-all" set test_args=%test_args% sequential parallel message gc inspector internet pummel&set build_testgc_addon=1&set cpplint=1&set jslint=1&goto arg-ok
if /i "%1"=="test-known-issues" set test_args=%test_args% known_issues&goto arg-ok if /i "%1"=="test-known-issues" set test_args=%test_args% known_issues&goto arg-ok
if /i "%1"=="test-node-inspect" set test_node_inspect=1&goto arg-ok if /i "%1"=="test-node-inspect" set test_node_inspect=1&goto arg-ok
if /i "%1"=="test-check-deopts" set test_check_deopts=1&goto arg-ok
if /i "%1"=="jslint" set jslint=1&goto arg-ok if /i "%1"=="jslint" set jslint=1&goto arg-ok
if /i "%1"=="jslint-ci" set jslint_ci=1&goto arg-ok if /i "%1"=="jslint-ci" set jslint_ci=1&goto arg-ok
if /i "%1"=="lint" set cpplint=1&set jslint=1&goto arg-ok if /i "%1"=="lint" set cpplint=1&set jslint=1&goto arg-ok
@ -361,7 +363,16 @@ endlocal
goto run-tests goto run-tests
:run-tests :run-tests
if not defined test_node_inspect goto node-tests if defined test_check_deopts goto node-check-deopts
if defined test_node_inspect goto node-test-inspect
goto node-tests
:node-check-deopts
python tools\test.py --mode=release --check-deopts parallel sequential -J
if defined test_node_inspect goto node-test-inspect
goto node-tests
:node-test-inspect
set USE_EMBEDDED_NODE_INSPECT=1 set USE_EMBEDDED_NODE_INSPECT=1
%config%\node tools\test-npm-package.js --install deps\node-inspect test %config%\node tools\test-npm-package.js --install deps\node-inspect test
goto node-tests goto node-tests