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)
Testing
XPCShell Harness
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla2.0b7
People
(Reporter: mak, Assigned: mak)
References
Details
(Keywords: dev-doc-complete)
Attachments
(2 files, 1 obsolete file)
3.86 KB,
patch
|
ted
:
review+
|
Details | Diff | Splinter Review |
5.47 KB,
patch
|
Details | Diff | Splinter Review |
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?
Assignee | ||
Comment 1•14 years ago
|
||
since this blocks my work, tentatively taking.
Assignee: nobody → mak77
Status: NEW → ASSIGNED
Comment 2•14 years ago
|
||
This is in fact sort of awful. Will this effect other test suites too?
Assignee | ||
Comment 3•14 years ago
|
||
(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.
Assignee | ||
Comment 4•14 years ago
|
||
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)
Assignee | ||
Comment 5•14 years ago
|
||
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.
Assignee | ||
Updated•14 years ago
|
Summary: XPCShell test harness should reset system idle time before running tests → XPCShell test harness should ignore system idle time while running tests
Comment 6•14 years ago
|
||
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+
Assignee | ||
Comment 7•14 years ago
|
||
Added the requested test, Ted approved it on IRC
Assignee | ||
Updated•14 years ago
|
Keywords: dev-doc-needed
Assignee | ||
Comment 8•14 years ago
|
||
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.
Assignee | ||
Comment 9•14 years ago
|
||
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
Assignee | ||
Comment 10•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/6e4fbb231f1c
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b8
Assignee | ||
Comment 11•14 years ago
|
||
documented in https://developer.mozilla.org/en/Writing_xpcshell-based_unit_tests under do_get_idle()
Keywords: dev-doc-needed → dev-doc-complete
Comment 12•14 years ago
|
||
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>
Assignee | ||
Comment 13•14 years ago
|
||
ah cool, I guess you could use the more general xpcshell-tests fix now?
Comment 14•14 years ago
|
||
Yeah, we backed our fix out: <http://hg.mozilla.org/comm-central/rev/0c4e204d8575>
Updated•14 years ago
|
Target Milestone: mozilla2.0b8 → mozilla2.0b7
You need to log in
before you can comment on or make changes to this bug.
Description
•