Title: [177727] trunk/Tools
Revision
177727
Author
[email protected]
Date
2014-12-24 16:54:11 -0800 (Wed, 24 Dec 2014)

Log 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 <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (177726 => 177727)


--- trunk/Tools/ChangeLog	2014-12-25 00:21:52 UTC (rev 177726)
+++ trunk/Tools/ChangeLog	2014-12-25 00:54:11 UTC (rev 177727)
@@ -1,3 +1,20 @@
+2014-12-24  Youenn Fablet  <[email protected]>
+
+        W3C test importer should have an option to disable testharness.js/testharnessreport.js link conversion
+        https://bugs.webkit.org/show_bug.cgi?id=134763
+
+        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):
+
 2014-12-23  Alexey Proskuryakov  <[email protected]>
 
         DumpRenderTree crashes are mis-reported as timeouts on Yosemite

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_converter.py (177726 => 177727)


--- trunk/Tools/Scripts/webkitpy/w3c/test_converter.py	2014-12-25 00:21:52 UTC (rev 177726)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_converter.py	2014-12-25 00:54:11 UTC (rev 177727)
@@ -37,12 +37,12 @@
 _log = logging.getLogger(__name__)
 
 
-def convert_for_webkit(new_path, filename, reference_support_info, host=Host()):
+def convert_for_webkit(new_path, filename, reference_support_info, host=Host(), convert_test_harness_links=True):
     """ Converts a file's |contents| so it will function correctly in its |new_path| in Webkit.
 
     Returns the list of modified properties and the modified text if the file was modifed, None otherwise."""
     contents = host.filesystem.read_binary_file(filename)
-    converter = _W3CTestConverter(new_path, filename, reference_support_info, host)
+    converter = _W3CTestConverter(new_path, filename, reference_support_info, host, convert_test_harness_links)
     if filename.endswith('.css'):
         return converter.add_webkit_prefix_to_unprefixed_properties_and_values(contents)
     else:
@@ -52,7 +52,7 @@
 
 
 class _W3CTestConverter(HTMLParser):
-    def __init__(self, new_path, filename, reference_support_info, host=Host()):
+    def __init__(self, new_path, filename, reference_support_info, host=Host(), convert_test_harness_links=True):
         HTMLParser.__init__(self)
 
         self._host = host
@@ -70,6 +70,7 @@
         resources_path = self.path_from_webkit_root('LayoutTests', 'resources')
         resources_relpath = self._filesystem.relpath(resources_path, new_path)
         self.new_test_harness_path = resources_relpath
+        self.convert_test_harness_links = convert_test_harness_links
 
         # These settings might vary between WebKit and Blink
         self._css_property_file = self.path_from_webkit_root('Source', 'WebCore', 'css', 'CSSPropertyNames.in')
@@ -165,7 +166,7 @@
 
     def convert_attributes_if_needed(self, tag, attrs):
         converted = self.get_starttag_text()
-        if tag in ('script', 'link'):
+        if self.convert_test_harness_links and tag in ('script', 'link'):
             attr_name = 'src'
             if tag != 'script':
                 attr_name = 'href'

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_importer.py (177726 => 177727)


--- trunk/Tools/Scripts/webkitpy/w3c/test_importer.py	2014-12-25 00:21:52 UTC (rev 177726)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_importer.py	2014-12-25 00:54:11 UTC (rev 177727)
@@ -120,8 +120,12 @@
 
 def parse_args():
     parser = optparse.OptionParser(usage='usage: %prog [options] w3c_test_directory')
+
     parser.add_option('-n', '--no-overwrite', dest='overwrite', action='', default=True,
         help='Flag to prevent duplicate test files from overwriting existing tests. By default, they will be overwritten')
+    parser.add_option('-l', '--no-links-conversion', dest='convert_test_harness_links', action='', default=True,
+        help='Do not change links (testharness js or css e.g.). By default, links are converted to point to WebKit testharness files.')
+
     parser.add_option('-a', '--all', action='', default=False,
         help='Import all tests including reftests, JS tests, and manual/pixel tests. By default, only reftests and JS tests are imported')
     parser.add_option('-d', '--dest-dir', dest='destination', default='w3c',
@@ -300,7 +304,7 @@
                 mimetype = mimetypes.guess_type(orig_filepath)
                 if 'html' in str(mimetype[0]) or 'xml' in str(mimetype[0])  or 'css' in str(mimetype[0]):
                     try:
-                        converted_file = convert_for_webkit(new_path, filename=orig_filepath, reference_support_info=reference_support_info)
+                        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)
                     except:
                         _log.warn('Failed converting %s', orig_filepath)
                         failed_conversion_files.append(orig_filepath)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to