Bug 65413 - Introduce SpecifierSorter, a thing that knows how specifiers should be ordered.
Summary: Introduce SpecifierSorter, a thing that knows how specifiers should be ordered.
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: Dimitri Glazkov (Google)
URL:
Keywords:
Depends on:
Blocks: 64385 65444
  Show dependency treegraph
 
Reported: 2011-07-30 11:18 PDT by Dimitri Glazkov (Google)
Modified: 2011-08-01 12:55 PDT (History)
1 user (show)

See Also:


Attachments
WIP:Switching computers. (6.19 KB, patch)
2011-07-30 11:19 PDT, Dimitri Glazkov (Google)
no flags Details | Formatted Diff | Diff
Patch (11.24 KB, patch)
2011-07-30 14:55 PDT, Dimitri Glazkov (Google)
abarth: review+
dglazkov: commit-queue?
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitri Glazkov (Google) 2011-07-30 11:18:25 PDT
Introduce SpecifierSorter, a thing that knows how specifiers should be ordered.
Comment 1 Dimitri Glazkov (Google) 2011-07-30 11:19:11 PDT
Created attachment 102438 [details]
WIP:Switching computers.
Comment 2 Dimitri Glazkov (Google) 2011-07-30 14:55:33 PDT
Created attachment 102440 [details]
Patch
Comment 3 Adam Barth 2011-07-31 22:03:41 PDT
Comment on attachment 102440 [details]
Patch

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

> Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py:84
> +    def add_specifier(self, category, specifier):
> +        self._specifier_to_category[specifier] = category

Should this be private?

> Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py:99
> +        category_slots = []
> +        for i in range(len(TestConfiguration.category_order())):
> +            category_slots.append([])

category_slots = [[]] * len(TestConfiguration.category_order())

or

category_slots = map(lambda x: [], TestConfiguration.category_order())
Comment 4 Dimitri Glazkov (Google) 2011-08-01 10:53:09 PDT
(In reply to comment #3)
> (From update of attachment 102440 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=102440&action=review
> 
> > Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py:84
> > +    def add_specifier(self, category, specifier):
> > +        self._specifier_to_category[specifier] = category
> 
> Should this be private?
> 
> > Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py:99
> > +        category_slots = []
> > +        for i in range(len(TestConfiguration.category_order())):
> > +            category_slots.append([])
> 
> category_slots = [[]] * len(TestConfiguration.category_order())

This will give you a somewhat unexpected effect of having one array listed N times:

>>> a = ([[]] * 10)
>>> a[0].append('zoot')
>>> a
[['zoot'], ['zoot'], ['zoot'], ['zoot'], ['zoot'], ['zoot'], ['zoot'], ['zoot'], ['zoot'], ['zoot']]

> 
> or
> 
> category_slots = map(lambda x: [], TestConfiguration.category_order())

Now, _that_ is cool.

(In reply to comment #3)
> (From update of attachment 102440 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=102440&action=review
> 
> > Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py:84
> > +    def add_specifier(self, category, specifier):
> > +        self._specifier_to_category[specifier] = category
> 
> Should this be private?
> 
> > Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py:99
> > +        category_slots = []
> > +        for i in range(len(TestConfiguration.category_order())):
> > +            category_slots.append([])
> 
> category_slots = [[]] * len(TestConfiguration.category_order())
> 
> or
> 
> category_slots = map(lambda x: [], TestConfiguration.category_order())
Comment 5 Dimitri Glazkov (Google) 2011-08-01 11:34:29 PDT
(In reply to comment #3)
> (From update of attachment 102440 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=102440&action=review
> 
> > Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py:84
> > +    def add_specifier(self, category, specifier):
> > +        self._specifier_to_category[specifier] = category
> 
> Should this be private?

No, I use it to populate the specifier in TestConfigurationConverter.
Comment 6 Adam Barth 2011-08-01 12:18:38 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > (From update of attachment 102440 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=102440&action=review
> > 
> > > Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py:99
> > > +        category_slots = []
> > > +        for i in range(len(TestConfiguration.category_order())):
> > > +            category_slots.append([])
> > 
> > category_slots = [[]] * len(TestConfiguration.category_order())
> 
> This will give you a somewhat unexpected effect of having one array listed N times:
> 
> >>> a = ([[]] * 10)
> >>> a[0].append('zoot')
> >>> a
> [['zoot'], ['zoot'], ['zoot'], ['zoot'], ['zoot'], ['zoot'], ['zoot'], ['zoot'], ['zoot'], ['zoot']]

Doh!
Comment 7 Dimitri Glazkov (Google) 2011-08-01 12:55:53 PDT
Committed r92136: <http://trac.webkit.org/changeset/92136>