Bug 1447611: followup: don't require llvm stuff when there's no compile env, and fix unittest config. r=froydnj
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 21 Mar 2018 17:55:43 +0100
changeset 1460159 c647e6474b3c01a1b57ff9bda04d23ec1bbdd9c5
parent 1460158 c6193142bbcf6dbd7e7562243282f543310a0ea1
child 1460160 0c24a9ae2a6859f7da3ffa45792a2623073bc0ec
push id260095
push userecoal95@gmail.com
push dateWed, 21 Mar 2018 17:01:50 +0000
treeherdertry@0c24a9ae2a68 [default view] [failures only]
reviewersfroydnj
bugs1447611
milestone61.0a1
Bug 1447611: followup: don't require llvm stuff when there's no compile env, and fix unittest config. r=froydnj MozReview-Commit-ID: 6Q1XAJuL4qM
testing/mozharness/mozharness/mozilla/testing/verify_tools.py
testing/mozharness/scripts/desktop_unittest.py
testing/talos/talos/config.py
testing/talos/talos/unittests/test_config.py
toolkit/moz.configure
--- a/testing/mozharness/mozharness/mozilla/testing/verify_tools.py
+++ b/testing/mozharness/mozharness/mozilla/testing/verify_tools.py
@@ -170,18 +170,18 @@ class VerifyToolsMixin(object):
             return response
 
         dirs = self.query_abs_dirs()
         mozinfo.find_and_update_from_json(dirs['abs_test_install_dir'])
         e10s = self.config.get('e10s', False)
         mozinfo.update({"e10s": e10s})
         headless = self.config.get('headless', False)
         mozinfo.update({"headless": headless})
-        stylo = self.config.get('enable_stylo', False)
-        mozinfo.update({'stylo': stylo})
+        # FIXME(emilio): Need to update test expectations.
+        mozinfo.update({'stylo': True})
         mozinfo.update({'verify': True})
         self.info("Verification using mozinfo: %s" % str(mozinfo.info))
 
         # determine which files were changed on this push
         url = '%s/json-automationrelevance/%s' % (repository.rstrip('/'), revision)
         contents = self.retry(get_automationrelevance, attempts=2, sleeptime=10)
         changed_files = set()
         for c in contents['changesets']:
--- a/testing/mozharness/scripts/desktop_unittest.py
+++ b/testing/mozharness/scripts/desktop_unittest.py
@@ -224,19 +224,16 @@ class DesktopUnittest(TestingMixin, Merc
                 perfherder_parts.extend(c[s])
 
         if 'this_chunk' in c:
             perfherder_parts.append(c['this_chunk'])
 
         if c['e10s']:
             perfherder_options.append('e10s')
 
-        if c['enable_stylo']:
-            perfherder_options.append('stylo')
-
         self.resource_monitor_perfherder_id = ('.'.join(perfherder_parts),
                                                perfherder_options)
 
     # helper methods {{{2
     def _pre_config_lock(self, rw_config):
         super(DesktopUnittest, self)._pre_config_lock(rw_config)
         c = self.config
         if not c.get('run_all_suites'):
@@ -844,19 +841,16 @@ class DesktopUnittest(TestingMixin, Merc
                     env['MOZ_WEBRENDER'] = '1'
                     env['MOZ_ACCELERATED'] = '1'
 
                 if self.config['single_stylo_traversal']:
                     env['STYLO_THREADS'] = '1'
                 else:
                     env['STYLO_THREADS'] = '4'
 
-                if self.config['enable_stylo']:
-                    env['STYLO_FORCE_ENABLED'] = '1'
-
                 env = self.query_env(partial_env=env, log_level=INFO)
                 cmd_timeout = self.get_timeout_for_category(suite_category)
 
                 for verify_args in self.query_verify_args(suite):
                     if (datetime.now() - self.start_time) > max_verify_time:
                         # Verification has run out of time. That is okay! Stop running
                         # tests so that a task timeout is not triggered, and so that
                         # (partial) results are made available in a timely manner.
--- a/testing/talos/talos/config.py
+++ b/testing/talos/talos/config.py
@@ -479,17 +479,16 @@ def get_browser_config(config):
                 'framework': 'talos',
                 'repository': None,
                 'sourcestamp': None,
                 'symbols_path': None,
                 'test_timeout': 1200,
                 'xperf_path': None,
                 'error_filename': None,
                 'no_upload_results': False,
-                'enable_stylo': True,
                 'stylothreads': 0,
                 'subtests': None,
                 }
     browser_config = dict(title=config['title'])
     browser_config.update(dict([(i, config[i]) for i in required]))
     browser_config.update(dict([(i, config.get(i, j))
                           for i, j in optional.items()]))
     return browser_config
--- a/testing/talos/talos/unittests/test_config.py
+++ b/testing/talos/talos/unittests/test_config.py
@@ -131,17 +131,16 @@ class Test_get_browser_config(object):
                 'framework',
                 'repository',
                 'sourcestamp',
                 'symbols_path',
                 'test_timeout',
                 'xperf_path',
                 'error_filename',
                 'no_upload_results',
-                'enable_stylo',
                 'disable_stylo',
                 'stylothreads',
                 'subtests']
 
     def test_that_contains_title(self):
         config_no_optionals = dict.fromkeys(self.required, '')
         config_no_optionals.update(title='is_mandatory')
 
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -594,161 +594,163 @@ def llvm_config_paths(host):
                                         os.path.expanduser(os.path.join('~', '.mozbuild')))
     bootstrap_llvm_config = os.path.join(mozbuild_state_dir, 'clang', 'bin', 'llvm-config')
 
     llvm_config_progs.append(bootstrap_llvm_config)
 
     return llvm_config_progs
 
 llvm_config = check_prog('LLVM_CONFIG', llvm_config_paths,
+                         when='--enable-compile-environment',
                          what='llvm-config', allow_missing=True)
 
