Bug 220025 - LayoutTestFinder should be in charge of finding layout tests
Summary: LayoutTestFinder should be in charge of finding layout tests
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Sneddon [:gsnedders]
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-12-18 14:18 PST by Sam Sneddon [:gsnedders]
Modified: 2021-01-07 11:34 PST (History)
5 users (show)

See Also:


Attachments
Patch (48.95 KB, patch)
2020-12-18 15:15 PST, Sam Sneddon [:gsnedders]
no flags Details | Formatted Diff | Diff
Patch (53.65 KB, patch)
2021-01-06 08:04 PST, Sam Sneddon [:gsnedders]
no flags Details | Formatted Diff | Diff
Patch (53.79 KB, patch)
2021-01-07 10:53 PST, Sam Sneddon [:gsnedders]
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Sneddon [:gsnedders] 2020-12-18 14:18:04 PST
Currently, LayoutTestFinder finds the tests through: self._port.tests(paths, device_type=device_type)

That method and some related functions, instead of being under Port, should be moved to LayoutTestFinder. (Note currently the method only exists in port.base, and is never overridden, and it is unlikely it ever will be.)
Comment 1 Sam Sneddon [:gsnedders] 2020-12-18 15:15:23 PST
Created attachment 416550 [details]
Patch
Comment 2 Jonathan Bedard 2020-12-18 15:39:04 PST
Comment on attachment 416550 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=416550&action=review

This patch needs a changelog.

I also think that while it's going the right direction, we probably want to take this one piece at a time.nFor example, it seems like the removal of mock_drt is needed for the change, but not strictly part of the change. I also think we've missed some fundemental building blocks of layout test discovery that are still owned by base.py after this patch, such as Base.test_key

> Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py:51
> +    if ext not in Port._supported_reference_extensions:

Code like this makes me think that this patch doesn't finish what it intends to do. It seems bad to separate supported_test_extensions from their reference files (and it seems bad that both of them are in base.py)
Comment 3 Radar WebKit Bug Importer 2020-12-25 14:19:40 PST
<rdar://problem/72674981>
Comment 4 Sam Sneddon [:gsnedders] 2021-01-06 08:04:25 PST
Created attachment 417085 [details]
Patch
Comment 5 Sam Sneddon [:gsnedders] 2021-01-06 08:24:15 PST
(In reply to Jonathan Bedard from comment #2)
> Comment on attachment 416550 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=416550&action=review
> 
> This patch needs a changelog.

New patch! Now with the changelog I wrote before Christmas!

> I also think that while it's going the right direction, we probably want to
> take this one piece at a time.nFor example, it seems like the removal of
> mock_drt is needed for the change, but not strictly part of the change. I
> also think we've missed some fundemental building blocks of layout test
> discovery that are still owned by base.py after this patch, such as
> Base.test_key

I can certainly split out the mock_drt change if you want, at least.

As for Base.test_key, I'm pretty certain that remained where it was due to it also being referenced in Scripts/webkitpy/layout_tests/controllers/manager.py; in principle it would be nice if we made the API of the LayoutTestFinder such that it returned them in "natural" order hence no further resorting was needed, but I was trying to avoid overcommitting (and trying to avoid having to understand the manager right now!), though it does look like the manager doesn't do too much with the list, so maybe I can just change that now?

> 
> > Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py:51
> > +    if ext not in Port._supported_reference_extensions:
> 
> Code like this makes me think that this patch doesn't finish what it intends
> to do. It seems bad to separate supported_test_extensions from their
> reference files (and it seems bad that both of them are in base.py)

To summarise what we discussed in person, my longer term plan was to migrate all the expectation-finding code into the LayoutTestFinder as well. Currently we build up TestInputs in the manager, add the reference_files to them in layout_test_runner, and then construct a DriverOutput with all the relevant expectations in single_test_runner. This doesn't really make sense to have split across three places.

At the moment, after this patch, finding expectations (references among them) remain with the Port, but that should be changed in a later patch.
Comment 6 Jonathan Bedard 2021-01-06 17:23:11 PST
Comment on attachment 417085 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=417085&action=review

r=me (even though Darin already r+ed it, want to be clear that all my concerns have definitely been addressed)

> Tools/ChangeLog:35
> +        (MockPort.__init__): Deleted.

Nit: We can make this shorter by just saying "(MockPort): Deleted." instead of listing each function we deleted.

> Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py:75
>          self._port = port

Based on the conversation Sam and I had today, I think we want a FIXME here to indicate that we think the port object should not be passed to LayoutTestFinder. We aren't there yet, and a patch to get us all the way would be too large, but seems worth mentioning.
Comment 7 Sam Sneddon [:gsnedders] 2021-01-07 10:53:25 PST
Created attachment 417190 [details]
Patch
Comment 8 EWS 2021-01-07 11:34:51 PST
Committed r271244: <https://trac.webkit.org/changeset/271244>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 417190 [details].