Closed Bug 1400468 Opened 2 years ago Closed 2 years ago

Minor improvements to analysis scripts

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: sfink, Assigned: sfink)

Details

Attachments

(3 files)

Some leftovers from the work I've been doing recently.
Attached patch Trim outputSplinter Review
The heap write output is very verbose, listing every function checked, which is a bit of a pain when scanning through the file. Cut it down to just the root functions that had errors.
Attachment #8908929 - Flags: review?(jcoppeard)
I've been trying to switch over to Python3 for the most part.
Attachment #8908930 - Flags: review?(jcoppeard)
Kind of trivial.
Attachment #8908931 - Flags: review?(jcoppeard)
Attachment #8908929 - Flags: review?(jcoppeard) → review+
Comment on attachment 8908930 [details] [diff] [review]
Port hazard analysis test scripts to python3

Review of attachment 8908930 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/devtools/rootAnalysis/t/testlib.py
@@ +50,5 @@
>      def load_db_entry(self, dbname, pattern):
>          '''Look up an entry from an XDB database file, 'pattern' may be an exact
>          matching string, or an re pattern object matching a single entry.'''
>  
> +        if not is_string(pattern):

I was going to suggest it might be easier to test if pattern is a regexp here, but what's the type of regexp in python?  That is also not clear.  Stackoverflows suggests using hasattr to check for the 'match' method.  But this also works.
Attachment #8908930 - Flags: review?(jcoppeard) → review+
Comment on attachment 8908931 [details] [diff] [review]
Control verbosity

Review of attachment 8908931 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/devtools/rootAnalysis/analyze.py
@@ +238,3 @@
>  
>  args = parser.parse_args()
> +args.verbose -= max(0, args.quiet)

Should this be |args.versbose = max(0, args.verbose - args.quiet)| ?
Attachment #8908931 - Flags: review?(jcoppeard) → review+
(In reply to Jon Coppeard (:jonco) from comment #4)
> Comment on attachment 8908930 [details] [diff] [review]
> Port hazard analysis test scripts to python3
> 
> Review of attachment 8908930 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: js/src/devtools/rootAnalysis/t/testlib.py
> @@ +50,5 @@
> >      def load_db_entry(self, dbname, pattern):
> >          '''Look up an entry from an XDB database file, 'pattern' may be an exact
> >          matching string, or an re pattern object matching a single entry.'''
> >  
> > +        if not is_string(pattern):
> 
> I was going to suggest it might be easier to test if pattern is a regexp
> here, but what's the type of regexp in python?  That is also not clear. 
> Stackoverflows suggests using hasattr to check for the 'match' method.  But
> this also works.

Ooh, I like it! Thanks.

(In reply to Jon Coppeard (:jonco) from comment #5)
> Comment on attachment 8908931 [details] [diff] [review]
> Control verbosity
> 
> Review of attachment 8908931 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: js/src/devtools/rootAnalysis/analyze.py
> @@ +238,3 @@
> >  
> >  args = parser.parse_args()
> > +args.verbose -= max(0, args.quiet)
> 
> Should this be |args.versbose = max(0, args.verbose - args.quiet)| ?

Duh, yeah. It's not even possible to have args.quiet < 0, so mine did absolutely nothing.
https://hg.mozilla.org/mozilla-central/rev/6d5acbf01f1d
https://hg.mozilla.org/mozilla-central/rev/e793ea435007
https://hg.mozilla.org/mozilla-central/rev/a4e41e4876ef
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.