-option('--with-libclang-path', nargs=1,
-       help='Absolute path to a directory containing Clang/LLVM libraries for Stylo (version 3.9.x or above)')
-option('--with-clang-path', nargs=1,
-       help='Absolute path to a Clang binary for Stylo bindgen (version 3.9.x or above)')
+with only_when('--enable-compile-environment'):
+    option('--with-libclang-path', nargs=1,
+           help='Absolute path to a directory containing Clang/LLVM libraries for Stylo (version 3.9.x or above)')
+    option('--with-clang-path', nargs=1,
+           help='Absolute path to a Clang binary for Stylo bindgen (version 3.9.x or above)')
+
+    def invoke_llvm_config(llvm_config, *options):
+        '''Invoke llvm_config with the given options and return the first line of
+        output.'''
+        lines = check_cmd_output(llvm_config, *options).splitlines()
+        return lines[0]
 
-def invoke_llvm_config(llvm_config, *options):
-    '''Invoke llvm_config with the given options and return the first line of
-    output.'''
-    lines = check_cmd_output(llvm_config, *options).splitlines()
-    return lines[0]
+    @imports(_from='textwrap', _import='dedent')
+    def check_minimum_llvm_config_version(llvm_config):
+        version = Version(invoke_llvm_config(llvm_config, '--version'))
+        min_version = Version('3.9.0')
+        if version < min_version:
+            die(dedent('''\
+            llvm installation {} is incompatible with Stylo bindgen.
 
-@imports(_from='textwrap', _import='dedent')
-def check_minimum_llvm_config_version(llvm_config):
-    version = Version(invoke_llvm_config(llvm_config, '--version'))
-    min_version = Version('3.9.0')
-    if version < min_version:
-        die(dedent('''\
-        llvm installation {} is incompatible with Stylo bindgen.
+            To compile Stylo, please install version {} or greater of
+            Clang + LLVM and ensure that the 'llvm-config' from that
+            installation is first on your path.
+
+            You can verify this by typing 'llvm-config --version'.
+            '''.format(version, min_version)))
 
-        To compile Stylo, please install version {} or greater of
-        Clang + LLVM and ensure that the 'llvm-config' from that
-        installation is first on your path.
-
-        You can verify this by typing 'llvm-config --version'.
-        '''.format(version, min_version)))
+    @depends(llvm_config, '--with-libclang-path', '--with-clang-path',
+             host_library_name_info, host)
+    @imports('os.path')
+    @imports('glob')
+    @imports(_from='textwrap', _import='dedent')
+    def bindgen_config_paths(llvm_config, libclang_path, clang_path,
+                             library_name_info, host):
+        def search_for_libclang(path):
+            # Try to ensure that the clang shared library that bindgen is going
+            # to look for is actually present.  The files that we search for
+            # mirror the logic in clang-sys/build.rs.
+            libclang_choices = []
+            if host.os == 'WINNT':
+                libclang_choices.append('libclang.dll')
+            libclang_choices.append('%sclang%s' % (library_name_info.dll.prefix,
+                                                   library_name_info.dll.suffix))
+            if host.kernel == 'Linux':
+                libclang_choices.append('libclang.so.1')
 
