Closed Bug 1087251 Opened 10 years ago Closed 10 years ago

Gather version and device information for HTML log formatter

Categories

(Remote Protocol :: Marionette, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla36

People

(Reporter: davehunt, Assigned: davehunt)

References

Details

Attachments

(1 file, 1 obsolete file)

Once we have a new version of mozlog with fixes for the HTML formatter we need to gather the version and device information within the Marionette test runner.
Assignee: nobody → dave.hunt
Status: NEW → ASSIGNED
Attachment #8509523 - Flags: review?(james)
Comment on attachment 8509523 [details] [diff] [review]
Gather version and device information for HTML log formatter. v1.0

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

I'm going to punt this to Chris, although I think there's nothing particularly complex here he touched this code more recently than me.

My only comment is that I prefer alignment like

foo.bar(arg1="some long thing",
        arg2="something else")
Attachment #8509523 - Flags: review?(james) → review?(cmanchester)
Comment on attachment 8509523 [details] [diff] [review]
Gather version and device information for HTML log formatter. v1.0

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

r+ because I think this is probably safe and I'm really glad to see mozlog being used for this. I'd love to see the nits addressed, but feel free to ignore if you think they're not pertinent.

I agree with James on argument alignment (no blank line after the opening paren).

::: testing/marionette/client/marionette/runner/base.py
@@ +22,5 @@
>  from mozhttpd import MozHttpd
>  from mozlog.structured.structuredlog import get_default_logger
>  from moztest.adapters.unit import StructuredTestRunner, StructuredTestResult
>  from moztest.results import TestResultCollection, TestResult, relevant_line
> +import mozversion

This should go above with other absolute imports in the file.

@@ +664,5 @@
>              self.add_test(test)
>  
> +        version_info = mozversion.get_version(
> +            binary=self.bin, sources=self.sources,
> +            dm_type=os.environ.get('DM_TRANS', 'adb'))

We're always running this code now where before it was only for b2g. It's probably fine, but I'd worry a little about gotchas in mozversion or confusing output for the desktop case.

@@ +668,5 @@
> +            dm_type=os.environ.get('DM_TRANS', 'adb'))
> +
> +        device_info = None
> +        if self.capabilities['device'] != 'desktop' and \
> +                self.capabilities['browserName'] == 'B2G':

I'm a big fan of using python's implicit line joining rather than '\':

if (self.capabilities['device'] != 'desktop' and
    self.capabilities['browserName'] == 'B2G'):

@@ +683,5 @@
>              self.logger.test_start(name)
>              self.logger.test_end(name,
>                                   'SKIP',
>                                   message=test['disabled'])
>              self.todo += 1

Between this loop and your addition I think we're ready to extract a "log preamble" method. It's your call, but huge methods (particularly with names like "run_tests") that accumulate disparate additions over time are a pet peeve of mine.
Attachment #8509523 - Flags: review?(cmanchester) → review+
Carrying r+ with some items addressed. Holding off marking as checkin-needed until the dependencies are resolved.

(In reply to Chris Manchester [:chmanchester] from comment #3)
> Comment on attachment 8509523 [details] [diff] [review]
> Gather version and device information for HTML log formatter. v1.0
> 
> Review of attachment 8509523 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> r+ because I think this is probably safe and I'm really glad to see mozlog
> being used for this. I'd love to see the nits addressed, but feel free to
> ignore if you think they're not pertinent.
> 
> I agree with James on argument alignment (no blank line after the opening
> paren).

Fixed

> ::: testing/marionette/client/marionette/runner/base.py
> @@ +22,5 @@
> >  from mozhttpd import MozHttpd
> >  from mozlog.structured.structuredlog import get_default_logger
> >  from moztest.adapters.unit import StructuredTestRunner, StructuredTestResult
> >  from moztest.results import TestResultCollection, TestResult, relevant_line
> > +import mozversion
> 
> This should go above with other absolute imports in the file.

I've organised the imports according to PEP8, If I moved this to the absolute imports it would be grouped with the standard library imports rather than the third party imports. Within this group the imports are ordered alphabetically.

> @@ +664,5 @@
> >              self.add_test(test)
> >  
> > +        version_info = mozversion.get_version(
> > +            binary=self.bin, sources=self.sources,
> > +            dm_type=os.environ.get('DM_TRANS', 'adb'))
> 
> We're always running this code now where before it was only for b2g. It's
> probably fine, but I'd worry a little about gotchas in mozversion or
> confusing output for the desktop case.

This code should be harmless - in fact beneficial - to run on desktop.

> @@ +668,5 @@
> > +            dm_type=os.environ.get('DM_TRANS', 'adb'))
> > +
> > +        device_info = None
> > +        if self.capabilities['device'] != 'desktop' and \
> > +                self.capabilities['browserName'] == 'B2G':
> 
> I'm a big fan of using python's implicit line joining rather than '\':

I kept this all on one line instead. :)

> if (self.capabilities['device'] != 'desktop' and
>     self.capabilities['browserName'] == 'B2G'):
> 
> @@ +683,5 @@
> >              self.logger.test_start(name)
> >              self.logger.test_end(name,
> >                                   'SKIP',
> >                                   message=test['disabled'])
> >              self.todo += 1
> 
> Between this loop and your addition I think we're ready to extract a "log
> preamble" method. It's your call, but huge methods (particularly with names
> like "run_tests") that accumulate disparate additions over time are a pet
> peeve of mine.

I see your point, but couldn't come up with something I liked. If you have a concrete suggestion I'd be happy to implement it.
Attachment #8509523 - Attachment is obsolete: true
Attachment #8510451 - Flags: review+
Added dependency for latest mozlog version, and triggered a try run:
https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=2ba82980d17b
Flags: needinfo?(dave.hunt)
Landed in:
https://hg.mozilla.org/integration/mozilla-inbound/rev/9b212f882730
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: needinfo?(dave.hunt)
Resolution: --- → FIXED
I didn't mean to close this, it's still waiting on merge to m-c.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
https://hg.mozilla.org/mozilla-central/rev/9b212f882730
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: