WebKit Bugzilla
Attachment 341663 Details for
Bug 186132
: export-w3c-test-changes can not export reftests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186132-20180531174059.patch (text/plain), 6.91 KB, created by
Frédéric Wang (:fredw)
on 2018-05-31 08:41:00 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Frédéric Wang (:fredw)
Created:
2018-05-31 08:41:00 PDT
Size:
6.91 KB
patch
obsolete
>Subversion Revision: 232288 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 10e9cfbe52c401c9e4b26c80817d4be75b7dac61..ff810c1f1bf9d844ab9f387adc7e02cde4bb1fe4 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,26 @@ >+2018-05-31 Frederic Wang <fwang@igalia.com> >+ >+ export-w3c-test-changes can not export reftests >+ https://bugs.webkit.org/show_bug.cgi?id=186132 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ In WebKit, reftests are pairs of files NAME.html/NAME-expected.html. The expectation should >+ be renamed to NAME-ref.html to follow upstream's conventions. Currently that's not the case >+ and the export is prevented by the lint tool. This commit renames the suffix from -expected >+ to -ref in the WPT patch to apply, so that the export works as expected. >+ >+ * Scripts/webkitpy/w3c/test_exporter.py: Add a list of file suffix used for reftest >+ references. >+ (WebPlatformTestExporter._wpt_patch): Call helper function to rename reftest expectations >+ in the WPT patch. >+ (WebPlatformTestExporter._rename_suffix_from_expected_to_ref): Helper function to rename >+ -expected files to -ref files. >+ (WebPlatformTestExporter._rename_reftest_expectations): Helper function to modify the lines >+ of the WPT patch where "-expected" files are mentioned. >+ * Scripts/webkitpy/w3c/test_exporter_unittest.py: Add a unit test to check renaming in the >+ WPT patch, testing both modified and new tests. >+ > 2018-05-29 Youenn Fablet <youenn@apple.com> > > Add a consistency check between URL and CFURL >diff --git a/Tools/Scripts/webkitpy/w3c/test_exporter.py b/Tools/Scripts/webkitpy/w3c/test_exporter.py >index f762de4647c472fbe60cfe7474cf68569ffb71c4..0c7aa3fafdacd9666cd4c161c1624bc79f16c7a5 100644 >--- a/Tools/Scripts/webkitpy/w3c/test_exporter.py >+++ b/Tools/Scripts/webkitpy/w3c/test_exporter.py >@@ -47,6 +47,7 @@ WPT_PR_URL = "https://github.com/%s/web-platform-tests/pull/" % WPT_GH_ORG > WEBKIT_EXPORT_PR_LABEL = 'webkit-export' > > EXCLUDED_FILE_SUFFIXES = ['-expected.txt', '.worker.html', '.any.html', '.any.worker.html'] >+REFTEST_EXPECTED_SUFFIXES = ['.html', '.htm', '.svg', '.xht', '.xml'] > > > class WebPlatformTestExporter(object): >@@ -143,6 +144,7 @@ class WebPlatformTestExporter(object): > def _wpt_patch(self): > patch_data = self._host.scm().create_patch(self._options.git_commit, [WEBKIT_WPT_DIR]) or '' > patch_data = self._strip_ignored_files_from_diff(patch_data) >+ patch_data = self._rename_reftest_expectations(patch_data) > if not 'diff' in patch_data: > return '' > return patch_data >@@ -174,6 +176,44 @@ class WebPlatformTestExporter(object): > > return '\n'.join(new_lines) > >+ def _rename_suffix_from_expected_to_ref(self, filename): >+ for suffix in REFTEST_EXPECTED_SUFFIXES: >+ if filename.endswith(suffix): >+ return filename.replace("-expected%s" % suffix, "-ref%s" % suffix) >+ return filename >+ >+ def _rename_reftest_expectations(self, diff): >+ lines = diff.split('\n') >+ new_lines = [] >+ filenameA = None >+ renamedA = None >+ filenameB = None >+ renamedB = None >+ for line in lines: >+ if line.startswith('diff'): >+ assert filenameA is None >+ assert filenameB is None >+ [filenameA, filenameB] = line.split(' ')[-2:] >+ renamedA = self._rename_suffix_from_expected_to_ref(filenameA) >+ renamedB = self._rename_suffix_from_expected_to_ref(filenameB) >+ if renamedA != filenameA or renamedB != filenameB: >+ line = self._rename_suffix_from_expected_to_ref(line) >+ else: >+ filenameA = None >+ filenameB = None >+ elif filenameA and line.startswith('---'): >+ if line == '--- %s' % filenameA: >+ line = '--- %s' % renamedA >+ filenameA = None >+ elif filenameB and line.startswith('+++'): >+ if line == '+++ %s' % filenameB: >+ line = '+++ %s' % renamedB >+ filenameB = None >+ >+ new_lines.append(line) >+ >+ return '\n'.join(new_lines) >+ > def write_git_patch_file(self): > _, patch_file = self._filesystem.open_binary_tempfile('wpt_export_patch') > patch_data = self._wpt_patch >diff --git a/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py b/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py >index a6ad8fca158aba8f00e59910e9661ab5adb7bf38..02a9c8c9187bf524417e62b70dc859a039cfd476 100644 >--- a/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py >+++ b/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py >@@ -223,3 +223,37 @@ diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/heade > options = parse_args(['test_exporter.py', '-g', 'HEAD', '-b', '1234', '-c', '-n', 'USER', '-t', 'TOKEN']) > exporter = WebPlatformTestExporter(host, options, TestExporterTest.MockGit, TestExporterTest.MockBugzilla, MockWPTGitHub, TestExporterTest.MockWPTLinter) > self.assertFalse(exporter.has_wpt_changes()) >+ >+ def test_renaming_of_reftests(self): >+ host = TestExporterTest.MyMockHost() >+ host._mockSCM.mock_format_patch_result = """ >+diff --git a/LayoutTests/imported/w3c/web-platform-tests/NAME-expected.html b/LayoutTests/imported/w3c/web-platform-tests/NAME-expected.html >+index 16ccb312c41..eade2f8672e 100644 >+--- a/LayoutTests/imported/w3c/web-platform-tests/NAME-expected.html >++++ b/LayoutTests/imported/w3c/web-platform-tests/NAME-expected.html >+@@ -3,7 +3,7 @@ >++change to expected >+diff --git a/LayoutTests/imported/w3c/web-platform-tests/NAME.html b/LayoutTests/imported/w3c/web-platform-tests/NAME.html >+index 16ccb312c41..eade2f8672e 100644 >+--- a/LayoutTests/imported/w3c/web-platform-tests/NAME.html >++++ b/LayoutTests/imported/w3c/web-platform-tests/NAME.html >+@@ -3,7 +3,7 @@ >++change to reftest >+diff --git a/LayoutTests/imported/w3c/web-platform-tests/NEW-expected.htm b/LayoutTests/imported/w3c/web-platform-tests/NEW-expected.htm >+new file mode 100644 >+index 00000000000..eade2f8672e >+--- /dev/null >++++ b/LayoutTests/imported/w3c/web-platform-tests/NEW-expected.htm >+@@ -0,0 +1,1 @@ >++new expected >+diff --git a/LayoutTests/imported/w3c/web-platform-tests/NEW.htm b/LayoutTests/imported/w3c/web-platform-tests/NEW.htm >+new file mode 100644 >+index 00000000000..eade2f8672e >+--- /dev/null >++++ b/LayoutTests/imported/w3c/web-platform-tests/NEW.htm >+@@ -0,0 +1,1 @@ >++new reftest >+""" >+ options = parse_args(['test_exporter.py', '-g', 'HEAD', '-b', '1234', '-c', '-n', 'USER', '-t', 'TOKEN']) >+ exporter = WebPlatformTestExporter(host, options, TestExporterTest.MockGit, TestExporterTest.MockBugzilla, MockWPTGitHub, TestExporterTest.MockWPTLinter) >+ self.assertEquals(exporter._wpt_patch, host._mockSCM.mock_format_patch_result.replace("-expected", "-ref"))
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186132
: 341663