Changeset 177727 in webkit


Ignore:
Timestamp:
Dec 24, 2014 4:54:11 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

W3C test importer should have an option to disable testharness.js/testharnessreport.js link conversion
https://bugs.webkit.org/show_bug.cgi?id=134763

Patch by Youenn Fablet <youenn.fablet@crf.canon.fr> on 2014-12-24
Reviewed by Ryosuke Niwa.

Adding an option to disable test harness link conversion.

  • Scripts/webkitpy/w3c/test_converter.py:

(convert_for_webkit):
(_W3CTestConverter.init):
(_W3CTestConverter.convert_attributes_if_needed):

  • Scripts/webkitpy/w3c/test_importer.py:

(parse_args):
(TestImporter.import_tests):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r177722 r177727  
     12014-12-24  Youenn Fablet  <youenn.fablet@crf.canon.fr>
     2
     3        W3C test importer should have an option to disable testharness.js/testharnessreport.js link conversion
     4        https://bugs.webkit.org/show_bug.cgi?id=134763
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Adding an option to disable test harness link conversion.
     9
     10        * Scripts/webkitpy/w3c/test_converter.py:
     11        (convert_for_webkit):
     12        (_W3CTestConverter.__init__):
     13        (_W3CTestConverter.convert_attributes_if_needed):
     14        * Scripts/webkitpy/w3c/test_importer.py:
     15        (parse_args):
     16        (TestImporter.import_tests):
     17
    1182014-12-23  Alexey Proskuryakov  <ap@apple.com>
    219
  • trunk/Tools/Scripts/webkitpy/w3c/test_converter.py

    r175257 r177727  
    3838
    3939
    40 def convert_for_webkit(new_path, filename, reference_support_info, host=Host()):
     40def convert_for_webkit(new_path, filename, reference_support_info, host=Host(), convert_test_harness_links=True):
    4141    """ Converts a file's |contents| so it will function correctly in its |new_path| in Webkit.
    4242
    4343    Returns the list of modified properties and the modified text if the file was modifed, None otherwise."""
    4444    contents = host.filesystem.read_binary_file(filename)
    45     converter = _W3CTestConverter(new_path, filename, reference_support_info, host)
     45    converter = _W3CTestConverter(new_path, filename, reference_support_info, host, convert_test_harness_links)
    4646    if filename.endswith('.css'):
    4747        return converter.add_webkit_prefix_to_unprefixed_properties_and_values(contents)
     
    5353
    5454class _W3CTestConverter(HTMLParser):
    55     def __init__(self, new_path, filename, reference_support_info, host=Host()):
     55    def __init__(self, new_path, filename, reference_support_info, host=Host(), convert_test_harness_links=True):
    5656        HTMLParser.__init__(self)
    5757
     
    7171        resources_relpath = self._filesystem.relpath(resources_path, new_path)
    7272        self.new_test_harness_path = resources_relpath
     73        self.convert_test_harness_links = convert_test_harness_links
    7374
    7475        # These settings might vary between WebKit and Blink
     
    166167    def convert_attributes_if_needed(self, tag, attrs):
    167168        converted = self.get_starttag_text()
    168         if tag in ('script', 'link'):
     169        if self.convert_test_harness_links and tag in ('script', 'link'):
    169170            attr_name = 'src'
    170171            if tag != 'script':
  • trunk/Tools/Scripts/webkitpy/w3c/test_importer.py

    r174672 r177727  
    121121def parse_args():
    122122    parser = optparse.OptionParser(usage='usage: %prog [options] w3c_test_directory')
     123
    123124    parser.add_option('-n', '--no-overwrite', dest='overwrite', action='store_false', default=True,
    124125        help='Flag to prevent duplicate test files from overwriting existing tests. By default, they will be overwritten')
     126    parser.add_option('-l', '--no-links-conversion', dest='convert_test_harness_links', action='store_false', default=True,
     127        help='Do not change links (testharness js or css e.g.). By default, links are converted to point to WebKit testharness files.')
     128
    125129    parser.add_option('-a', '--all', action='store_true', default=False,
    126130        help='Import all tests including reftests, JS tests, and manual/pixel tests. By default, only reftests and JS tests are imported')
     
    301305                if 'html' in str(mimetype[0]) or 'xml' in str(mimetype[0])  or 'css' in str(mimetype[0]):
    302306                    try:
    303                         converted_file = convert_for_webkit(new_path, filename=orig_filepath, reference_support_info=reference_support_info)
     307                        converted_file = convert_for_webkit(new_path, filename=orig_filepath, reference_support_info=reference_support_info, convert_test_harness_links=self.options.convert_test_harness_links)
    304308                    except:
    305309                        _log.warn('Failed converting %s', orig_filepath)
Note: See TracChangeset for help on using the changeset viewer.