Closed Bug 1021926 Opened 6 years ago Closed 1 year ago

[mozlog] Move the stdio capture from web-platform-tests to mozlog.structured


(Testing :: Mozbase, defect)

Not set


(firefox67 fixed)

Tracking Status
firefox67 --- fixed


(Reporter: jgraham, Assigned: nikkis)



(1 file)

The ability to capture the parent process' stdio seems like a useful feature to move out into mozlog.strucured.
Summary: Move the stdio capture from web-platform-tests to mozlog.structured → [mozlog] Move the stdio capture from web-platform-tests to mozlog.structured

Hey James, thanks for the reply on Bug 1066323! I'd like to work on the above to begin with, since there's an abundance of people working on the others. Thank you!

Hi James, just wanted to clarify and make sure I am on the right track.

You would like capture_stdio in
to be added, similarly, to

The stdio capture used in TestRunner could be added in a similar way to the LoggerState, is that correct?
Please let me know if I am way off and need a little nudge in a different direction!

Thank you in advance!

Hi, sorry for not replying to this earlier, I was afk all weekend.

Yes, the idea is to take the CaptureIO class as used at [1] from [2] and put it into mozlog somewhere along with all the dependecies required to run it (probably in a new file somewhere). You probably also want to try writing some tests to ensure that it is working correctly after the move.

Does that make sense?


Hi James. No worries! It was the weekend. :)

Thank you for getting back to me. This makes sense. Although, I may have some more specific questions to follow!

Looking at the CaptureIO class, it relies on the LogThread and LoggingWrapper classes that are in the same file. I am wondering if it would make sense to move those along with it?

Also, as[1] already imports part of mozlog anyway, it would be easy to just add the new file I'm creating in mozlog as another dependency. That would mean, once moved, the CaptureIO class currently in[2] could be deleted safely to avoid duplication. Does that work?

Thanks again for your help!

yes, I imagine moving all the required code out of the wptlogging file and into mozlog. Then the wptlogging file should just import from mozlog instead of duplicating the code, just as you say.

The ability to capture the parent process' stdio is suggested to be a useful feature
to move from web-platform/tests into mozlog. To do so, I have created a new
file within mozlog/mozlog. This includes the CaptureIO class and its dependencies,
including the LoggingWrapper and LogThread classes. These have been removed from their
original location, to avoid duplication, and the files depending on them updated

It would be useful to add unittests testing the CaptureIO enter and exit methods, and
the original_stdio, logging_queue and logging_thread properties. I have begun such a
file with in mozlog/tests. This is a work in progress, however I may
need some guidance, please, in regards to creating appropriate mock data to assert.

Hey James! Added what I think will be the solution to this. However, I was stumped on what data to use to test it in the new location. I imagine I will need to test the methods and properties of the CaptureIO class? But am not sure how to mock data to do so. Could you please point me in the right direction? Thanks! Hopefully everything else looks ok so far!

So it seems there are some failing tests here. The Python 3 failures seem to be because StringIO doesn't exist; I think we can use BytesIO in both cases. The Python 2 failures look like things not working as expected on some platforms; possibly existing bugs in the code, and require more investigation. is a try push with the StringIO to BytesIO conversion. It seems that there are some more Python 3 issues to look at, plus some Python 2 failures on non-linux platforms.

Thanks for looking into it! This is my first time using Treeherder. How do I tell what other Python2/3 discrepancies need fixing? I'm not quite sure what to change here...

Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
Assignee: nobody → nikkisharpley
Created web-platform-tests PR for changes under testing/web-platform/tests
Pushed by
[wpt PR 15880] - [Gecko Bug 1021926] mozlog: move the capture io class from web-platform/tests to mozlog (bug 1021926), a=testonly
You need to log in before you can comment on or make changes to this bug.