- Revision
- 192617
- Author
- youenn.fab...@crf.canon.fr
- Date
- 2015-11-19 00:17:44 -0800 (Thu, 19 Nov 2015)
Log Message
WPT server should use its own testharness.js file and generate a warning when it does not match WebKit version
https://bugs.webkit.org/show_bug.cgi?id=150332
Reviewed by Darin Adler and Ryosuke Niwa.
Removing testharness.js overwriting from LayoutTests/resources to LayoutTests/imported/w3c/web-platform-tests/resources.
Adding support for file comparison in python filesystem.
#NousSommesUnis.
* Scripts/webkitpy/common/system/filesystem.py:
(FileSystem.compare): Adding compare as a wrapper around filecmp.cmp.
* Scripts/webkitpy/common/system/filesystem_mock.py:
(MockFileSystem.compare): Adding a mock compare.
* Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
(WebPlatformTestServer.__init__): Removed testharness.js as file to copy from WK to WPT.
(WebPlatformTestServer._copy_webkit_test_files): Added warning generation when WK testharness.js is not matching WPT version.
* Scripts/webkitpy/layout_tests/servers/web_platform_test_server_unittest.py:
(TestWebPlatformTestServer.test_previously_spawned_instance): Updated tests to add testharness.js to mock filesystem.
(TestWebPlatformTestServer.test_corrupted_subserver_files): Ditto.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (192616 => 192617)
--- trunk/Tools/ChangeLog 2015-11-19 08:05:01 UTC (rev 192616)
+++ trunk/Tools/ChangeLog 2015-11-19 08:17:44 UTC (rev 192617)
@@ -1,3 +1,25 @@
+2015-11-19 Youenn Fablet <youenn.fab...@crf.canon.fr>
+
+ WPT server should use its own testharness.js file and generate a warning when it does not match WebKit version
+ https://bugs.webkit.org/show_bug.cgi?id=150332
+
+ Reviewed by Darin Adler and Ryosuke Niwa.
+
+ Removing testharness.js overwriting from LayoutTests/resources to LayoutTests/imported/w3c/web-platform-tests/resources.
+ Adding support for file comparison in python filesystem.
+ #NousSommesUnis.
+
+ * Scripts/webkitpy/common/system/filesystem.py:
+ (FileSystem.compare): Adding compare as a wrapper around filecmp.cmp.
+ * Scripts/webkitpy/common/system/filesystem_mock.py:
+ (MockFileSystem.compare): Adding a mock compare.
+ * Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
+ (WebPlatformTestServer.__init__): Removed testharness.js as file to copy from WK to WPT.
+ (WebPlatformTestServer._copy_webkit_test_files): Added warning generation when WK testharness.js is not matching WPT version.
+ * Scripts/webkitpy/layout_tests/servers/web_platform_test_server_unittest.py:
+ (TestWebPlatformTestServer.test_previously_spawned_instance): Updated tests to add testharness.js to mock filesystem.
+ (TestWebPlatformTestServer.test_corrupted_subserver_files): Ditto.
+
2015-11-18 Jiewen Tan <jiewen_...@apple.com>
[WK1] Crash loading Blink layout test fast/dom/Window/property-access-on-cached-window-after-frame-removed.html
Modified: trunk/Tools/Scripts/webkitpy/common/system/filesystem.py (192616 => 192617)
--- trunk/Tools/Scripts/webkitpy/common/system/filesystem.py 2015-11-19 08:05:01 UTC (rev 192616)
+++ trunk/Tools/Scripts/webkitpy/common/system/filesystem.py 2015-11-19 08:17:44 UTC (rev 192617)
@@ -31,6 +31,7 @@
import codecs
import errno
import exceptions
+import filecmp
import glob
import hashlib
import os
@@ -304,3 +305,6 @@
def splitext(self, path):
"""Return (dirname + os.sep + basename, '.' + ext)"""
return os.path.splitext(path)
+
+ def compare(self, path1, path2):
+ return filecmp.cmp(path1, path2)
Modified: trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py (192616 => 192617)
--- trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py 2015-11-19 08:05:01 UTC (rev 192616)
+++ trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py 2015-11-19 08:17:44 UTC (rev 192617)
@@ -418,7 +418,10 @@
idx = len(path)
return (path[0:idx], path[idx:])
+ def compare(self, path1, path2):
+ return self.read_binary_file(path1) == self.read_binary_file(path2)
+
class WritableBinaryFileObject(object):
def __init__(self, fs, path):
self.fs = fs
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py (192616 => 192617)
--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py 2015-11-19 08:05:01 UTC (rev 192616)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py 2015-11-19 08:17:44 UTC (rev 192617)
@@ -72,7 +72,7 @@
self._layout_root = port_obj.path_from_webkit_base("LayoutTests")
self._doc_root = self._filesystem.join(self._layout_root, doc_root(port_obj))
- self._resources_files_to_copy = ['testharness.js', 'testharness.css', 'testharnessreport.js']
+ self._resources_files_to_copy = ['testharness.css', 'testharnessreport.js']
current_dir_path = self._filesystem.abspath(self._filesystem.split(__file__)[0])
self._start_cmd = ["python", self._filesystem.join(current_dir_path, "web_platform_test_launcher.py"), self._servers_file]
@@ -99,6 +99,14 @@
config_json = self._filesystem.read_text_file(config_wk_filename).replace("%CERTS_DIR%", self._filesystem.join(self._output_dir, "_wpt_certs"))
self._filesystem.write_text_file(self._filesystem.join(self._doc_root, "config.json"), config_json)
+ wpt_testharnessjs_file = self._filesystem.join(self._doc_root, "resources", "testharness.js")
+ layout_tests_testharnessjs_file = self._filesystem.join(self._layout_root, "resources", "testharness.js")
+ # FIXME: Next two lines are a temp hack for this patch to land smoothly on bots. They should be removed once patch landed and each bot runs these lines once.
+ if (not self._filesystem.isfile(wpt_testharnessjs_file)):
+ self._filesystem.copyfile(layout_tests_testharnessjs_file, wpt_testharnessjs_file)
+ if (not self._filesystem.compare(wpt_testharnessjs_file, layout_tests_testharnessjs_file)):
+ _log.warning("\n//////////\nWPT tests are not using the same testharness.js file as other WebKit Layout tests.\nWebKit testharness.js might need to be updated according WPT testharness.js.\n//////////\n")
+
def _clean_webkit_test_files(self):
_log.debug('Cleaning WPT resources files')
for f in self._resources_files_to_copy:
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server_unittest.py (192616 => 192617)
--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server_unittest.py 2015-11-19 08:05:01 UTC (rev 192616)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server_unittest.py 2015-11-19 08:17:44 UTC (rev 192617)
@@ -42,6 +42,8 @@
server = WebPlatformTestServer(port, "wpttest", "/mock/output_dir", "/mock/output_dir/pid.txt")
server._check_that_all_ports_are_available = lambda: True
server._is_server_running_on_all_ports = lambda: True
+ host.filesystem.write_text_file("/mock-checkout/LayoutTests/resources/testharness.js", "0")
+ host.filesystem.write_text_file("/mock-checkout/LayoutTests/imported/w3c/web-platform-tests/resources/testharness.js", "0")
host.filesystem.write_text_file("/mock_output_dir/pid.txt", "0")
server.start()
@@ -53,6 +55,8 @@
server = WebPlatformTestServer(port, "wpttest", "/mock/output_dir", "/mock/output_dir/pid.txt")
server._check_that_all_ports_are_available = lambda: True
server._is_server_running_on_all_ports = lambda: True
+ host.filesystem.write_text_file("/mock-checkout/LayoutTests/resources/testharness.js", "0")
+ host.filesystem.write_text_file("/mock-checkout/LayoutTests/imported/w3c/web-platform-tests/resources/testharness.js", "0")
host.filesystem.write_text_file("/mock_output_dir/wpttest_servers.json", "0")
server.stop()