Bug 181885 - [webkitpy] Move apache configuration setup to port object.
Summary: [webkitpy] Move apache configuration setup to port object.
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Basuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-19 15:20 PST by Basuke Suzuki
Modified: 2018-07-12 16:27 PDT (History)
9 users (show)

See Also:


Attachments
Patch (15.19 KB, patch)
2018-01-23 11:59 PST, Basuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Basuke Suzuki 2018-01-19 15:20:24 PST
In layout_tests/servers/apache_http_server.py, the configuration to launch apache process is maintained in the constructor of this object. It already has is_win() branch in it and we are about to add WinCairo configuration on it. Since there are many path manipulation and platform specific settings, it is good idea to move them into port object.
Comment 1 Basuke Suzuki 2018-01-23 11:59:16 PST
Created attachment 332054 [details]
Patch
Comment 2 Jonathan Bedard 2018-01-24 09:38:36 PST
I'm curious what other contributors think about placing more logic like this in the port class.

I am actually against a change like this.  I think that we've placed too much in the port class, and am unhappy that a class like LayoutTestApacheHttpd even requires the port object at all. I would much rather LayoutTestApacheHttpd take a host object and preform and platform specific path manipulation itself. The advantage of this would be that it turns LayoutTestApacheHttpd into ApacheHttpd which is not wedded to layout tests in the first place (which will be helpful for API tests, for example).

I would much rather we just add the WinCairo branch and keep this logic inside LayoutTestApacheHttpd rather than continuing to pollute the port class.
Comment 3 Basuke Suzuki 2018-01-24 11:27:37 PST
> I am actually against a change like this.  I think that we've placed too much in the port class, and am unhappy that a class like LayoutTestApacheHttpd even requires the port object at all.

The point is that launching httpd server is the duty of port object ( start_server() ). That means each port has different requirements for launching servers. Actually current implementation for win is for AppleWin, but WinCairo has different requirements.

> I would much rather LayoutTestApacheHttpd take a host object and preform and platform specific path manipulation itself.

With above reason, host object is not enough.

> The advantage of this would be that it turns LayoutTestApacheHttpd into ApacheHttpd which is not wedded to layout tests in the first place (which will be helpful for API tests, for example).

I agree with this. Httpd should be more generic. I also don't like too much dependencies. 

One solution may passing arguments for httpd by constructor. Things to configure are just paths to be passed to start command. They can be an simple dictionary.

For now, we really need this change to achieve http tests on WinCairo. Of course we can keep patching onto current LayoutTestApacheHttpd without this refactoring, but that may bring another madness on it and ended up to hardly maintainable code. With taking this refactoring and those madness are gone from LayoutTestApacheHttpd and other ports. They appears only on WinCairoPort, but we can manage that.
Comment 4 Jonathan Bedard 2018-01-24 13:10:23 PST
(In reply to Basuke Suzuki from comment #3)
> ...
> 
> For now, we really need this change to achieve http tests on WinCairo. Of
> course we can keep patching onto current LayoutTestApacheHttpd without this
> refactoring, but that may bring another madness on it and ended up to hardly
> maintainable code. With taking this refactoring and those madness are gone
> from LayoutTestApacheHttpd and other ports. They appears only on
> WinCairoPort, but we can manage that.

I would prefer this code remain in LayoutTestApacheHttpd.  Your statements about platforminfo being insufficient are correct.  I would be be for using arguments to LayoutTestApacheHttpd.  Another possible solution might be to override Port.start_http_server(...) for win-cairo and create a class which inherits from LayoutTestApacheHttpd to handle the win-cairo specific bits.

I'm also curious how win-cairo is differentiated from the other ports. I wouldn't expect LayoutTestApacheHttpd to differ much.
Comment 5 Basuke Suzuki 2018-01-24 14:26:39 PST
Actually WinCairo tries to be as same as other ports. AppleWin did different thing than others. I don't have detail about that, but they do that change always on is_win() == true. See the patched win.py.