-@depends(llvm_config, '--with-libclang-path', '--with-clang-path',
-         host_library_name_info, host)
-@imports('os.path')
-@imports('glob')
-@imports(_from='textwrap', _import='dedent')
-def bindgen_config_paths(llvm_config, libclang_path, clang_path,
-                         library_name_info, host):
-    def search_for_libclang(path):
-        # Try to ensure that the clang shared library that bindgen is going
-        # to look for is actually present.  The files that we search for
-        # mirror the logic in clang-sys/build.rs.
-        libclang_choices = []
-        if host.os == 'WINNT':
-            libclang_choices.append('libclang.dll')
-        libclang_choices.append('%sclang%s' % (library_name_info.dll.prefix,
-                                               library_name_info.dll.suffix))
-        if host.kernel == 'Linux':
-            libclang_choices.append('libclang.so.1')
+            if host.os == 'OpenBSD':
+                libclang_choices = glob.glob(path + '/libclang.so.*.*')
+
+            # At least one of the choices must be found.
+            for choice in libclang_choices:
+                libclang = os.path.join(path, choice)
+                if os.path.exists(libclang):
+                    return (True, None)
+            else:
+                return (False, list(set(libclang_choices)))
 
-        if host.os == 'OpenBSD':
-            libclang_choices = glob.glob(path + '/libclang.so.*.*')
-
-        # At least one of the choices must be found.
-        for choice in libclang_choices:
-            libclang = os.path.join(path, choice)
-            if os.path.exists(libclang):
-                return (True, None)
-        else:
-            return (False, list(set(libclang_choices)))
+        if not libclang_path and not clang_path:
+            # We must have LLVM_CONFIG in this case.
+            if not llvm_config:
+                die(dedent('''\
+                Could not find LLVM/Clang installation for compiling stylo build-time
+                bindgen.  Please specify the 'LLVM_CONFIG' environment variable
+                (recommended), pass the '--with-libclang-path' and '--with-clang-path'
+                options to configure, or put 'llvm-config' in your PATH.  Altering your
+                PATH may expose 'clang' as well, potentially altering your compiler,
+                which may not be what you intended.'''))
 
-    if not libclang_path and not clang_path:
-        # We must have LLVM_CONFIG in this case.
-        if not llvm_config:
-            die(dedent('''\
-            Could not find LLVM/Clang installation for compiling stylo build-time
-            bindgen.  Please specify the 'LLVM_CONFIG' environment variable
-            (recommended), pass the '--with-libclang-path' and '--with-clang-path'
-            options to configure, or put 'llvm-config' in your PATH.  Altering your
-            PATH may expose 'clang' as well, potentially altering your compiler,
-            which may not be what you intended.'''))
+            check_minimum_llvm_config_version(llvm_config)
+            libclang_arg = '--bindir' if host.os == 'WINNT' else '--libdir'
+            libclang_path = invoke_llvm_config(llvm_config, libclang_arg)
+            clang_path = os.path.join(invoke_llvm_config(llvm_config, '--bindir'),
+                                      'clang')
+            libclang_path = normsep(libclang_path)
+            clang_path = normsep(clang_path)
+
+            # Debian-based distros, at least, can have llvm-config installed
+            # but not have other packages installed.  Since the user is trying
+            # to use their system packages, we can't be more specific about what
+            # they need.
+            clang_resolved = find_program(clang_path)
+            if not clang_resolved:
+                die(dedent('''\
+                The file {} returned by `llvm-config {}` does not exist.
+                clang is required to build Stylo.  Please install the necessary packages,
+                run `mach bootstrap`, or add --disable-stylo to your mozconfig.
+                '''.format(clang_path, '--bindir')))
 
-        check_minimum_llvm_config_version(llvm_config)
-        libclang_arg = '--bindir' if host.os == 'WINNT' else '--libdir'
-        libclang_path = invoke_llvm_config(llvm_config, libclang_arg)
-        clang_path = os.path.join(invoke_llvm_config(llvm_config, '--bindir'),
-                                  'clang')
-        libclang_path = normsep(libclang_path)
-        clang_path = normsep(clang_path)
+            if not os.path.exists(libclang_path):
+                die(dedent('''\
+                The directory {} returned by `llvm-config {}` does not exist.
+                clang is required to build Stylo.  Please install the necessary packages,
+                run `mach bootstrap`, or add --disable-stylo to your mozconfig.
+                '''.format(libclang_path, libclang_arg)))
+
+            (found, searched) = search_for_libclang(libclang_path)
+            if not found:
+                die(dedent('''\
+                Could not find the clang shared library in the path {}
+                returned by `llvm-config {}` (searched for files {}).
+                clang is required to build Stylo.  Please install the necessary packages,
+                run `mach bootstrap`, or add --disable-stylo to your mozconfig.
+                '''.format(libclang_path, libclang_arg, searched)))
 
