Closed Bug 897789 Opened 6 years ago Closed 6 years ago

Add fuzz factor to watchdog hibernation tests

Categories

(Core :: XPConnect, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: bholley, Assigned: bholley)

References

Details

Attachments

(1 file)

Since the watchdog tests landed, we've hit a few intermittent failures on windows that look like this:

17:34:06     INFO -  TEST-INFO | Pre-hibernation statistics:
17:34:06     INFO -  TEST-INFO | now: 1374712435.194
17:34:06     INFO -  TEST-INFO | startHibernation: 0
17:34:06     INFO -  TEST-INFO | stopHibernation: 0
17:34:06     INFO -  TEST-PASS |  [testBody : 125] true == true
17:34:06     INFO -  TEST-PASS |  [testBody : 126] true == true
17:34:06     INFO -  TEST-INFO |  Post-hibernation statistics:
17:34:06     INFO -  TEST-INFO |  stateChange: 1374712445.175
17:34:06     INFO -  TEST-INFO |  startHibernation: 1374712438.182
17:34:06     INFO -  TEST-INFO |  stopHibernation: 1374712445.175
17:34:06  WARNING -  TEST-UNEXPECTED-FAIL |  false == true - See following stack:
17:34:06     INFO -  JS frame :: testBody :: line 147
17:34:06     INFO -  JS frame :: continueTest :: line 79

The hibernation tests do the following, in order:
(1) Sample |var now = Date.now();|
(2) Kick off an XPCOM one-shot timer for 10 seconds.
(3) Simulate a state change on the runtime
(4) read the timestamp from the last runtime state changed, generated in C++ by PR_Now().
(5) sanity-checks that the timestamp in (4) is at least 10 seconds past the timestamp in (1)

The sanity check in (5) fails in the above log, in which the time delta is 9.98 seconds.

Talking to Waldo, it sounds like the timer implementations of XPCOM timers, PR_Now(), and Date.now() are all different, and not guaranteed to be comparable. I think the simplest pack to victory is just to add a fuzz factor here. Hopefully philor doesn't murder me. :-)
Attachment #780744 - Flags: review?(jwalden+bmo)
Comment on attachment 780744 [details] [diff] [review]
Add a fuzz factor to watchdog tests. v1

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

We could make this a little more adaptive, but really it doesn't matter much.  :-)
Attachment #780744 - Flags: review?(jwalden+bmo) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/1ebe771b4245

Sorry to step on your toes, Bobby. Tree closure and all, though...
https://hg.mozilla.org/mozilla-central/rev/1ebe771b4245
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.