Closed Bug 1344346 Opened 6 years ago Closed 6 years ago

All gecko output is logged at the 'info' level thus bypassing mozharness' error lists


(Testing :: Mochitest, enhancement)

Not set


(firefox55 fixed)

Tracking Status
firefox55 --- fixed


(Reporter: ahal, Assigned: ahal)




(3 files, 1 obsolete file)

Mochitest converts all unstructured output into a 'log' action at the 'info' level:

This means the StructuredOutputParser on the mozharness side of things, won't run these logs through the error_list. In bug 1343659 kats was trying to add a new regex to the error list, but we were both confused as to why it wasn't working.

I can think of 4 solutions to this, none of which are perfect:

1) Run all 'info' messages through the 'error_list' check from the StructuredOutputParser. This is easy to do but kind of goes against the point of structured logging. It will also result in unnecessary processing for non-mochitest harnesses.

2) Bypass the structured logger to output these messages. This might be as easy as printing them to stdout. The downside here is that they will no longer show up in the structured log, which is definitely useful.

3) Log these messages as 'process_output' instead of ''. The downside here is that the tbplformatter currently prepends 'PROCESS' to the message string. This would look really bad on practically every single line, but perhaps it wouldn't be terrible to modify the tbplformatter to simply print the message as is.

I honestly have no idea what the better solution here is. James, do you have any ideas or preferences?
Flags: needinfo?(james)
(I originally had 4 solutions, but decided one of them wasn't worth writing about after the fact. I swear I can count to 3)
James commented 3) is the correct solution on IRC. I think I have a good solution by adding a 'main' key to the the 'process_start' action. This way formatters can treat 'main' processes differently from other subprocesses and everyone can be happy.
Flags: needinfo?(james)
Attachment #8844001 - Attachment is obsolete: true
Attachment #8844001 - Flags: review?(james)
Comment on attachment 8844002 [details]
Bug 1344346 - [mochitest] Log unstructured output as 'process_output',

::: testing/mozharness/mozharness/mozilla/
(Diff revision 2)
> +        if action == "process_output":
> +            # Run process output through the error lists, but make sure the super parser
> +            # doesn't print them to stdout (they should go through the log formatter).
> +            orig = self.log_output
> +            self.log_output = False
> +            self._handle_unstructured_output(data['data'])

Might be nicer to change this to 

`handle_unstructured_output(line, output_log)`

rather than doing the disable/enable dance, but up to you.
Attachment #8844002 - Flags: review?(james) → review+
Comment on attachment 8844106 [details]
Bug 1344346 - [mozlog] Use less verbose formatting on 'process_output' messages,
Attachment #8844106 - Flags: review?(james) → review+
Assignee: nobody → ahalberstadt
I can't land this because somehow the mochitest-clipboard tests aren't using structured logging or something, and all of their TEST-START/PASS and summary get the 'GECKO' prefix which then makes the harness not able to find the summary at the end:

I have no idea what the clipboard tests are doing differently..
In that try push it looks like most, if not all, of the mochitests have the GECKO(pid) prefix in their output. See e.g.
Oh, I see what you mean. The clipboard and jetpack tests seem to have the summary also printed with the prefix, presumably because the summary is coming from jetpack somewhere? Both of those tests have "Jetpack Package Test Summary" which is coming from [1], where as the other tests (e.g. browser-chrome) is printing a summary from [2] via structured logging.

Yeah, it's not just the summary, all the TEST-START/TEST-PASS messages too, which means they're apparently just not using structured logging at all. Looks like there are a smattering of browser-chrome test failures as well.

I don't want to block bug 1343659 on fixing all of this, as it will take a long time (and I'm about to go on an extended PTO). James, would you be ok with adding a hack to the tbplformatter to strip out all formatting if the 'process' starts with "GECKO"? Otherwise, my initial "main" based patch would be another alternative.

Either way I still need to dig into how this more.. if JP/cl are not using the structured logger, but are using the StructuredOutputParser in mozharness.. then I'm not sure how we'd be picking up failures :/
Flags: needinfo?(james)
It looks like both JP and clipboard use a JavaScript based framework here:

At least we are excluding 'jetpack' flavors (which I think clipboard falls under?) from using the StructuredOutputParser:

So there aren't existing issues with detecting flavors. I'll file a bug to convert the addon-sdk harness to use the structured logger.

Side rant: We really need a moratorium on adding new mochitest-like suites that don't actually use mochitest and enforce it better via the module system. I know back then there wasn't much alternative, which is why we also really need a generic marionette-based bootstrapper that will give people an easy way to run JS based harnesses like this.
I think a better way to work around this would be to use "" (like we were before) if options.flavor == jetpack.. Otherwise use "proces_output". I'll get a new series up for review soon.
Flags: needinfo?(james)
Sounds good.
I re-jiggered the commits a bit, and mozreview isn't great at figuring out what needs to be re-reviewed or not. So for convenience, here's the squashed interdiff since the last time you reviewed everything:
Latest push fixes a minor bug I noticed. Here's the updated squashed interdiff:
Comment on attachment 8845077 [details]
Bug 1344346 - [mozharness] Ensure StructuredOutputParser runs 'process_output' messages through the error lists,
Attachment #8845077 - Flags: review?(james) → review+
Actually, probably not worth working on converting jetpack to structured logging. My understanding is it will be gone in 2 releases.
Pushed by
[mochitest] Log unstructured output as 'process_output', r=jgraham
[mozharness] Ensure StructuredOutputParser runs 'process_output' messages through the error lists, r=jgraham
[mozlog] Use less verbose formatting on 'process_output' messages, r=jgraham
Push with failures:

