The default bug view has changed. See this FAQ.

Marionette's printLogs should write to stderr instead of stdout

RESOLVED FIXED in mozilla18

Status

Testing
Marionette
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: jgriffin, Assigned: hao)

Tracking

unspecified
mozilla18
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [mentor=mdas][lang=py][good first bug])

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
Marionette uses Python's unittest runner to run tests.  TextTestRunner outputs test results to stderr, instead of stdout, to avoid the buffering that takes places with stdout. 

Marionette's printLogs function (http://mxr.mozilla.org/mozilla-central/source/testing/marionette/client/marionette/runtests.py#65), on the other hand, just uses print, which goes to stdout.  This does get buffered, and the result is, when running a sequence of tests, that the log info does not get printed immediately after a test, as is desired, but sometime later, when the stdout buffer gets flushed.

To fix this, we should have printLogs output to MarionetteTextTestRunner.stream, which by default is sys.stderr.
(Assignee)

Comment 1

5 years ago
If I made some changes to the code, how can I verify the result? Run the runtests.py?
(Reporter)

Comment 2

5 years ago
(In reply to Hao Gao from comment #1)
> If I made some changes to the code, how can I verify the result? Run the
> runtests.py?

Yes, you can run it with desktop Firefox using a command-line like this:

python runtests.py --address localhost:2828 --binary /path/to/firefox --type browser tests/unit-tests.ini
(Reporter)

Comment 3

5 years ago
I should add that in order to get a Firefox build that has Marionette enabled, you should download a debug build from e.g., http://stage.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-central-linux-debug/ (or other, depending on your platform).
(Assignee)

Comment 4

5 years ago
Created attachment 659003 [details] [diff] [review]
a patch

Please review it.
Attachment #659003 - Flags: review?(jgriffin)
(Reporter)

Comment 5

5 years ago
Comment on attachment 659003 [details] [diff] [review]
a patch

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

Looks great, thanks for contributing a patch!
Attachment #659003 - Flags: review?(jgriffin) → review+
(Reporter)

Comment 6

5 years ago
https://hg.mozilla.org/mozilla-central/rev/00a552f644a2
Assignee: nobody → haog
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
You need to log in before you can comment on or make changes to this bug.