Closed
Bug 710863
Opened 13 years ago
Closed 13 years ago
Changes for bug 652494 break single-test mochitest execution
Categories
(Testing :: Mochitest, defect)
Testing
Mochitest
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla12
People
(Reporter: bzbarsky, Assigned: heycam)
References
Details
(Keywords: regression)
Attachments
(1 file)
1.44 KB,
patch
|
jmaher
:
review+
|
Details | Diff | Splinter Review |
I finally took the day and a half to bisect this problem that's been hitting me for a month...
The patch in bug 652494 adds these two bits to SimpleTest.js:
var isPrimaryTestWindow = !!parent.TestRunner;
....
if (isPrimaryTestWindow) {
addLoadEvent(function() {
if (SimpleTest._stopOnLoad) {
SimpleTest.finish();
}
});
}
which means that something like this:
python ../obj-firefox/_tests/testing/mochitest/runtests.py --test-path=content/base/test/test_DOMException.html
never calls SimpleTest.finish() on the test, since there is no TestRunner in parent. Which means that running single tests is a huge PITA.
I don't understand why that last part was made conditional on isPrimaryTestWindow. Why was that done?
![]() |
Reporter | |
Updated•13 years ago
|
Keywords: regression
Assignee | ||
Comment 1•13 years ago
|
||
That was done because there were a bunch of tests that were invoking SimpleTest.finish() more than once because they included SimpleTest.js inside windows they opened, and inside these other windows and were not calling SimpleTest.waitForExplicitFinish() to avoid the automatic SimpleTest.finish() call. This was resulting in individual test results being assigned to the wrong test and other oddities.
Obviously we don't want to avoid calling SimpleTest.finish() for the main window of a single test run, so we should fix up the condition there somehow.
![]() |
Reporter | |
Comment 2•13 years ago
|
||
> because they included SimpleTest.js inside windows they opened
Ah, ok. I see.
Can you check for window.opener, perhaps?
Assignee | ||
Comment 3•13 years ago
|
||
Yes, checking some combination of window.opener and window.parent I think should work.
Assignee | ||
Updated•13 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 4•13 years ago
|
||
Attachment #581858 -
Flags: review?(jmaher)
Comment 5•13 years ago
|
||
Comment on attachment 581858 [details] [diff] [review]
Finish mochitests when they are run in single test mode.
Review of attachment 581858 [details] [diff] [review]:
-----------------------------------------------------------------
r=me if you have tested on some of these corner cases.
::: testing/mochitest/tests/SimpleTest/SimpleTest.js
@@ +19,5 @@
> +
> +// In normal test runs, the window that has a TestRunner in its parent is
> +// the primary window. In single test runs, if there is no parent and there
> +// is no opener then it is the primary window.
> +var isPrimaryTestWindow = !!parent.TestRunner || (parent == window && !opener);
actually there are a few exceptions to this rule. Specifically in tests where we do a window.open (mostly found in browser-chrome) from the test case itself. When we do that we specifically include files like SimpleTest.js, for example:
http://mxr.mozilla.org/mozilla-central/source/widget/tests/test_native_mouse_mac.xul
I think this actually resolves those cases, but the comment is a big confusing.
Attachment #581858 -
Flags: review?(jmaher) → review+
Assignee | ||
Comment 6•13 years ago
|
||
But we don't include TestRunner.js in that opened window, right? I'm not sure if the comment is incorrect. Can you clarify?
I just tried test_native_mouse_mac.xul and it finishes properly in single test run mode. (I did a try run yesterday for all mochitests and they came out green.)
While I'm here I have a question: when running a single plain mochitest, the expected result is for the small summary table to be shown in the browser once the test finishes, yes? And for the browser to stay open displaying that. I notice that chrome mochitests don't do this, instead the browser quits and it outputs the summary to the console. Is that the expected behaviour, or should it be doing something like single plain mochitests?
![]() |
Reporter | |
Comment 7•13 years ago
|
||
> the expected result is for the small summary table to be shown in the browser once the
> test finishes, yes? And for the browser to stay open displaying that.
Yes. Chrome tests are all sorts of fucked up.
Assignee | ||
Comment 8•13 years ago
|
||
Joel, per IRC explanation of my comment 6: we do not have any tests that include TestRunner.js in them (either in their main window, or in any window they open). So I believe the comment is correct. Let me know if I can land without changing the comment.
Comment 9•13 years ago
|
||
yes, lets land this
Assignee | ||
Comment 10•13 years ago
|
||
Flags: in-testsuite-
OS: Mac OS X → All
Hardware: x86 → All
Target Milestone: --- → mozilla12
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•