Failure log robocop:
[task 2017-03-09T17:20:22.068082Z] 17:20:22     INFO -  Traceback (most recent call last):
[task 2017-03-09T17:20:22.068357Z] 17:20:22     INFO -    File "/home/worker/workspace/build/tests/mochitest/", line 589, in <module>
[task 2017-03-09T17:20:22.068537Z] 17:20:22     INFO -      sys.exit(main())
[task 2017-03-09T17:20:22.069790Z] 17:20:22     INFO -    File "/home/worker/workspace/build/tests/mochitest/", line 586, in main
[task 2017-03-09T17:20:22.069832Z] 17:20:22     INFO -      return run_test_harness(parser, options)
[task 2017-03-09T17:20:22.069866Z] 17:20:22     INFO -    File "/home/worker/workspace/build/tests/mochitest/", line 550, in run_test_harness
[task 2017-03-09T17:20:22.069892Z] 17:20:22     INFO -      robocop = RobocopTestRunner(auto,, options)
[task 2017-03-09T17:20:22.069923Z] 17:20:22     INFO -    File "/home/worker/workspace/build/tests/mochitest/", line 45, in __init__
[task 2017-03-09T17:20:22.069945Z] 17:20:22     INFO -      MochitestDesktop.__init__(self, options)
[task 2017-03-09T17:20:22.069969Z] 17:20:22     INFO -  TypeError: __init__() takes at least 3 arguments (2 given)
[task 2017-03-09T17:20:22.080370Z] 17:20:22    ERROR - Return code: 1
[task 2017-03-09T17:20:22.080764Z] 17:20:22    ERROR - No tests run or test summary not found

Failure log wpt:
[task 2017-03-09T17:22:41.968737Z] 17:22:41     INFO - TEST-START | /webgl/conformance-1.0.3/conformance/ogles/GL/swizzlers/swizzlers_113_to_120.html
[task 2017-03-09T17:22:41.968897Z] 17:22:41     INFO - TEST-SKIP | /webgl/conformance-1.0.3/conformance/ogles/GL/swizzlers/swizzlers_113_to_120.html | took 0ms
[task 2017-03-09T17:22:41.968945Z] 17:22:41     INFO - Setting up ssl
[task 2017-03-09T17:22:41.969003Z] 17:22:41 CRITICAL - Test harness output was not a valid structured log message: 
[task 2017-03-09T17:22:41.969042Z] 17:22:41     INFO - certutil | 
[task 2017-03-09T17:22:41.969142Z] 17:22:41 CRITICAL - Test harness output was not a valid structured log message:
Flags: needinfo?(ahalberstadt)
Backout by
Backed out changeset 896205d8a760
Backed out changeset 9d49627bc457
Backed out changeset e6376870fa41 for failing at least web-platform-tests and robocop tests. r=backout
Sorry, I had previously pushed this to try, but had only run mochitests. Both errors are easily fixed, patch shortly.
Flags: needinfo?(ahalberstadt)
Sorry for all the requests, but you said you wanted to try the "no r+ with nits" policy, and I can't unset your r+ on mozreview. Mind taking a quick look at the fixes?

Here's the squashed interdiff that fixes the bugs in the backout:

And here's a passing try run with wpt and robocop:

(The windows 2012 build failures and browser-chrome autocomplete failures are pretty much permafail on pushes prior to mine, so I'm assuming they're unrelated).
Flags: needinfo?(james)
lgtm Thanks!
Flags: needinfo?(james)
Pushed by
[mochitest] Log unstructured output as 'process_output', r=jgraham
[mozharness] Ensure StructuredOutputParser runs 'process_output' messages through the error lists, r=jgraham
[mozlog] Use less verbose formatting on 'process_output' messages, r=jgraham
Didn't run OSX/Windows debug this time. Latest backout happened because the leak checker was still looking at 'log' messages instead of 'process_output'. We still need to inspect both 'log' and 'process_output' though due to jetpack flavors still being unstructured.


Try run showing it's fixed:

Still waiting for some results to come in, will push if they look good. Third time's the charm.
Flags: needinfo?(ahalberstadt)
Pushed by
[mochitest] Log unstructured output as 'process_output', r=jgraham
[mozharness] Ensure StructuredOutputParser runs 'process_output' messages through the error lists, r=jgraham
[mozlog] Use less verbose formatting on 'process_output' messages, r=jgraham
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Depends on: 1353858
You need to log in before you can comment on or make changes to this bug.