Closed Bug 823122 Opened 12 years ago Closed 11 years ago

Add settime support to Negatus (aka SUT agent version of b2g)

Categories

(Testing Graveyard :: SUTAgent, defect)

x86
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mdas, Unassigned)

References

Details

Attachments

(1 file)

By default, after the pandaboard is flashed, it has no knowledge of today's date, or even the right year, which is causing problems. According to dustin, it has no onboard clock. Its date is set incorrectly, so we need to set the date after flashing it so that test applications can at least verify that security certificates are valid for B2G.
What options do I have available to set the date/time on them?

FTR this is to help some tests and does not necessarily block the whole set of Gaia UI tests.
Assignee: nobody → armenzg
You can use NTP to set the date during startup.  The flashing scripts do this, for example:

http://hg.mozilla.org/build/puppet/file/e2e55d831e6f/modules/bmm/templates/b2g-second-stage.sh.erb#l18

  log "setting time with ntpdate"
  ntpdate -b ntp.build.mozilla.org

the boards have no way to keep track of the time (no RTC), so this can't be "set" when flashing.
Anyone has any options that I can run after re-imaging?

IIUC ntp does not seem to be an option unless sut or marionette had the ability to use it.
(In reply to Dustin J. Mitchell [:dustin] from comment #2)
> so this can't be "set" when flashing.

Do you know if mozpool could set it *after* flashing?
I'm unsure if/how well this works on pandas, but SUTAgent has a method to do it, see:
http://mxr.mozilla.org/build/source/tools/sut_tools/sut_lib.py#459

It relies on *us* passing in a date/time though, but that should be easy.
Mozpool could set it with SUT after imaging, but that feels like a tight coupling to me.  Maybe it would be better for the Buildbot automation to do so?

From what I've heard not all images have SUT (Android, in particular).  Is that true?
AFAIK all pandas should have SUT on them. B2G one is on version 1.13 and the Android one on 1.15:
Armens-MacBook-Air:~ armenzg$ telnet panda-0810 20701
Trying 10.12.136.89...
Connected to panda-0810.p9.releng.scl1.mozilla.com.
Escape character is '^]'.
$>ver
SUTAgentAndroid Version 1.15
The b2g version of SUT agent does not seem to have the ability to settime [1].
The Android version of SUT agent has the settime feature [2].

[1]
Armens-MacBook-Air:~ armenzg$ telnet panda-0169 20701
Trying 10.12.128.152...
Connected to panda-0169.p1.releng.scl1.mozilla.com.
Escape character is '^]'.
$>clok    
1356029314
$>settime 2012/12/20 13:47:13
##AGENT-WARNING## unknown command
$>clok
1356029316

[2]
Armens-MacBook-Air:~ armenzg$ telnet panda-0810 20701
Trying 10.12.136.89...
Connected to panda-0810.p9.releng.scl1.mozilla.com.
Escape character is '^]'.
$>clok
1356029355519
$>settime 2012/12/20 13:47:13
2012/12/20 01:47:13:080
$>clok
1356011234676
Component: Release Engineering: Automation (General) → SUTAgent
Product: mozilla.org → Testing
QA Contact: catlee
Version: other → unspecified
Either that or another way to set the time.
Summary: Pandaboards need to have the date set → Add settime support to Negatus (aka SUT agent version of b2g)
Might be possible to do this via exec, but it makes more sense to implement a settime command like the Android agent.  I'll handle that.

(Although why the command takes a datetime string instead of a unix timestamp I dunno... blech)
Assignee: armenzg → mcote
Status: NEW → ASSIGNED
Blocks: 823831
Dealing with datetime is always like poking at a hornet's nest...

The "clok" command returns UTC time in seconds (Negatus) or milliseconds (Android agent).

The "settime" command on the Android agent sets the date and time in the local timezone.

For example, on a phone here in Montreal,

$>settime 2028/08/19 12:00:00
2028/08/19 12:00:00:149
$>clok
1850313601673
$>

1850313601 is 2028/08/19 16:00:01 UTC, i.e. 2028/08/19 12:00:01 EDT.

This is a flawed approach:  since the timezone is omitted in settime, there is ambiguity at daylight-savings-time crossover points.  For example, it's impossible to tell, without additional info, if 2012/11/04 01:30:00 is in EDT or EST.

In light of this, I'd like to deprecate settime in favour of setutime, which will take a UNIX timestamp, in milliseconds (*without* the promise that the milliseconds part will be respected) in UTC.  setutime and clok will be then reciprocal, at least to the seconds level.

There are also some timezone-specific commands in the Android SUT agent ("tzget" and "tzset").  Are these being used anywhere?
I like the setutime approach.

I don't know about the timezone commands. Our code does not use tzget:
http://mxr.mozilla.org/build/search?string=tzget
I see that twisted uses tzset for some tests but this is not related to dealing with SUT; AFAICT:
http://mxr.mozilla.org/build/search?string=tzset
Okay, I added settime for compatibility, but as I mentioned it should be considered deprecated.  The specific problem would be the "repeated" times at the DST-ST boundary, when 1:00 am to 1:59 am are repeated, so the argument would be ambiguous.  It will still work, but the result is undefined (it will end up in either DST or ST).

setutime takes one argument, the number of milliseconds since Jan 1, 1970, in UTC.  The milliseconds are respected, since settimeofday() allows them.
Attachment #694998 - Flags: review?(wlachance)
Comment on attachment 694998 [details] [diff] [review]
Add settime and setutime commands

lgtm
Attachment #694998 - Flags: review?(wlachance) → review+
We should implement setutime in SUTAgentAndroid as well.  I'll take a crack at that.
https://github.com/mozilla/Negatus/commit/7ed4efcee655f605455f9375a4e6c68cd078c459 for Negatus changes.  Need to ensure they get into B2G debug builds.
By the way, I fixed the clok command in Negatus to return milliseconds, as in the Java agent.
Is this fixed now?
Filed bug 827875 for adding setutime to the Java agent.  We're done here.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Blocks: 832459
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: