Closed Bug 602871 Opened 14 years ago Closed 14 years ago

XPCShell test harness should ignore system idle time while running tests

Categories

(Testing :: XPCShell Harness, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla2.0b7

People

(Reporter: mak, Assigned: mak)

References

Details

(Keywords: dev-doc-complete)

Attachments

(2 files, 1 obsolete file)

Currently some tinderboxes are reporting permanent idle (mac and windows for sure), this means that each xpcshell test will run idle and idle-daily tasks for each test.

This is making tests slower (think then in near future we will run databases vacuum at idle-daily) and more orange-prone.

We should find a way to reset system idle before each test, maybe synthesizing a keyboard event?
Blocks: 602872
since this blocks my work, tentatively taking.
Assignee: nobody → mak77
Status: NEW → ASSIGNED
This is in fact sort of awful. Will this effect other test suites too?
(In reply to comment #2)
> This is in fact sort of awful. Will this effect other test suites too?
possibly, but mochitests and b-c tests are most likely already sythesizing events... Just I'm not sure if those synthesizing is enough to reset the counter, will have to check that.
Attached patch patch v1.0Splinter Review
If the approach is acceptable, this should work. It is replacing idle service with a mock by default, if a test needs the original service it can get it through let idleSvc = do_get_idle(); and the original service is restored.

Synthesizing eventis is most likely not going to work because I highly doubt they'll reach the OS, and we poll the OS for idle time.
Attachment #482385 - Flags: review?(ted.mielczarek)
And yes, we could need to do something similar for other harnesses, but any test harness that has a common profile for all tests is less affected (b-c and m-c?, not sure about the other ones) since idle-daily will be notified just once and most likely on a almost empty profile.
Summary: XPCShell test harness should reset system idle time before running tests → XPCShell test harness should ignore system idle time while running tests
Comment on attachment 482385 [details] [diff] [review]
patch v1.0

Looks good with two comments:
1) Please update the MDC documentation to mention this.
2) You should probably add a simple test in testing/xpcshell/example/unit/ to check that do_get_idle works.
Attachment #482385 - Flags: review?(ted.mielczarek) → review+
Attached patch patch v1.1 (obsolete) — Splinter Review
Added the requested test, Ted approved it on IRC
Keywords: dev-doc-needed
hm, there is a problem in restoring the original factory, looks like something is trying to QueryInterface idleService (the real one) to nsIFactory. To fix the bug I have to split the factory from the mock, unfortunately that makes the test useless.
Attached patch patch v1.2Splinter Review
This workarounds the issue by having a separate factory object, the test is still valid thanks to a forwarding in QI. The basic approach and effects have not changed and code changes are minimal, thus not reasking review.
Attachment #483455 - Attachment is obsolete: true
http://hg.mozilla.org/mozilla-central/rev/6e4fbb231f1c
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b8
FWIW we had the same problem in comm-central and did the same thing (mock idle service) to fix it a while back. <http://hg.mozilla.org/comm-central/rev/960a02225e3d>
ah cool, I guess you could use the more general xpcshell-tests fix now?
Target Milestone: mozilla2.0b8 → mozilla2.0b7
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: