Changeset 234997 in webkit


Ignore:
Timestamp:
Aug 17, 2018 2:43:31 PM (6 years ago)
Author:
Jonathan Bedard
Message:

Add back --wtf-only to run-api-tests
https://bugs.webkit.org/show_bug.cgi?id=187893
<rdar://problem/42483983>

Reviewed by Aakash Jain.

When doing WTF development, it is not necessary to build or run all of the API
tests. Generally, if a user has specified a specific binary (or binaries) that
they are interested in testing, it is not necessary to check all API test binaries.

  • Scripts/webkitpy/api_tests/manager.py:

(Manager._collect_tests): Only use the binaries matching the program arguments
when collecting tests.
(Manager._binaries_for_arguments): Generate a list of binaries which match the
program arguments.
(Manager.run): Pass a list binaries to check.

  • Scripts/webkitpy/api_tests/run_api_tests.py:

(parse_args):

  • Scripts/webkitpy/port/base.py:

(Port.check_api_test_build): If the caller specifies which API test binaries it
requires, only check the ones specified.
(Port.path_to_api_test_binaries): Allow the caller to only build the WTF API tests.
(Port._build_api_tests): Allow the caller to only build the WTF API tests.

  • Scripts/webkitpy/port/win.py:

(WinPort.path_to_api_test_binaries):

Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r234986 r234997  
     12018-08-17  Jonathan Bedard  <jbedard@apple.com>
     2
     3        Add back --wtf-only to run-api-tests
     4        https://bugs.webkit.org/show_bug.cgi?id=187893
     5        <rdar://problem/42483983>
     6
     7        Reviewed by Aakash Jain.
     8
     9        When doing WTF development, it is not necessary to build or run all of the API
     10        tests. Generally, if a user has specified a specific binary (or binaries) that
     11        they are interested in testing, it is not necessary to check all API test binaries.
     12
     13        * Scripts/webkitpy/api_tests/manager.py:
     14        (Manager._collect_tests): Only use the binaries matching the program arguments
     15        when collecting tests.
     16        (Manager._binaries_for_arguments): Generate a list of binaries which match the
     17        program arguments.
     18        (Manager.run): Pass a list binaries to check.
     19        * Scripts/webkitpy/api_tests/run_api_tests.py:
     20        (parse_args):
     21        * Scripts/webkitpy/port/base.py:
     22        (Port.check_api_test_build): If the caller specifies which API test binaries it
     23        requires, only check the ones specified.
     24        (Port.path_to_api_test_binaries): Allow the caller to only build the WTF API tests.
     25        (Port._build_api_tests): Allow the caller to only build the WTF API tests.
     26        * Scripts/webkitpy/port/win.py:
     27        (WinPort.path_to_api_test_binaries):
     28
    1292018-08-17  Jer Noble  <jer.noble@apple.com>
    230
  • trunk/Tools/Scripts/webkitpy/api_tests/manager.py

    r231039 r234997  
    8888    def _collect_tests(self, args):
    8989        available_tests = []
    90         for binary in self._port.path_to_api_test_binaries():
    91             stripped_name = os.path.splitext(os.path.basename(binary))[0]
     90        specified_binaries = self._binaries_for_arguments(args)
     91        for canonicalized_binary, path in self._port.path_to_api_test_binaries().iteritems():
     92            if canonicalized_binary not in specified_binaries:
     93                continue
    9294            try:
    9395                output = self.host.executive.run_command(
    94                     Runner.command_for_port(self._port, [binary, '--gtest_list_tests']),
     96                    Runner.command_for_port(self._port, [path, '--gtest_list_tests']),
    9597                    env=self._port.environment_for_api_tests())
    96                 available_tests += Manager._test_list_from_output(output, '{}.'.format(stripped_name))
     98                available_tests += Manager._test_list_from_output(output, '{}.'.format(canonicalized_binary))
    9799            except ScriptError:
    98                 _log.error('Failed to list {} tests'.format(stripped_name))
     100                _log.error('Failed to list {} tests'.format(canonicalized_binary))
    99101                raise
    100102
     
    131133            raise RuntimeError('Running api tests on {} is not supported'.format(self._port.port_name))
    132134
     135    def _binaries_for_arguments(self, args):
     136        if self._port.get_option('api_binary'):
     137            return self._port.get_option('api_binary')
     138
     139        binaries = []
     140        for arg in args:
     141            candidate_binary = arg.split('.')[0]
     142            if candidate_binary in binaries:
     143                continue
     144            if candidate_binary in self._port.path_to_api_test_binaries():
     145                binaries.append(candidate_binary)
     146            else:
     147                # If the user specifies a test-name without a binary, we need to search both binaries
     148                return self._port.path_to_api_test_binaries().keys()
     149        return binaries or self._port.path_to_api_test_binaries().keys()
     150
    133151    def run(self, args):
    134152        self._stream.write_update('Checking build ...')
    135         if not self._port.check_api_test_build():
     153        if not self._port.check_api_test_build(self._binaries_for_arguments(args)):
    136154            _log.error('Build check failed')
    137155            return Manager.FAILED_BUILD_CHECK
  • trunk/Tools/Scripts/webkitpy/api_tests/run_api_tests.py

    r234962 r234997  
    103103
    104104    option_group_definitions.append(('Testing Options', [
     105        optparse.make_option('--wtf-only', action='store_const', const='TestWTF', dest='api_binary',
     106                             help='Only build, check and run TestWTF'),
    105107        optparse.make_option('-d', '--dump', action='store_true', default=False,
    106108                             help='Dump all test names without running them'),
  • trunk/Tools/Scripts/webkitpy/port/base.py

    r234863 r234997  
    241241        return True
    242242
    243     def check_api_test_build(self):
    244         if not self._root_was_set and self.get_option('build') and not self._build_api_tests():
     243    def check_api_test_build(self, canonicalized_binaries=None):
     244        if not canonicalized_binaries:
     245            canonicalized_binaries = self.path_to_api_test_binaries().keys()
     246        if not self._root_was_set and self.get_option('build') and not self._build_api_tests(wtf_only=(canonicalized_binaries == ['TestWTF'])):
    245247            return False
    246248        if self.get_option('install') and not self._check_port_build():
    247249            return False
    248250
    249         for binary in self.path_to_api_test_binaries():
    250             if not self._filesystem.exists(binary):
    251                 _log.error('{} was not found at {}'.format(os.path.basename(binary), binary))
     251        for binary, path in self.path_to_api_test_binaries().iteritems():
     252            if binary not in canonicalized_binaries:
     253                continue
     254            if not self._filesystem.exists(path):
     255                _log.error('{} was not found at {}'.format(os.path.basename(path), path))
    252256                return False
    253257        return True
     
    13711375
    13721376    def path_to_api_test_binaries(self):
    1373         binary_names = ['TestWTF']
    1374         if self.host.platform.is_win():
    1375             binary_names += ['TestWebCore', 'TestWebKitLegacy']
    1376         else:
    1377             binary_names += ['TestWebKitAPI']
    1378         binary_paths = [self._build_path(binary_name) for binary_name in binary_names]
    1379         if self.host.platform.is_win():
    1380             binary_paths = [os.path.splitext(binary_path)[0] + '.exe' for binary_path in binary_paths]
    1381         return binary_paths
     1377        return {binary: self._build_path(binary) for binary in ['TestWTF', 'TestWebKitAPI']}
    13821378
    13831379    def _path_to_lighttpd(self):
     
    15061502        return True
    15071503
    1508     def _build_api_tests(self):
     1504    def _build_api_tests(self, wtf_only=False):
    15091505        environment = self.host.copy_current_environment().to_dictionary()
    15101506        try:
    1511             self._run_script('build-api-tests', args=self._build_driver_flags(), env=environment)
     1507            self._run_script('build-api-tests', args=(['--wtf-only'] if wtf_only else []) + self._build_driver_flags(), env=environment)
    15121508        except ScriptError as e:
    15131509            _log.error(e.message_with_output(output_limit=None))
  • trunk/Tools/Scripts/webkitpy/port/win.py

    r234863 r234997  
    213213        return self._build_path('ImageDiff.exe')
    214214
     215    def path_to_api_test_binaries(self):
     216        return {binary.split('.')[0]: self._build_path(binary) for binary in ['TestWTF.exe', 'TestWebCore.exe', 'TestWebKitLegacy.exe']}
     217
    215218    def test_search_path(self):
    216219        test_fallback_names = [path for path in self.baseline_search_path() if not path.startswith(self._webkit_baseline_path('mac'))]
Note: See TracChangeset for help on using the changeset viewer.