SUTAgent: add uptimemillis device info command

RESOLVED FIXED in mozilla17

Status

RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: mcote, Assigned: mcote)

Tracking

unspecified
mozilla17
ARM
Android
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

6 years ago
The SUTAgent "info" command can return the phone's uptime but only to a resolution of seconds. For S1/S2 startup tests, we need millisecond resolution.
(Assignee)

Comment 1

6 years ago
Created attachment 645746 [details] [diff] [review]
uptimemillis info command

Pretty simple. Just prints out the number of milliseconds since the phone last booted up.
Attachment #645746 - Flags: review?(wlachance)
(Assignee)

Comment 2

6 years ago
Created attachment 645768 [details] [diff] [review]
mozdevice patch

This adds uptimemillis to the getInfo command of DeviceManagerSUT. This command is NOT supported in DeviceManagerADB because it is not available through the shell. Appropriate comments have been added.
Attachment #645768 - Flags: review?(wlachance)
Comment on attachment 645746 [details] [diff] [review]
uptimemillis info command

LGTM

>+    public String GetUptimeMillis()
>+        {
>+        String sRet = "" + SystemClock.uptimeMillis();
>+        return (sRet);
>+        }

I'd prefer just:

return SystemClock.uptimeMillis();

The type of the method should fix any issues.
Attachment #645746 - Flags: review?(wlachance) → review+
Comment on attachment 645768 [details] [diff] [review]
mozdevice patch

LGTM

>diff --git a/mozdevice/mozdevice/devicemanager.py b/mozdevice/mozdevice/devicemanager.py
>index 7f63cbc..6de0eb6 100644
>--- a/mozdevice/mozdevice/devicemanager.py
>+++ b/mozdevice/mozdevice/devicemanager.py
>@@ -437,6 +437,8 @@ class DeviceManager:
>     os - name of the os
>     id - unique id of the device
>     uptime - uptime of the device
>+    uptimemillis - uptime of the device in milliseconds (NOT supported on all
>+                   platforms)

"platforms" doesn't seem technically correct, since it's the devicemanager interface, not the platform, that determines whether this is supported.

Maybe instead say "NOT supported by all implementations"
Attachment #645768 - Flags: review?(wlachance) → review+
(In reply to William Lachance (:wlach) from comment #3)
> Comment on attachment 645746 [details] [diff] [review]
> uptimemillis info command
> 
> LGTM
> 
> >+    public String GetUptimeMillis()
> >+        {
> >+        String sRet = "" + SystemClock.uptimeMillis();
> >+        return (sRet);
> >+        }
> 
> I'd prefer just:
> 
> return SystemClock.uptimeMillis();
> 
> The type of the method should fix any issues.

Actually I guess you'd need something like this:

return String.format("%s", SystemClock.uptimeMillis());

Apparently Java won't do this type of cast automatically (probably a good thing).
(Assignee)

Comment 6

6 years ago
For the agent changes:

http://hg.mozilla.org/integration/mozilla-inbound/rev/f9861971bbf8

Btw I ended up going with
    return Long.toString(SystemClock.uptimeMillis());
(Assignee)

Comment 7

6 years ago
(In reply to William Lachance (:wlach) from comment #4)
> Comment on attachment 645768 [details] [diff] [review]
> mozdevice patch
>
> "platforms" doesn't seem technically correct, since it's the devicemanager
> interface, not the platform, that determines whether this is supported.
> 
> Maybe instead say "NOT supported by all implementations"

Good point.

I also updated the comment in devicemanagerSUT to indicate that SUTAgent 1.11 or higher is required.

https://github.com/mozilla/mozbase/commit/db0e706e9cbd0db8cfd21cb7716a52fd6453b08b

Comment 8

6 years ago
https://hg.mozilla.org/mozilla-central/rev/f9861971bbf8
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
(Assignee)

Comment 9

6 years ago
Should have made the devicemanager change in m-c and merged over to github later. I'll apply it to m-c now.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(Assignee)

Comment 11

6 years ago
Gah I pushed the original version of the patch, which didn't have the two clarifications in the comments ("implementation" vs "platform", "SUTAgent 1.11+"). I'll push that separately.
Whiteboard: [leave open]

Comment 13

6 years ago
Mark this is a reminder to get back to addressing the comments in comment 11 so we can close this bug.
(Assignee)

Comment 14

6 years ago
Ah sorry should have removed the whiteboard tag. This is done.
Status: REOPENED → RESOLVED
Last Resolved: 6 years ago6 years ago
Resolution: --- → FIXED
Whiteboard: [leave open]
(Assignee)

Comment 15

6 years ago
Oh wait wrong bug. Right, I still have to do this.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
https://hg.mozilla.org/mozilla-central/rev/8803492c677a
Status: REOPENED → RESOLVED
Last Resolved: 6 years ago6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.