Bug 75037 - META: clean up port creation in webkitpy.layout_tests
Summary: META: clean up port creation in webkitpy.layout_tests
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: NRWT
Depends on: 76474 75590 75764 76016 76084 76123 76215 76475
Blocks: 71403
  Show dependency treegraph
 
Reported: 2011-12-21 14:30 PST by Dirk Pranke
Modified: 2012-08-08 16:48 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Pranke 2011-12-21 14:30:51 PST
Right now there's too much logic for creating different types of Port objects in webkitpy, and it's scattered across too many different places. We should clean this up.

Roughly, I think the functionality that is needed is:

1) create the "right" port by default on a platform (e.g., running on Mac Lion gets you apple-mac-lion by default - needed for interactive use by devs)
2) create the "right" port for a given implementation on a platform (e.g., if you say --chromium on Mac Lion you get chromium-mac-lion by default - needed or interactive use by devs)
3) create a fully qualified port (--platform chromium-win-xp gets you a ChromiumWin port configured for XP baselines, regardless of what operating system you're running on - needed by rebaselining tools, other tools)

And possibly also:

4) supporting --platform chromium-win (or --platform google-chrome-win) on windows (I think the chromium buildbots might use this, but it might be better to add a --google-chrome option to mirror the --chromium option instead)
5) pick a port that actually is built, even if it is not the default (so if I have a chromium checkout built on mac, it picks that up if there's no apple port built).

Things that I think we probably don't need to support:

a) --platform chromium-win on a non-windows port
b) the cpu/gpu graphics type; I think the plan is to merge this into the regular chromium port, so this can go away

Cleaning this up all at once would probably get messy, so I have a rough plan of attack:

I. merge the get() routines in chromium_gpu.py and google_chrome.py into factory.py
II. extract all of the port_name parsing logic out of the port constructors into separate staticmethods
III. figure out if we can merge the staticmethods into factory.py and/or call them prior to constructing port objects
IV. modify the Port objects to take a required, fully-qualified port_name in the constructor -> no more logic in the constructors will be left

I'm going to start working on this as written, but let me know if anyone has any thoughts on this.
Comment 1 Dirk Pranke 2012-01-12 14:38:50 PST
final (?) patch posted in bug 76215.
Comment 2 Dirk Pranke 2012-07-13 19:30:21 PDT
resetting the owner in case someone else wants to take a look, as these bugs aren't on my immediate to-do list.
Comment 3 Dirk Pranke 2012-08-08 16:48:23 PDT
I think this is as cleaned up as it's likely to get for a while. If people have other specific enhancements they'd like to see we should file separate bugs for them.