Changeset 254383 in webkit


Ignore:
Timestamp:
Jan 10, 2020 5:06:40 PM (4 years ago)
Author:
Jonathan Bedard
Message:

Python3: Support Source/WebKit/Scripts/webkit
https://bugs.webkit.org/show_bug.cgi?id=206078

Reviewed by Stephanie Lewis.

Source/WebKit:

Covered by existing unit tests.

  • Scripts/webkit/LegacyMessages-expected.h: Sort forward declarations.
  • Scripts/webkit/Messages-expected.h: Ditto.
  • Scripts/webkit/messages.py: Sort printed outputs.

Tools:

  • Scripts/test-webkitpy-python3: Call test-webkitpy with Python 3 since

everything is now compatible.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r254381 r254383  
     12020-01-10  Jonathan Bedard  <jbedard@apple.com>
     2
     3        Python3: Support Source/WebKit/Scripts/webkit
     4        https://bugs.webkit.org/show_bug.cgi?id=206078
     5
     6        Reviewed by Stephanie Lewis.
     7
     8        Covered by existing unit tests.
     9
     10        * Scripts/webkit/LegacyMessages-expected.h: Sort forward declarations.
     11        * Scripts/webkit/Messages-expected.h: Ditto.
     12        * Scripts/webkit/messages.py: Sort printed outputs.
     13
    1142020-01-10  Brent Fulgham  <bfulgham@apple.com>
    215
  • trunk/Source/WebKit/Scripts/webkit/LegacyMessages-expected.h

    r251445 r254383  
    4242
    4343namespace IPC {
     44class DummyType;
    4445class MachPort;
    45 class DummyType;
    4646}
    4747
    4848namespace WebKit {
     49class WebPreferencesStore;
    4950class WebTouchEvent;
    50 class WebPreferencesStore;
    5151}
    5252
  • trunk/Source/WebKit/Scripts/webkit/Messages-expected.h

    r251445 r254383  
    4242
    4343namespace IPC {
     44class DummyType;
    4445class MachPort;
    45 class DummyType;
    4646}
    4747
    4848namespace WebKit {
     49class WebPreferencesStore;
    4950class WebTouchEvent;
    50 class WebPreferencesStore;
    5151}
    5252
  • trunk/Source/WebKit/Scripts/webkit/messages.py

    r254194 r254383  
    196196    result = []
    197197    result.append('namespace %s {\n' % namespace)
    198     result += ['%s;\n' % forward_declaration(namespace, x) for x in kind_and_types]
     198    result += ['%s;\n' % forward_declaration(namespace, x) for x in sorted(kind_and_types)]
    199199    result.append('}\n')
    200200    return ''.join(result)
     
    291291        conditions = conditions_for_header(header)
    292292        if conditions and not None in conditions:
    293             header_include = '#if %s\n' % ' || '.join(set(conditions))
     293            header_include = '#if %s\n' % ' || '.join(sorted(set(conditions)))
    294294            header_include += '#include %s\n' % header
    295295            header_include += '#endif\n'
     
    348348        conditions = conditions_for_header(header)
    349349        if conditions and not None in conditions:
    350             header_include = '#if %s\n' % ' || '.join(set(conditions))
     350            header_include = '#if %s\n' % ' || '.join(sorted(set(conditions)))
    351351            header_include += '#include %s\n' % header
    352352            header_include += '#endif\n'
     
    703703    for header in sorted(header_conditions):
    704704        if header_conditions[header] and not None in header_conditions[header]:
    705             result.append('#if %s\n' % ' || '.join(set(header_conditions[header])))
     705            result.append('#if %s\n' % ' || '.join(sorted(set(header_conditions[header]))))
    706706            result += ['#include %s\n' % header]
    707707            result.append('#endif\n')
  • trunk/Tools/ChangeLog

    r254382 r254383  
     12020-01-10  Jonathan Bedard  <jbedard@apple.com>
     2
     3        Python3: Support Source/WebKit/Scripts/webkit
     4        https://bugs.webkit.org/show_bug.cgi?id=206078
     5
     6        Reviewed by Stephanie Lewis.
     7
     8        * Scripts/test-webkitpy-python3: Call test-webkitpy with Python 3 since
     9        everything is now compatible.
     10
    1112020-01-10  Jonathan Bedard  <jbedard@apple.com>
    212
  • trunk/Tools/Scripts/test-webkitpy-python3

    r254340 r254383  
    2222# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2323
     24from webkitpy.common import multiprocessing_bootstrap
    2425
    25 import sys
    26 sys.dont_write_bytecode = True
    27 
    28 import argparse
    29 import os
    30 import sys
    31 import unittest
    32 
    33 from webkitpy.common.checkout.scm.scm_unittest import SCMTest
    34 
    35 
    36 PYTHON3_COMPATIBLE_DIRECTORIES = [
    37   'webkitpy.benchmark_runner',
    38   'webkitpy.browserperfdash',
    39   'webkitpy.common',
    40   'webkitpy.layout_tests',
    41   'webkitpy.performance_tests',
    42   'webkitpy.port',
    43   'webkitpy.results',
    44   'webkitpy.style',
    45   'webkitpy.test',
    46   'webkitpy.tool',
    47   'webkitpy.w3c',
    48   'webkitpy.xcode',
    49 ]
    50 SLOW_TESTS = [
    51     SCMTest,
    52 ]
    53 
    54 def is_slow(candidate):
    55     if isinstance(candidate, unittest.suite.TestSuite):
    56         return any(is_slow(test) for test in candidate)
    57     for test in SLOW_TESTS:
    58         if isinstance(candidate, test):
    59             return True
    60     return False
    61 
    62 
    63 def main():
    64     parser = argparse.ArgumentParser(description='Run unit tests with Python3. This is intended as a temporary script during the Python2/3 transition')
    65     parser.add_argument(
    66         '-v', '--verbose',
    67         default=False, action='store_true',
    68         help='Verbose output',
    69     )
    70     parser.add_argument(
    71         '-f', '--stop-on-fail',
    72         default=False, action='store_true',
    73         help='Stop on first fail or error',
    74     )
    75     parser.add_argument(
    76         '-a', '--all',
    77         default=False, action='store_true',
    78         help='Enables SCM tests, which are slow and so disable by default',
    79     )
    80 
    81     if len(PYTHON3_COMPATIBLE_DIRECTORIES) == 1:
    82         compatible_directories_readable = PYTHON3_COMPATIBLE_DIRECTORIES[0]
    83     else:
    84         compatible_directories_readable = '{} and {}'.format(
    85             ', '.join(PYTHON3_COMPATIBLE_DIRECTORIES[:-1]),
    86             PYTHON3_COMPATIBLE_DIRECTORIES[-1],
    87         )
    88     parser.add_argument(
    89         'modules_to_test', nargs='*',
    90         help='Modules to be tested. By default, this is {}'.format(compatible_directories_readable),
    91         default=PYTHON3_COMPATIBLE_DIRECTORIES,
    92     )
    93     options = parser.parse_args()
    94 
    95     root = os.path.dirname(os.path.abspath(__file__))
    96 
    97     suite = unittest.TestSuite()
    98     for module_name in options.modules_to_test:
    99         module_suite = unittest.defaultTestLoader.discover(os.path.join(root, module_name.replace('.', '/')), pattern='*test.py', top_level_dir=root)
    100         for test in (module_suite or []):
    101             if options.all or not is_slow(test):
    102                 suite.addTest(test)
    103 
    104     if suite.countTestCases() == 0:
    105         raise RuntimeError('No matching tests found.')
    106 
    107     from webkitpy.thirdparty import autoinstall_everything
    108     autoinstall_everything()
    109 
    110     result = unittest.TextTestRunner(verbosity=int(options.verbose) + 1, failfast=options.stop_on_fail, buffer=not options.verbose).run(suite)
    111     return len(result.errors)
    112 
    113 if __name__ == '__main__':
    114     sys.exit(main())
     26multiprocessing_bootstrap.run('webkitpy', 'test', 'main.py')
Note: See TracChangeset for help on using the changeset viewer.