Bug 127094

Summary: Integrate WP python server into WebKit test framework
Product: WebKit Reporter: youenn fablet <youennf>
Component: Tools / TestsAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, bjonesbe, commit-queue, glenn, james, lforschler, matthew_hanson, mike, rniwa, zan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
WIP
none
Functional version
none
Added auto-install and unit tests
none
fixed default websocket handlers path
none
WIP: Removed wptserve autoinstall and direct use of imported W3C repo wptserve
none
some clean up
none
updated according bug 134763 discussions
none
Updated according review
none
Patch
none
Improving variable names
none
Updating SSL support
none
fixing change log none

youenn fablet
Reported 2014-01-16 03:01:49 PST
Some Web Platform tests (for instance https://github.com/w3c/web-platform-tests/tree/master/XMLHttpRequest) require interaction with WP python server (https://github.com/w3c/wptserve). This server should be used to serve the LayoutTests/imported/w3c tests.
Attachments
WIP (1.10 MB, patch)
2014-01-20 09:28 PST, youenn fablet
no flags
Functional version (22.63 KB, patch)
2014-01-28 11:49 PST, youenn fablet
no flags
Added auto-install and unit tests (43.96 KB, patch)
2014-01-30 14:06 PST, youenn fablet
no flags
fixed default websocket handlers path (44.01 KB, patch)
2014-02-14 00:56 PST, youenn fablet
no flags
WIP: Removed wptserve autoinstall and direct use of imported W3C repo wptserve (35.35 KB, patch)
2014-06-19 08:09 PDT, youenn fablet
no flags
some clean up (37.50 KB, patch)
2014-09-16 00:13 PDT, youenn fablet
no flags
updated according bug 134763 discussions (37.14 KB, patch)
2014-09-26 06:34 PDT, youenn fablet
no flags
Updated according review (36.16 KB, patch)
2014-12-19 10:59 PST, youenn fablet
no flags
Patch (36.32 KB, patch)
2014-12-23 06:47 PST, youenn fablet
no flags
Improving variable names (36.36 KB, patch)
2014-12-29 12:08 PST, youenn fablet
no flags
Updating SSL support (37.08 KB, patch)
2015-01-13 06:36 PST, youenn fablet
no flags
fixing change log (37.05 KB, patch)
2015-01-26 11:48 PST, youenn fablet
no flags
youenn fablet
Comment 1 2014-01-20 09:28:36 PST
youenn fablet
Comment 2 2014-01-20 09:36:16 PST
First patch implements the support as follows: - The wpt server is started for all tests inside imported/w3c - The doc_root of the server is set to imported/w3c - A specific route is added to serve LayoutTests/resources scripts for all urls starting as /resource/*. - Running the server reuses as much as possible the web-platform-test serve.py script I needed to make some small modifications to wptserver and serve.py. Once stabilized, I hope they can be upstreamed to the respective projects
James Graham
Comment 3 2014-01-20 10:10:41 PST
> I needed to make some small modifications to wptserver and serve.py. > Once stabilized, I hope they can be upstreamed to the respective projects It would be great if you could make a PR on github for these asap, even if they are not stable yet. That way we can make sure that this work goes in a direction that works for everyone, rather than having nasty surprises later.
youenn fablet
Comment 4 2014-01-21 00:05:09 PST
(In reply to comment #3) > > I needed to make some small modifications to wptserver and serve.py. > > Once stabilized, I hope they can be upstreamed to the respective projects > > It would be great if you could make a PR on github for these asap, even if they are not stable yet. That way we can make sure that this work goes in a direction that works for everyone, rather than having nasty surprises later. Done: https://github.com/w3c/web-platform-tests/pull/540 https://github.com/w3c/wptserve/pull/3
youenn fablet
Comment 5 2014-01-28 11:49:05 PST
Created attachment 222470 [details] Functional version The patch only contains webkit specific files.
Ryosuke Niwa
Comment 6 2014-01-28 19:38:13 PST
Comment on attachment 222470 [details] Functional version View in context: https://bugs.webkit.org/attachment.cgi?id=222470&action=review We should probably auto-install wptserve in third_party directory. > Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:77 > + self._needs_wpt = None We should probably use the full name "wptserve" or web_platform_test_server. I would prefer using the full name. > Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:212 > + self._printer.write_update('Starting WPT server ...') Can we either call it "wptserve" or "Web Platform Test Server"? > Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:225 > + self._printer.write_update('Stopping WPT server ...') Ditto. > Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py:292 > + option_group_definitions.append(("Web Platform Tests Options", [ Nit: "Web Platform Test Server Options" > Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py:293 > + optparse.make_option("--wpt-dir", type="string", default=os.path.join("imported", "w3c"), We should probably use "--wptserve" or "--wpts" as the prefix. > Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py:294 > + help=("set web platform server document root, relative to LayoutTests directory")), Nit: Please capitalize "set" and ditto for other help texts. > Tools/Scripts/webkitpy/layout_tests/servers/wpt/launcher.py:1 > +"""Script to set up and launch web platform test servers in the context of WebKit framework.""" We don't add these comments to new files. It should be self-explanatory from the file name. For that reason, I would prefer naming it web_platform_test_server instead of wpt.
youenn fablet
Comment 7 2014-01-30 14:06:38 PST
Created attachment 222731 [details] Added auto-install and unit tests
youenn fablet
Comment 8 2014-02-10 00:04:10 PST
ping review?
youenn fablet
Comment 9 2014-02-14 00:56:38 PST
Created attachment 224176 [details] fixed default websocket handlers path
youenn fablet
Comment 10 2014-06-19 08:09:07 PDT
Created attachment 233360 [details] WIP: Removed wptserve autoinstall and direct use of imported W3C repo wptserve
youenn fablet
Comment 11 2014-09-16 00:13:36 PDT
Created attachment 238156 [details] some clean up
youenn fablet
Comment 12 2014-09-26 06:34:45 PDT
Created attachment 238712 [details] updated according bug 134763 discussions
Ryosuke Niwa
Comment 13 2014-12-17 20:04:27 PST
Comment on attachment 238712 [details] updated according bug 134763 discussions View in context: https://bugs.webkit.org/attachment.cgi?id=238712&action=review > Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_launcher.py:1 > +# Copyright (c) 2014, Canon Inc. All rights reserved. Isn't this copyrighted by someone else since you're copying code from serve.py? Also, what's the license of serve.py? Is that BSD? > Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_launcher.py:35 > +sys.path.insert(1, ".") > +import serve as WebPlatformTestServer Can't we use imp.load_module instead since we're loading one module? > Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_launcher.py:51 > + # Wait until: > + # 1. user presses enter (in case script executed in command line) > + # 2. the master process sends enter (regular stop command) > + # 3. the master process is stopped (and stdin is closed) It seems like this comment just repeats what the code below says, and it's also somewhat inaccurate. I'd prefer leaving it out instead. > Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:44 > + def __init__(self, port_obj, name, output_dir, pidfile=None): > + """Args: > + output_dir: the absolute path to the layout test result directory > + """ Instead of adding a comment like that, rename output_dir to layout_test_results_dir or something. > Tools/Scripts/webkitpy/port/base.py:911 > + """Start a web server. Raise an error if it can't start or is already running. > + > + Ports can stub this out if they don't need a web server to be running.""" We don't normally add comments like this. Please remove it. > Tools/Scripts/webkitpy/port/base.py:950 > + """Shut down the web platform test server if it is running. Do nothing if it isn't.""" Ditto. > Tools/Scripts/webkitpy/port/driver.py:161 > + self.web_platform_test_dir = self._port.web_platform_test_server_doc_root() + "/" > + Why do we need to manually append '/'? > Tools/Scripts/webkitpy/port/driver.py:236 > + # Any change to WPT_BASE_URL should be synced with LayoutTests/imported/w3c/resources/config.json > + WPT_BASE_URL = "http://localhost:8800/" Can we read this value out of config.json instead? > Tools/Scripts/webkitpy/port/driver.py:402 > + elif self.is_http_test(driver_input.test_name) or self.is_web_platform_test(driver_input.test_name): There are two spaces after or. > Tools/Scripts/webkitpy/port/driver_unittest.py:89 > + Superflous change here.
youenn fablet
Comment 14 2014-12-18 09:29:22 PST
(In reply to comment #13) > Comment on attachment 238712 [details] > updated according bug 134763 discussions > > View in context: > https://bugs.webkit.org/attachment.cgi?id=238712&action=review > > > Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_launcher.py:1 > > +# Copyright (c) 2014, Canon Inc. All rights reserved. > > Isn't this copyrighted by someone else since you're copying code from > serve.py? > Also, what's the license of serve.py? Is that BSD? Thanks for the review. The license is BSD: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html Concerning the copyright, I am not sure what should be done. There is no copyright in the original serve.py and I read somewhere that all new source/script files added to WebKit should have copyright. I can make an explicit reference to the fact that most code is borrowed from W3C serve.py.
Ryosuke Niwa
Comment 15 2014-12-18 14:53:25 PST
(In reply to comment #14) > > The license is BSD: > http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html > > Concerning the copyright, I am not sure what should be done. > There is no copyright in the original serve.py and I read somewhere that all > new source/script files added to WebKit should have copyright. I can make an > explicit reference to the fact that most code is borrowed from W3C serve.py. Cam we ask James Graham <james@hoppipolla.co.uk> about that? As I understand it, he is the primary author of WPT.
James Graham
Comment 16 2014-12-19 08:19:34 PST
I suggest we add some text like # This Source Code Form is subject to the terms of the 3-cluase BSD License # http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html to the top of the files upstream. Would that be sufficient to meet your requirements?
youenn fablet
Comment 17 2014-12-19 10:39:02 PST
Comment on attachment 238712 [details] updated according bug 134763 discussions View in context: https://bugs.webkit.org/attachment.cgi?id=238712&action=review >> Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_launcher.py:35 >> +import serve as WebPlatformTestServer > > Can't we use imp.load_module instead since we're loading one module? WebPlatformTestServer is using other modules located in wpt tools folder. >> Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_launcher.py:51 >> + # 3. the master process is stopped (and stdin is closed) > > It seems like this comment just repeats what the code below says, and it's also somewhat inaccurate. > I'd prefer leaving it out instead. OK >> Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:44 >> + """ > > Instead of adding a comment like that, rename output_dir to layout_test_results_dir or something. OK to remove the comment, output_dir is clear as name anyway. >> Tools/Scripts/webkitpy/port/base.py:911 >> + Ports can stub this out if they don't need a web server to be running.""" > > We don't normally add comments like this. Please remove it. OK >> Tools/Scripts/webkitpy/port/base.py:950 >> + """Shut down the web platform test server if it is running. Do nothing if it isn't.""" > > Ditto. OK >> Tools/Scripts/webkitpy/port/driver.py:161 >> + > > Why do we need to manually append '/'? To be consistent with other dir variables, like HTTP_DIR and HTTP_LOCAL_DIR I will refactor the code to make the addition in port itself using TEST_PATH_SEPARATOR. >> Tools/Scripts/webkitpy/port/driver.py:236 >> + WPT_BASE_URL = "http://localhost:8800/" > > Can we read this value out of config.json instead? Will do that. >> Tools/Scripts/webkitpy/port/driver.py:402 >> + elif self.is_http_test(driver_input.test_name) or self.is_web_platform_test(driver_input.test_name): > > There are two spaces after or. OK >> Tools/Scripts/webkitpy/port/driver_unittest.py:89 >> + > > Superflous change here. OK
youenn fablet
Comment 18 2014-12-19 10:59:03 PST
Created attachment 243556 [details] Updated according review
youenn fablet
Comment 19 2014-12-23 06:47:27 PST
youenn fablet
Comment 20 2014-12-23 06:49:34 PST
(In reply to comment #19) > Created attachment 243671 [details] > Patch Updated style and fixed unit tests
Ryosuke Niwa
Comment 21 2014-12-24 16:31:28 PST
Comment on attachment 243671 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=243671&action=review > Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:42 > + config_wk_filename = port_obj.path_from_webkit_base("LayoutTests", "imported", "w3c", "resources", "config.json") I would call this config_wk_filepath instead since this is a file path, not just a file name. > Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:79 > + def _set_start_cmd(self, port_obj): > + file_path = self._filesystem.abspath(self._filesystem.split(__file__)[0]) > + self._start_cmd = ["python", self._filesystem.join(file_path, "web_platform_test_launcher.py")] > + self._cwd = port_obj.path_from_webkit_base("LayoutTests", self._doc_root) I don't think there's any point in separating this method. Also, please give _cmd a more descriptive name such as doc_root_path. > Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:86 > + for f in self._resources_files_to_copy: > + webkit_filename = self._filesystem.join(self._layout_root, "resources", f) > + if self._filesystem.isfile(webkit_filename): > + self._filesystem.copyfile(webkit_filename, self._filesystem.join(self._doc_root, "resources", f)) Why do we need to do this? How can WPT tests depend on WebKit files? What happens to stale files if run-webkit-tests is killed in the middle of running tests? > Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:90 > + config_wk_filename = self._filesystem.join(self._layout_root, "imported", "w3c", "resources", "config.json") > + if self._filesystem.isfile(config_wk_filename): > + self._filesystem.copyfile(config_wk_filename, self._filesystem.join(self._doc_root, "config.json")) Can we either refer to ../resources/config.json in web_platform_test_launcher.py or copy it into the directory when we import the tests? > Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:103 > + def _prepare_config(self): This function does a lot more than preparing the config.json. We should rename to reflect what it does. > Tools/Scripts/webkitpy/port/driver.py:163 > + self.web_platform_test_dir = self._port.web_platform_test_server_doc_root() We should be consistent in naming. web_platform_test_dir or web_platform_test_server_doc_root. > Tools/Scripts/webkitpy/port/driver.py:164 > + self.web_platform_test_base_url = self._port.web_platform_test_server_base_url() Ditto.
youenn fablet
Comment 22 2014-12-26 14:09:38 PST
Comment on attachment 243671 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=243671&action=review >> Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:86 >> + self._filesystem.copyfile(webkit_filename, self._filesystem.join(self._doc_root, "resources", f)) > > Why do we need to do this? How can WPT tests depend on WebKit files? > What happens to stale files if run-webkit-tests is killed in the middle of running tests? WPT tests rely on testharness.js, testharnessreport.js and testharness.css. testharnessreport.js is specific to WebKit (use of window.testRunner API). Since tests are served through WPT server, we need to have these files within the server root dir. More information is available at bug 134763. If rwt gets killed, the files will remain until rwt is launched again and files will get overwritten/deleted. >> Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:90 >> + self._filesystem.copyfile(config_wk_filename, self._filesystem.join(self._doc_root, "config.json")) > > Can we either refer to ../resources/config.json in web_platform_test_launcher.py > or copy it into the directory when we import the tests? We can do that at import time but this would duplicate files in the repo. Copying the file is also consistent with testharness files handling.
youenn fablet
Comment 23 2014-12-29 12:06:45 PST
Comment on attachment 243671 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=243671&action=review >> Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:42 >> + config_wk_filename = port_obj.path_from_webkit_base("LayoutTests", "imported", "w3c", "resources", "config.json") > > I would call this config_wk_filepath instead since this is a file path, not just a file name. OK >> Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:103 >> + def _prepare_config(self): > > This function does a lot more than preparing the config.json. We should rename to reflect what it does. _prepare_config is a bit misleading as it conflicts with config.json Since it is an overriden method and called from the HttpServerBase source code, we cannot easily rename it. >> Tools/Scripts/webkitpy/port/driver.py:163 >> + self.web_platform_test_dir = self._port.web_platform_test_server_doc_root() > > We should be consistent in naming. web_platform_test_dir or web_platform_test_server_doc_root. OK >> Tools/Scripts/webkitpy/port/driver.py:164 >> + self.web_platform_test_base_url = self._port.web_platform_test_server_base_url() > > Ditto. OK
youenn fablet
Comment 24 2014-12-29 12:08:52 PST
Created attachment 243806 [details] Improving variable names
youenn fablet
Comment 25 2015-01-07 04:36:49 PST
(In reply to comment #24) > Created attachment 243806 [details] > Improving variable names Ping review?
youenn fablet
Comment 26 2015-01-13 06:36:57 PST
Created attachment 244510 [details] Updating SSL support
WebKit Commit Bot
Comment 27 2015-01-25 11:48:09 PST
Comment on attachment 244510 [details] Updating SSL support Rejecting attachment 244510 [details] from commit-queue. youennf@gmail.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/contributors.json. - If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags. - If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/contributors.json by adding yourself to the file (no review needed). The commit-queue restarts itself every 2 hours. After restart the commit-queue will correctly respect your committer rights.
WebKit Commit Bot
Comment 28 2015-01-26 11:35:15 PST
Comment on attachment 244510 [details] Updating SSL support Rejecting attachment 244510 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.appspot.com', '--bot-id=webkit-cq-02', 'validate-changelog', '--check-oops', '--non-interactive', 244510, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit ChangeLog entry in Tools/ChangeLog contains OOPS!. Full output: http://webkit-queues.appspot.com/results/6605731331571712
youenn fablet
Comment 29 2015-01-26 11:48:55 PST
Created attachment 245361 [details] fixing change log
WebKit Commit Bot
Comment 30 2015-01-26 12:41:23 PST
Comment on attachment 245361 [details] fixing change log Clearing flags on attachment: 245361 Committed r179134: <http://trac.webkit.org/changeset/179134>
WebKit Commit Bot
Comment 31 2015-01-26 12:41:31 PST
All reviewed patches have been landed. Closing bug.
Alexey Proskuryakov
Comment 32 2015-01-31 12:29:51 PST
Comment on attachment 245361 [details] fixing change log View in context: https://bugs.webkit.org/attachment.cgi?id=245361&action=review > LayoutTests/imported/w3c/resources/config.json:3 > + "https":[8443], Doesn't this conflict with Apache https port?
youenn fablet
Comment 33 2015-02-02 06:04:32 PST
(In reply to comment #32) > Comment on attachment 245361 [details] > fixing change log > > View in context: > https://bugs.webkit.org/attachment.cgi?id=245361&action=review > > > LayoutTests/imported/w3c/resources/config.json:3 > > + "https":[8443], > > Doesn't this conflict with Apache https port? Thanks, good catch. Yes, the config should be changed. A similar issue may arise with wpt websocket server. I filed bug 141157 to capture this.
Note You need to log in before you can comment on or make changes to this bug.