Bug 1063728 - Run SpiderMonkey style checkers as part of the build instead of make check. r=chmanchester
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 26 Apr 2018 09:09:51 +0200
changeset 469274 ff80b014c00b8db7c29888497ad3fe3fad74471c
parent 469273 c7a4c83d8d1578c582116f77666e03680e5e69ab
child 469275 2bc389188dc5bf3b90b99a947c691671dceeb38e
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1063728
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1063728 - Run SpiderMonkey style checkers as part of the build instead of make check. r=chmanchester
config/run_spidermonkey_checks.py
js/src/Makefile.in
js/src/build/moz.build
js/src/devtools/automation/autospider.py
js/src/devtools/automation/variants/nonunified
testing/mach_commands.py
new file mode 100644
--- /dev/null
+++ b/config/run_spidermonkey_checks.py
@@ -0,0 +1,13 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import buildconfig
+import subprocess
+import sys
+
+def main(output, lib_file, *scripts):
+    for script in scripts:
+        retcode = subprocess.call([sys.executable, script], cwd=buildconfig.topsrcdir)
+        if retcode != 0:
+            raise Exception(script + " failed")
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -44,36 +44,27 @@ endif
 ifdef MOZ_TSAN
 JITTEST_SANITIZER_ENV=TSAN_OPTIONS="external_symbolizer_path=$(LLVM_SYMBOLIZER) $$TSAN_OPTIONS"
 endif
 ifdef MOZ_MSAN
 JITTEST_SANITIZER_ENV=MSAN_SYMBOLIZER_PATH='$(LLVM_SYMBOLIZER)'
 endif
 endif
 
-check-style::
-	(cd $(topsrcdir) && $(PYTHON) $(topsrcdir)/config/check_spidermonkey_style.py);
-
-check-masm::
-	(cd $(topsrcdir) && $(PYTHON) $(topsrcdir)/config/check_macroassembler_style.py);
-
 check-js-msg::
 	(cd $(topsrcdir) && $(PYTHON) $(topsrcdir)/config/check_js_msg_encoding.py);
 
-check-opcode::
-	(cd $(topsrcdir) && $(PYTHON) $(topsrcdir)/config/check_js_opcode.py);
-
 check-jit-test::
 	$(JITTEST_SANITIZER_ENV) $(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/jit-test/jit_test.py \
 	        --no-slow --no-progress --format=automation --jitflags=all \
 			$(JITTEST_VALGRIND_FLAG) \
 			$(JITTEST_EXTRA_ARGS) \
 	        $(DIST)/bin/$(JS_SHELL_NAME)$(BIN_SUFFIX) $(JITTEST_TEST_ARGS)
 
-check:: check-style check-masm check-js-msg check-opcode
+check:: check-js-msg
 
 check-jstests:
 	$(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/tests/jstests.py \
 		--no-progress --format=automation --timeout 300 \
 		$(JSTESTS_EXTRA_ARGS) \
 		$(DIST)/bin/$(JS_SHELL_NAME)$(BIN_SUFFIX)
 
 # FIXME:
--- a/js/src/build/moz.build
+++ b/js/src/build/moz.build
@@ -70,8 +70,20 @@ OS_LIBS += CONFIG['REALTIME_LIBS']
 NO_EXPAND_LIBS = True
 
 DIST_INSTALL = True
 
 # Ensure symbol versions of shared library on Linux do not conflict
 # with those in libxul.
 if CONFIG['OS_TARGET'] == 'Linux':
     LDFLAGS += ['-Wl,-version-script,symverscript']
+
+# Run SpiderMonkey style checker after linking the static library. This avoids
+# running the script for no-op builds.
+GENERATED_FILES += ['spidermonkey_checks']
+run_checks = GENERATED_FILES['spidermonkey_checks']
+run_checks.script = '/config/run_spidermonkey_checks.py'
+run_checks.inputs += [
+    '!%sjs_static.%s' % (CONFIG['LIB_PREFIX'], CONFIG['LIB_SUFFIX']),
+    '/config/check_spidermonkey_style.py',
+    '/config/check_macroassembler_style.py',
+    '/config/check_js_opcode.py'
+]
--- a/js/src/devtools/automation/autospider.py
+++ b/js/src/devtools/automation/autospider.py
@@ -472,21 +472,18 @@ if use_minidump:
     # processing. So use the --dll command line mechanism universally.
     for v in ('JSTESTS_EXTRA_ARGS', 'JITTEST_EXTRA_ARGS'):
         env[v] = "--args='--dll %s' %s" % (injector_lib, env.get(v, ''))
 
 # Always run all enabled tests, even if earlier ones failed. But return the
 # first failed status.
 results = []
 
-# 'checks' is a superset of 'check-style'.
 if 'checks' in test_suites:
     results.append(run_test_command([MAKE, 'check']))
-elif 'check-style' in test_suites:
-    results.append(run_test_command([MAKE, 'check-style']))
 
 if 'jittest' in test_suites:
     results.append(run_test_command([MAKE, 'check-jit-test']))
 if 'jsapitests' in test_suites:
     jsapi_test_binary = os.path.join(OBJDIR, 'dist', 'bin', 'jsapi-tests')
     test_env = env.copy()
     if use_minidump and platform.system() == 'Linux':
         test_env['LD_PRELOAD'] = injector_lib
--- a/js/src/devtools/automation/variants/nonunified
+++ b/js/src/devtools/automation/variants/nonunified
@@ -1,10 +1,7 @@
 {
     "configure-args": "--enable-warnings-as-errors",
     "debug": true,
     "skip-tests": {
         "all": ["jstests", "jittest", "checks"]
-    },
-    "extra-tests": {
-        "all": ["check-style"]
     }
 }
--- a/testing/mach_commands.py
+++ b/testing/mach_commands.py
@@ -303,36 +303,24 @@ class CheckSpiderMonkeyCommand(MachComma
         ]
         jstest_result = subprocess.call(jstest_cmd)
 
         print('running jsapi-tests')
         jsapi_tests_cmd = [os.path.join(
             self.bindir, executable_name('jsapi-tests'))]
         jsapi_tests_result = subprocess.call(jsapi_tests_cmd)
 
-        print('running check-style')
-        check_style_cmd = [python, os.path.join(
-            self.topsrcdir, 'config', 'check_spidermonkey_style.py')]
-        check_style_result = subprocess.call(
-            check_style_cmd, cwd=self.topsrcdir)
-
-        print('running check-masm')
-        check_masm_cmd = [python, os.path.join(
-            self.topsrcdir, 'config', 'check_macroassembler_style.py')]
-        check_masm_result = subprocess.call(
-            check_masm_cmd, cwd=self.topsrcdir)
-
         print('running check-js-msg-encoding')
         check_js_msg_cmd = [python, os.path.join(
             self.topsrcdir, 'config', 'check_js_msg_encoding.py')]
         check_js_msg_result = subprocess.call(
             check_js_msg_cmd, cwd=self.topsrcdir)
 
         all_passed = jittest_result and jstest_result and jsapi_tests_result and \
-            check_style_result and check_masm_result and check_js_msg_result
+            check_js_msg_result
 
         return all_passed
 
 
 @CommandProvider
 class JsapiTestsCommand(MachCommandBase):
     @Command('jsapi-tests', category='testing', description='Run jsapi tests (JavaScript engine).')
     @CommandArgument('test_name', nargs='?', metavar='N',