⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245981 in webkit


Ignore:
Timestamp:
May 31, 2019, 1:52:31 PM (7 years ago)
Author:
Dewei Zhu
Message:

run-benchmark should report an error if the argument to --build-directory is bogus
https://bugs.webkit.org/show_bug.cgi?id=198316

Reviewed by Ryosuke Niwa.

'run-benchmark' should not fallback to system safari when browser or browser build path is
specified but not valid.
Add a run-time check to ensure at least one of the resource from build directory is opened by
Safari when build directory is specified.

  • Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:

(OSXSafariDriver.launch_url): Raise an exception when browser or browser build path is
specified but not valid.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r245979 r245981  
     12019-05-28  Dewei Zhu  <dewei_zhu@apple.com>
     2
     3        run-benchmark should report an error if the argument to --build-directory is bogus
     4        https://bugs.webkit.org/show_bug.cgi?id=198316
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        'run-benchmark' should not fallback to system safari when browser or browser build path is
     9        specified but not valid.
     10        Add a run-time check to ensure at least one of the resource from build directory is opened by
     11        Safari when build directory is specified.
     12
     13        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
     14        (OSXSafariDriver.launch_url): Raise an exception when browser or browser build path is
     15        specified but not valid.
     16
    1172019-05-31  Tim Horton  <timothy_horton@apple.com>
    218
  • trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py

    r242653 r245981  
    11#!/usr/bin/env python
    22
     3import itertools
    34import logging
    45import os
     
    2829        env = {}
    2930        if browser_build_path:
    30             safari_app_in_build_path = os.path.join(browser_build_path, 'Safari.app/Contents/MacOS/Safari')
    31             if os.path.exists(safari_app_in_build_path):
     31            browser_build_absolute_path = os.path.abspath(browser_build_path)
     32            safari_app_in_build_path = os.path.join(browser_build_absolute_path, 'Safari.app/Contents/MacOS/Safari')
     33            has_safari_app = os.path.exists(safari_app_in_build_path)
     34            content_in_path = os.listdir(browser_build_absolute_path)
     35            contains_frameworks = any(itertools.imap(lambda entry: entry.endswith('.framework'), os.listdir(browser_build_absolute_path)))
     36
     37            if has_safari_app:
    3238                args = [safari_app_in_build_path]
    33                 env = {'DYLD_FRAMEWORK_PATH': browser_build_path, 'DYLD_LIBRARY_PATH': browser_build_path, '__XPC_DYLD_FRAMEWORK_PATH': browser_build_path, '__XPC_DYLD_LIBRARY_PATH': browser_build_path}
    34             else:
    35                 _log.info('Could not find Safari.app at %s, using the system Safari instead' % safari_app_in_build_path)
     39
     40            if contains_frameworks:
     41                env = {'DYLD_FRAMEWORK_PATH': browser_build_absolute_path, 'DYLD_LIBRARY_PATH': browser_build_absolute_path,
     42                    '__XPC_DYLD_FRAMEWORK_PATH': browser_build_absolute_path, '__XPC_DYLD_LIBRARY_PATH': browser_build_absolute_path}
     43            elif not has_safari_app:
     44                raise Exception('Could not find any framework "{}"'.format(browser_build_path))
     45
    3646        elif browser_path:
    3747            safari_app_in_browser_path = os.path.join(browser_path, 'Contents/MacOS/Safari')
     
    3949                args = [safari_app_in_browser_path]
    4050            else:
    41                 _log.info('Could not find application at %s, using the system Safari instead' % safari_app_in_browser_path)
     51                raise Exception('Could not find Safari.app at {}'.format(safari_app_in_browser_path))
    4252
    4353        args.extend(self._safari_preferences)
     
    4858        # command may use the system safari.
    4959        time.sleep(3)
     60
     61        if browser_build_path:
     62            _log.info('Checking if any open file is from "{}".'.format(browser_build_path))
     63            # Cannot use 'check_call' here as '+D' option will have non-zero return code when not all files under
     64            # specified folder are used.
     65            process = subprocess.Popen(['/usr/sbin/lsof', '-a', '-p', str(self._safari_process.pid), '+D', browser_build_absolute_path], stdout=subprocess.PIPE)
     66            output = process.communicate()[0]
     67            if has_safari_app:
     68                assert 'Safari.app/Contents/MacOS/Safari' in output, 'Safari.app is not launched from "{}"'.format(browser_build_path)
     69            if contains_frameworks:
     70                assert '.framework' in output, 'No framework is loaded from "{}"'.format(browser_build_path)
     71
    5072        subprocess.Popen(['open', '-a', args[0], url])
    5173
Note: See TracChangeset for help on using the changeset viewer.