Closed
Bug 667155
Opened 13 years ago
Closed 13 years ago
Mochitest harness no longer fails tests on unexpected exceptions
Categories
(Testing :: Mochitest, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla7
People
(Reporter: bzbarsky, Assigned: heycam)
References
Details
Attachments
(1 file)
2.87 KB,
patch
|
ted
:
review+
|
Details | Diff | Splinter Review |
The error hook to fail tests on unexpected exceptions that was added in bug 365929 was apparently removed in bug 652494 due to some misunderstandings about its purpose. It needs to be restored... In the meantime, we're missing a part of our test coverage. :(
Reporter | ||
Comment 1•13 years ago
|
||
In particular, the onerror handler no longer fails the test but it _does_ terminate it if it's waiting for explicit finish. So it can easily make tests start passing when they shouldn't be if they happen to throw before running most of the test.
Assignee | ||
Comment 2•13 years ago
|
||
You're right. I thought I had verified that after my logging code refactoring that uncaught exceptions still did cause test failures, but it seems not.
http://tbpl.mozilla.org/?tree=Try&rev=852a162bf44a
Here we can see a test in mochitest-plain (in mochitest-1) with an uncaught exception not causing a test failure, though it should. The uncaught exception in mochitest-chrome does not cause a failure (deliberately, due to bug 652494). And the one in mochitest-browser-chrome is caught, as intended.
I'll take a look in the morning.
Assignee: nobody → cam
Status: NEW → ASSIGNED
Updated•13 years ago
|
Assignee | ||
Comment 3•13 years ago
|
||
Attachment #541979 -
Flags: review?(ted.mielczarek)
Assignee | ||
Comment 4•13 years ago
|
||
Let me know if there is a nicer way of detecting whether we're in a mochitest-plain run.
With the patch applied:
http://tbpl.mozilla.org/?tree=Try&rev=7cd5bb5cead3
With the patch applied, and with a deliberate exception being thrown in one plain, one chrome and one browser chrome mochitest:
http://tbpl.mozilla.org/?tree=Try&rev=ae091ac628d9
Comment 5•13 years ago
|
||
Comment on attachment 541979 [details] [diff] [review]
Ensure uncaught exceptions do cause test failures in plain mochitests.
Review of attachment 541979 [details] [diff] [review]:
-----------------------------------------------------------------
::: testing/mochitest/tests/SimpleTest/SimpleTest.js
@@ +794,5 @@
> + try {
> + // Plain mochitests can't access Components.classes with calling
> + // enablePrivileges first.
> + Components.classes;
> + isPlainMochitest = false;
I think the simplest thing to do here would just be to check window.location.protocol == "http:", since chrome tests run from chrome URLs.
Attachment #541979 -
Flags: review?(ted.mielczarek) → review+
Assignee | ||
Comment 6•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
Reporter | ||
Comment 7•13 years ago
|
||
I hate to ask this... but can we somehow add a regression test for this? ;)
Assignee | ||
Comment 8•13 years ago
|
||
If there aren't any already, we could add some mochitest sanity tests which test that failure is expected when an uncaught exception is thrown.
You need to log in
before you can comment on or make changes to this bug.
Description
•