Closed Bug 1494437 Opened Last year Closed Last year

Consider using mozscreenshot in AndroidMixin

Categories

(Testing :: General, enhancement, P2)

Version 3
enhancement

Tracking

(firefox65 fixed)

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: gbrown, Assigned: gbrown)

References

Details

Attachments

(2 files, 1 obsolete file)

Follow-up on https://bugzilla.mozilla.org/show_bug.cgi?id=1492239#c3 - let's support on-device screenshots for android_hardware_unittest.py, in AndroidMixin.
Assignee: nobody → gbrown
See Also: → 1492239
Priority: -- → P2
https://treeherder.mozilla.org/#/jobs?repo=try&tier=1%2C2%2C3&revision=2fe6331b596363ff3707183f835dd0ef6e5d7611 has forced examples for android-em and android-hw tasks -- look for "mozilla-test-fail-screenshot-....png" artifacts.
Attachment #9019370 - Flags: review?(bob)
I find there are not many opportunities for taking interesting screenshots in mozharness. I'm usually more interested in what is happening while the test harness is running. One option might be saving video from screenrecord, but those files get too big too fast. Here's another approach: Take screenshots from timers during the 'run-tests' step, at times that can be easily requested via configuration.

With the existing mozscreenshot file names, multiple screenshots quickly became confusing, so I've added a 'prefix' parameter.

https://treeherder.mozilla.org/#/jobs?repo=try&tier=1%2C2%2C3&revision=563e00aad3a8cffcc1e6866acc14411ec0a72264

https://treeherder.mozilla.org/logviewer.html#?job_id=207308407&repo=try&lineNumber=1275
[task 2018-10-23T18:26:52.669Z] 18:26:52     INFO - Running pre-action listener: timed_screenshots
[task 2018-10-23T18:26:52.669Z] 18:26:52     INFO - screenshot requested 60 seconds from now
[task 2018-10-23T18:26:52.670Z] 18:26:52     INFO - screenshot requested 120 seconds from now
[task 2018-10-23T18:26:52.670Z] 18:26:52     INFO - screenshot requested 180 seconds from now
[task 2018-10-23T18:26:52.671Z] 18:26:52     INFO - screenshot requested 240 seconds from now
...
[task 2018-10-23T18:27:53.237Z] 18:27:53     INFO - timed (60s) screenshot complete
[task 2018-10-23T18:28:53.068Z] 18:28:53     INFO - timed (120s) screenshot complete
...
[task 2018-10-23T18:29:53.142Z] 18:29:53     INFO - timed (180s) screenshot complete
[task 2018-10-23T18:29:55.963Z] 18:29:55     INFO -  INFO | automation.py | Application pid: 1041
[task 2018-10-23T18:30:53.157Z] 18:30:53     INFO - timed (240s) screenshot complete

(I added an extra '-' to file names after this try run.)
Attachment #9019487 - Flags: review?(bob)
Comment on attachment 9019370 [details] [diff] [review]
support device screenshots in AndroidMixin

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

r+
Attachment #9019370 - Flags: review?(bob) → review+
Comment on attachment 9019487 [details] [diff] [review]
support timed screenshots in AndroidMixin

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

::: testing/mozharness/configs/android/android_common.py
@@ +53,5 @@
>      "marionette_address": "localhost:2828",
>      "marionette_test_manifest": "unit-tests.ini",
> +    # Take device screenshots at specified times (each time in seconds, relative
> +    # to the start of the run-tests step).
> +    # "screenshot_times": [60, 120, 180, 240],

Maybe make it clearer...

# To take device screenshots at specified times (each time in seconds, relative
# to the start of the run-tests step) specify screenshot_times. For example, to
# take 4 screenshots at one minute intervals you could specify:
# "screenshot_times": [60, 120, 180, 240],

::: testing/mozharness/mozharness/mozilla/testing/android.py
@@ +509,5 @@
> +            self.device_screenshot("screenshot-%ss-" % str(seconds))
> +            self.info("timed (%ss) screenshot complete" % str(seconds))
> +
> +        self.timers = []
> +        for seconds in self.config.get("screenshot_times", None):

This will attempt to set a timer even if there are no screenshot_times specified and try to interate over a None resulting in TypeError: 'NoneType' object is not iterable. Maybe 

screenshot_times = self.config.get("screenshot_times", None)
if screenshot_times:
    for seconds in screenshot_times:
Attachment #9019487 - Flags: review?(bob)
Thanks for catching that. 

This does better: There are no configured screenshot_times in https://treeherder.mozilla.org/#/jobs?repo=try&tier=1%2C2%2C3&selectedJob=207552407&revision=694701eb6fe9f92397d150c77a4fcd87c39dc878
Attachment #9019487 - Attachment is obsolete: true
Attachment #9019749 - Flags: review?(bob)
Comment on attachment 9019749 [details] [diff] [review]
support timed screenshots in AndroidMixin

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

r+. Much better fix. Thanks.
Attachment #9019749 - Flags: review?(bob) → review+
Pushed by gbrown@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/79ef182cc44e
Support device screenshots in AndroidMixin; r=bc
https://hg.mozilla.org/integration/mozilla-inbound/rev/1aa7374de7ee
Support timed screenshots in AndroidMixin; r=bc
https://hg.mozilla.org/mozilla-central/rev/79ef182cc44e
https://hg.mozilla.org/mozilla-central/rev/1aa7374de7ee
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in before you can comment on or make changes to this bug.