Bug 80083

Summary: nrwt: virtual tests aren't being run
Product: WebKit Reporter: Dirk Pranke <dpranke>
Component: New BugsAssignee: Dirk Pranke <dpranke>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, eric, ojan, tony
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch eric: review+

Description Dirk Pranke 2012-03-01 19:19:12 PST
nrwt: virtual tests aren't being run
Comment 1 Dirk Pranke 2012-03-01 19:19:45 PST
Created attachment 129792 [details]
Patch
Comment 2 Eric Seidel (no email) 2012-03-01 19:22:26 PST
Comment on attachment 129792 [details]
Patch

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

> Tools/Scripts/webkitpy/layout_tests/port/base.py:1086
> +                for test in suite.tests:
> +                    if any(test.startswith(p) for p in paths):
> +                        virtual_tests.add(test)
> +            else:
> +                virtual_tests.update(set(suite.tests.keys()))

I suspect this whole block could be written shorter with comprehesions or a filter statement.
Comment 3 Dirk Pranke 2012-03-01 19:25:53 PST
(In reply to comment #2)
> (From update of attachment 129792 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=129792&action=review
> 
> > Tools/Scripts/webkitpy/layout_tests/port/base.py:1086
> > +                for test in suite.tests:
> > +                    if any(test.startswith(p) for p in paths):
> > +                        virtual_tests.add(test)
> > +            else:
> > +                virtual_tests.update(set(suite.tests.keys()))
> 
> I suspect this whole block could be written shorter with comprehesions or a filter statement.

Shorter, probably. I don't know if it would be more comprehensible, though. It's a nested-loop join (meaning for each item in one list we have to iterate over another list), and I find those are usually hard to follow w/ list comprehensions.

I don't think there's an eas(ier?) way to do it with filter(), but I could be wrong. This code at least has the virtue of being pretty easy to follow. We could pull the 'if paths' out of the outer loop, and it might be slightly easier to follow as well.
Comment 4 Dirk Pranke 2012-03-01 19:28:35 PST
Committed r109490: <http://trac.webkit.org/changeset/109490>