Closed Bug 1270507 Opened 4 years ago Closed 4 years ago

[mozlog] Allow more compact output from tbpl logger (skipping expected results for subtests)

Categories

(Testing :: Mozbase, defect)

defect
Not set

Tracking

(firefox49 fixed)

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: jgraham, Unassigned)

Details

Attachments

(1 file)

Tests with lots of subtests can be problematic for treeherder as they can blow through the 50Mb log limit. The problem can mostly be avoided by restricting te amount of logging we do for tests that pass.
https://reviewboard.mozilla.org/r/50801/#review47493

::: testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py:9
(Diff revision 1)
>  
>  from .base import BaseFormatter
>  from .process import strstatus
>  
>  
> +class CircularBuffer(object):

This is somewhat similar to the way that mochitest's buffering works, but doesn't require any cooperation from the test harness. If you think it's worthwhile, it may be possible to share more of the implementations.
Comment on attachment 8749190 [details]
MozReview Request: Bug 1270507 - Elide subtest results from web-platform-tests on treeherder when they match expectations, r=ahal

https://reviewboard.mozilla.org/r/50801/#review47739

::: testing/mozbase/mozlog/mozlog/commandline.py:70
(Diff revision 1)
> +    'compact': (compact_wrapper,
> +                "Enables compact mode for the given formatter.",
> +                ["tbpl"], "store_true"),
>      'level': (level_filter_wrapper,

I think this could replace `--quiet` in mochitest, which basically does the same thing. Though I guess then only the tbpl formatter would be supported.

::: testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py:9
(Diff revision 1)
> +class CircularBuffer(object):
> +    def __init__(self, capacity):
> +        self.capacity = capacity
> +        self.data = [None] * self.capacity
> +        self.index = -1
> +        self.full = False

You can use `collections.deque(maxlen=capacity)` instead.

::: testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py:41
(Diff revision 1)
> +    def inner(self, data):
> +        if self.subtests_count:
> +            return self._format_subtests(data.get("component")) + func(self, data)
> +        else:
> +            return func(self, data)
> +    inner.__name__ = func.__name__
> +    inner.__doc__ = func.__doc__

You can use `@functools.wraps` on `inner` instead of copying `__name__` and `__doc__`.
Attachment #8749190 - Flags: review?(ahalberstadt)
Comment on attachment 8749190 [details]
MozReview Request: Bug 1270507 - Elide subtest results from web-platform-tests on treeherder when they match expectations, r=ahal

https://reviewboard.mozilla.org/r/50801/#review47743

Meant to say r+ with the issues fixed.
Attachment #8749190 - Flags: review+
Comment on attachment 8749190 [details]
MozReview Request: Bug 1270507 - Elide subtest results from web-platform-tests on treeherder when they match expectations, r=ahal

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/50801/diff/1-2/
https://hg.mozilla.org/mozilla-central/rev/0a8415939522
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.