Bug 62256

Summary: webkitpy: clean up code prior to functional changes for server startup/shutdown
Product: WebKit Reporter: Dirk Pranke <dpranke>
Component: New BugsAssignee: Dirk Pranke <dpranke>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: abarth, eric, tony
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
Bug Depends on: 62251    
Bug Blocks: 59993, 62180    
Attachments:
Description Flags
Patch
none
ready for review
none
add missing ServerError
none
update w/ review feedback
none
update w/ more review feedback
none
fix more typos found by tony none

Dirk Pranke
Reported 2011-06-07 18:36:43 PDT
webkitpy: clean up code prior to functional changes for server startup/shutdown
Attachments
Patch (18.58 KB, patch)
2011-06-07 18:42 PDT, Dirk Pranke
no flags
ready for review (18.25 KB, patch)
2011-06-07 19:13 PDT, Dirk Pranke
no flags
add missing ServerError (18.34 KB, patch)
2011-06-07 19:31 PDT, Dirk Pranke
no flags
update w/ review feedback (20.11 KB, patch)
2011-06-09 17:43 PDT, Dirk Pranke
no flags
update w/ more review feedback (19.53 KB, patch)
2011-06-10 20:39 PDT, Dirk Pranke
no flags
fix more typos found by tony (19.41 KB, patch)
2011-06-13 12:32 PDT, Dirk Pranke
no flags
Dirk Pranke
Comment 1 2011-06-07 18:42:25 PDT
Dirk Pranke
Comment 2 2011-06-07 19:13:19 PDT
Created attachment 96354 [details] ready for review
Dirk Pranke
Comment 3 2011-06-07 19:31:08 PDT
Created attachment 96357 [details] add missing ServerError
Tony Chang
Comment 4 2011-06-09 16:04:13 PDT
Comment on attachment 96357 [details] add missing ServerError View in context: https://bugs.webkit.org/attachment.cgi?id=96357&action=review Looks fine in general. Just a few small questions. > Tools/Scripts/webkitpy/layout_tests/port/apache_http_server.py:44 > + name = 'apache' Nit: I would give this a ALL_CAPS name since it's a static constant. > Tools/Scripts/webkitpy/layout_tests/port/http_server.py:44 > + name = 'lighttpd' Same here. Maybe SERVER_NAME or something? > Tools/Scripts/webkitpy/layout_tests/port/http_server_base.py:48 > + pid_file = None Should this be in __init__? It's not clear to me what makes it different from self._process. > Tools/Scripts/webkitpy/layout_tests/port/websocket_server.py:40 > import http_server > +import http_server_base Should we switch these to full imports while we're here? > Tools/Scripts/webkitpy/layout_tests/port/websocket_server.py:201 > + if self.pid_file: Do we need this check? It looks like self.pid_file should always be set in __init__. > Tools/Scripts/webkitpy/layout_tests/port/websocket_server.py:211 > + elif self.pid_file: Same question as above.
Dirk Pranke
Comment 5 2011-06-09 17:38:58 PDT
(In reply to comment #4) > (From update of attachment 96357 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=96357&action=review > > Looks fine in general. Just a few small questions. > > > Tools/Scripts/webkitpy/layout_tests/port/apache_http_server.py:44 > > + name = 'apache' > > Nit: I would give this a ALL_CAPS name since it's a static constant. > It's not a static constant in all of the subclasses; in websocket_server.py it is possible for it to be overridden per-object if we're running the TLS version. The reason is it declared where it is is because it's effectively a readonly property after initialization. I can move it into the __init__ call if you think that would make things clearer. > > Tools/Scripts/webkitpy/layout_tests/port/http_server.py:44 > > + name = 'lighttpd' > > Same here. Maybe SERVER_NAME or something? > As above. > > Tools/Scripts/webkitpy/layout_tests/port/http_server_base.py:48 > > + pid_file = None > > Should this be in __init__? It's not clear to me what makes it different from self._process. > pid_file will eventually be the path of the file containing the current running process ID. It is also a readonly public property, but I can move it into init as well self._process is the actual process object returned from executive/subprocess. The pid_file object is only really used in the websocket implementation but eventually will be used everywhere, to be consistent. > > Tools/Scripts/webkitpy/layout_tests/port/websocket_server.py:40 > > import http_server > > +import http_server_base > > Should we switch these to full imports while we're here? > Done. > > Tools/Scripts/webkitpy/layout_tests/port/websocket_server.py:201 > > + if self.pid_file: > > Do we need this check? It looks like self.pid_file should always be set in __init__. > You'll notice that the default value of pidfile in the __init__ is None, so, yes, we still need it. > > Tools/Scripts/webkitpy/layout_tests/port/websocket_server.py:211 > > + elif self.pid_file: > > Same question as above. Same answer :).
Dirk Pranke
Comment 6 2011-06-09 17:43:14 PDT
Created attachment 96675 [details] update w/ review feedback
Tony Chang
Comment 7 2011-06-10 09:41:17 PDT
(In reply to comment #5) > (In reply to comment #4) > > (From update of attachment 96357 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=96357&action=review > > > Tools/Scripts/webkitpy/layout_tests/port/apache_http_server.py:44 > > > + name = 'apache' > > > > Nit: I would give this a ALL_CAPS name since it's a static constant. > > It's not a static constant in all of the subclasses; in websocket_server.py it is possible for it to be overridden per-object if we're running the TLS version. > The reason is it declared where it is is because it's effectively a readonly property after initialization. I can move it into the __init__ call if you think that would make things clearer. It is a static constant. In websocket_server.py, you're setting self.name which is not the same as PyWebSocket.name. It sounds like it should be moved into __init__. > > > Tools/Scripts/webkitpy/layout_tests/port/http_server_base.py:48 > > > + pid_file = None > > > > Should this be in __init__? It's not clear to me what makes it different from self._process. > > > > pid_file will eventually be the path of the file containing the current running process ID. It is also a readonly public property, but I can move it into init as well It sounds like pid_file should also be moved into __init__ with an accessor method to make it read only. > self._process is the actual process object returned from executive/subprocess. The pid_file object is only really used in the websocket implementation but eventually will be used everywhere, to be consistent. Sorry, I was unclear. I meant I didn't understand why _process was in __init__, but pid_file wasn't. They have the same lifetime so it seemed like they should be initialized in the same place.
Dirk Pranke
Comment 8 2011-06-10 20:39:10 PDT
Created attachment 96840 [details] update w/ more review feedback
Tony Chang
Comment 9 2011-06-13 09:54:24 PDT
Comment on attachment 96840 [details] update w/ more review feedback View in context: https://bugs.webkit.org/attachment.cgi?id=96840&action=review > Tools/ChangeLog:12 > + removing unused code paths and functions, using 'name' and > + 'pid_file' as public properties on the server objects, and using Nit: Please update the part about 'name' and 'pid_file' being public properties. > Tools/Scripts/webkitpy/layout_tests/port/apache_http_server.py:44 > class LayoutTestApacheHttpd(http_server_base.HttpServerBase): > + name = 'apache' This is no longer needed, right? > Tools/Scripts/webkitpy/layout_tests/port/http_server.py:91 > + raise http_server_base.ServerError('Lighttpd already running') Nit: Should this use self._name? > Tools/Scripts/webkitpy/layout_tests/port/websocket_server.py:200 > + if self.pid_file: > + self._filesystem.write_text_file(self.pid_file, "%d" % self._process.pid) This is now self._pid_file, right? > Tools/Scripts/webkitpy/layout_tests/port/websocket_server.py:210 > + elif self.pid_file: > + pid = int(self._filesystem.read_text_file(self.pid_file)) Ditto.
Dirk Pranke
Comment 10 2011-06-13 12:32:56 PDT
Created attachment 96990 [details] fix more typos found by tony
Dirk Pranke
Comment 11 2011-06-20 20:16:39 PDT
Comment on attachment 96990 [details] fix more typos found by tony clearing review flag, this fix won't work as is.
Dirk Pranke
Comment 12 2011-06-22 11:04:05 PDT
finally fixed in bug 62829. *** This bug has been marked as a duplicate of bug 62829 ***
Note You need to log in before you can comment on or make changes to this bug.