-        # Debian-based distros, at least, can have llvm-config installed
-        # but not have other packages installed.  Since the user is trying
-        # to use their system packages, we can't be more specific about what
-        # they need.
-        clang_resolved = find_program(clang_path)
-        if not clang_resolved:
+            return namespace(
+                libclang_path=libclang_path,
+                clang_path=clang_resolved,
+            )
+
+        if (not libclang_path and clang_path) or \
+           (libclang_path and not clang_path):
             die(dedent('''\
-            The file {} returned by `llvm-config {}` does not exist.
-            clang is required to build Firefox.  Please install the necessary
-            packages, or run `mach bootstrap`.
-            '''.format(clang_path, '--bindir')))
+            You must provide both of --with-libclang-path and --with-clang-path
+            or neither of them.'''))
+
+        libclang_path = libclang_path[0]
+        clang_path = clang_path[0]
 
-        if not os.path.exists(libclang_path):
+        if not os.path.exists(libclang_path) or \
+           not os.path.isdir(libclang_path):
             die(dedent('''\
-            The directory {} returned by `llvm-config {}` does not exist.
-            clang is required to build Firefox.  Please install the necessary
-            packages, or run `mach bootstrap`.
-            '''.format(libclang_path, libclang_arg)))
+            The argument to --with-libclang-path is not a directory: {}
+            '''.format(libclang_path)))
 
         (found, searched) = search_for_libclang(libclang_path)
         if not found:
             die(dedent('''\
             Could not find the clang shared library in the path {}
-            returned by `llvm-config {}` (searched for files {}).
-            clang is required to build Firefox.  Please install the necessary
-            packages, or run `mach bootstrap`.
-            '''.format(libclang_path, libclang_arg, searched)))
+            specified by --with-libclang-path (searched for files {}).
+            '''.format(libclang_path, searched)))
+
+        clang_resolved = find_program(clang_path)
+        if not clang_resolved:
+            die(dedent('''\
+            The argument to --with-clang-path is not a file: {}
+            '''.format(clang_path)))
 
         return namespace(
             libclang_path=libclang_path,
             clang_path=clang_resolved,
         )
 
-    if (not libclang_path and clang_path) or \
-       (libclang_path and not clang_path):
-        die(dedent('''\
-        You must provide both of --with-libclang-path and --with-clang-path
-        or neither of them.'''))
-
-    libclang_path = libclang_path[0]
-    clang_path = clang_path[0]
-
-    if not os.path.exists(libclang_path) or \
-       not os.path.isdir(libclang_path):
-        die(dedent('''\
-        The argument to --with-libclang-path is not a directory: {}
-        '''.format(libclang_path)))
-
-    (found, searched) = search_for_libclang(libclang_path)
-    if not found:
-        die(dedent('''\
-        Could not find the clang shared library in the path {}
-        specified by --with-libclang-path (searched for files {}).
-        '''.format(libclang_path, searched)))
-
-    clang_resolved = find_program(clang_path)
-    if not clang_resolved:
-        die(dedent('''\
-        The argument to --with-clang-path is not a file: {}
-        '''.format(clang_path)))
-
-    return namespace(
-        libclang_path=libclang_path,
-        clang_path=clang_resolved,
-    )
-
-set_config('MOZ_LIBCLANG_PATH', bindgen_config_paths.libclang_path)
-set_config('MOZ_CLANG_PATH', bindgen_config_paths.clang_path)
+    set_config('MOZ_LIBCLANG_PATH', bindgen_config_paths.libclang_path)
+    set_config('MOZ_CLANG_PATH', bindgen_config_paths.clang_path)
 
 option('--with-servo', env='SERVO_TARGET_DIR', nargs=1,
        help='Absolute path of the target directory where libgeckoservo can '
             'be found. This is generally servo_src_dir/target/release.')
 
 @depends_if('--with-servo')
 def servo_target_dir(value):
     return value[0]