Closed
Bug 1165556
Opened 9 years ago
Closed 9 years ago
Update JavascriptTests implementing do_register_cleanup() callbacks
Categories
(Firefox for Android Graveyard :: Testing, defect)
Tracking
(firefox42 fixed)
RESOLVED
FIXED
Firefox 42
Tracking | Status | |
---|---|---|
firefox42 | --- | fixed |
People
(Reporter: capella, Assigned: capella)
Details
Attachments
(4 files, 2 obsolete files)
4.63 KB,
patch
|
Margaret
:
review+
|
Details | Diff | Splinter Review |
3.85 KB,
patch
|
gbrown
:
review+
|
Details | Diff | Splinter Review |
13.24 KB,
patch
|
gbrown
:
review+
|
Details | Diff | Splinter Review |
4.60 KB,
patch
|
Margaret
:
review+
|
Details | Diff | Splinter Review |
It seems that do_register_cleanup() callbacks [0] in our JavascriptTest (and possibly UITest) derived tests aren't being performed.
They're not triggered in robocop_head.js for tests other than child processes (those defined as run_test_in_child()), which we don't do. (Brief irc convo [1])
At the moment, uncompleted cleanup shouldn't be an issue as test processes don't run into each other, but we should remove those methods [2] [3] [4], and modify the consumers as appropriate. (cc:nalexander here in case this over-reaches).
[0] http://mxr.mozilla.org/mozilla-central/search?string=do_register_cleanup&case=1&find=mobile%2Fandroid&findi=&filter=^[^\0]*%24&hitlimit=&tree=mozilla-central
[1] http://logs.glob.uno/?c=mozilla%23mobile&s=15+May+2015&e=16+May+2015#c464316
[2] http://mxr.mozilla.org/mozilla-central/source/mobile/android/tests/browser/robocop/robocop_head.js?mark=1020-1020#1008
[3] http://mxr.mozilla.org/mozilla-central/source/mobile/android/tests/browser/robocop/robocop_head.js?mark=312-312#311
[4] http://mxr.mozilla.org/mozilla-central/source/mobile/android/tests/browser/robocop/robocop_head.js?mark=894-894#887
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → markcapella
Status: NEW → ASSIGNED
Assignee | ||
Comment 1•9 years ago
|
||
Stub out main method |do_register_cleanup()|, and related but unused method that invokes it.
Attachment #8635116 -
Flags: review?(nalexander)
Assignee | ||
Comment 2•9 years ago
|
||
push to TRY all tests, prove target method is unused.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=55729c856385
Assignee | ||
Comment 3•9 years ago
|
||
Remove method |run_test_in_child()|, (unused as in original report) and related but unused method that invokes it.
Attachment #8635118 -
Flags: review?(nalexander)
Assignee | ||
Comment 4•9 years ago
|
||
Remove method |_execute_test()|, (unused as in original report) and related but unused methods that are invoked.
Attachment #8635121 -
Flags: review?(nalexander)
Assignee | ||
Comment 5•9 years ago
|
||
FYI ... DEBUGGING ONLY ...
Adds quick check for proper behaviour of known fails,
two todo tests,
and tags all attempts to invoke the now deprecated/stubbed method do_register_cleanup()
Assignee | ||
Comment 6•9 years ago
|
||
Push to TRY all tests with all obsolete code removed.
All random orange annotated and repushed until green / clean.
DEBUG test failures annotated.
Comparison of test results before / after shows no unexpected behaviour.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=0d47bd00cf27
Assignee | ||
Comment 7•9 years ago
|
||
At this point I think we could review/approved/move these patches as "Phase Initial".
"Phase Optional" could be further review of |robocop_head.js| for:
1) Obsolete bits I may have overlooked related to this patch.
--and--
2) Un-Related unused bits we can opportunistically remove.
I can live without this or spin it off to another patch.
"Phase Main" will then be modifying the tests that invoke the unused callback method.
"Phase Final" will be simply removing the stubbed out |do_register_cleanup()| method.
Comment 8•9 years ago
|
||
Thanks for picking this up!
nalexander is PTO until 7/28, so he won't be able to get to these for a while. However, gbrown or myself should be able to help with the reviews, if you want to redirect.
Assignee | ||
Comment 9•9 years ago
|
||
Thanks margaret! I noticed his absence on channel today and actually wondered :)
It'd be fine if you can steal direction here, and of course gbrown comments are welcome in this area.
I'll avoid updating the review? fields on the patches to save channel spam.
Comment 10•9 years ago
|
||
(In reply to Mark Capella [:capella] from comment #9)
> Thanks margaret! I noticed his absence on channel today and actually
> wondered :)
>
> It'd be fine if you can steal direction here, and of course gbrown comments
> are welcome in this area.
Never worry about bug spam!
I'll just NI myself to remember to look at this. If it's not in a queue somewhere, I'll forget :)
Flags: needinfo?(margaret.leibovic)
Assignee | ||
Comment 11•9 years ago
|
||
Comment on attachment 8635116 [details] [diff] [review]
bug1165556_stub_register_cleanup.diff
clearing review ... will replace with refined patchs
Attachment #8635116 -
Flags: review?(nalexander)
Assignee | ||
Comment 12•9 years ago
|
||
Comment on attachment 8635118 [details] [diff] [review]
bug1165556_remove_run_test.diff
clearing review ... will replace with refined patchs
Attachment #8635118 -
Flags: review?(nalexander)
Assignee | ||
Comment 13•9 years ago
|
||
Comment on attachment 8635121 [details] [diff] [review]
bug1165556_remove_execute_test.diff
clearing review ... will replace with refined patchs
Attachment #8635121 -
Flags: review?(nalexander)
Assignee | ||
Comment 14•9 years ago
|
||
Comment on attachment 8635116 [details] [diff] [review]
bug1165556_stub_register_cleanup.diff
No change from original version
Attachment #8635116 -
Flags: review?(margaret.leibovic)
Assignee | ||
Comment 15•9 years ago
|
||
Comment on attachment 8635118 [details] [diff] [review]
bug1165556_remove_run_test.diff
No change from original version
Attachment #8635118 -
Flags: review?(margaret.leibovic)
Assignee | ||
Comment 16•9 years ago
|
||
Removed an additional method I overlooked from related to this patch.
Attachment #8635121 -
Attachment is obsolete: true
Attachment #8635765 -
Flags: review?(margaret.leibovic)
Assignee | ||
Comment 17•9 years ago
|
||
Final patch, first post ... correctly implements original logic, and allows the tests to start actually executing the callbacks.
Note the change to |testHistoryService.js| ... Failed during my first try push, further proving we weren't doing callbacks previously.
Attachment #8635123 -
Attachment is obsolete: true
Attachment #8635766 -
Flags: review?(margaret.leibovic)
Assignee | ||
Comment 18•9 years ago
|
||
so ... much ... green ...
https://treeherder.mozilla.org/#/jobs?repo=try&revision=c68a75b52c98
Comment 19•9 years ago
|
||
Comment on attachment 8635116 [details] [diff] [review]
bug1165556_stub_register_cleanup.diff
Review of attachment 8635116 [details] [diff] [review]:
-----------------------------------------------------------------
::: mobile/android/tests/browser/robocop/robocop_head.js
@@ +887,5 @@
> +// XXX UNUSED - Registers a function that will run when the test harness
> +// is done running all tests.
> +//
> +function do_register_cleanup(unused) {
> + // stubbed out until time to remove.
If nalexander and gbrown are cool with removing this, then I'm okay with it. I definitely believe we either need to remove it or fix it if it's going to be here.
Attachment #8635116 -
Flags: review?(margaret.leibovic) → review+
Comment 20•9 years ago
|
||
Comment on attachment 8635118 [details] [diff] [review]
bug1165556_remove_run_test.diff
Review of attachment 8635118 [details] [diff] [review]:
-----------------------------------------------------------------
I don't feel confident reviewing this, redirecting to gbrown.
(If I were to review this, it would just be a rubber stamp.)
Attachment #8635118 -
Flags: review?(margaret.leibovic) → review?(gbrown)
Comment 21•9 years ago
|
||
Comment on attachment 8635765 [details] [diff] [review]
bug1165556_remove_execute_test.diff
Review of attachment 8635765 [details] [diff] [review]:
-----------------------------------------------------------------
(Same story here)
Attachment #8635765 -
Flags: review?(margaret.leibovic) → review?(gbrown)
Comment 22•9 years ago
|
||
Comment on attachment 8635766 [details] [diff] [review]
bug1165556_update_register_cleanup.diff
Review of attachment 8635766 [details] [diff] [review]:
-----------------------------------------------------------------
::: mobile/android/tests/browser/robocop/testHistoryService.js
@@ +72,1 @@
> });
So are we going to start encouraging people to actually clean up after their tests? I feel like this pattern is borrowed from desktop, where tests run sequentially without restarting the browser, so spurious tabs can cause unexpected failures.
I don't think cleanup functions like this actually serve a purpose in our test environment. Or is the long term plan to be able to run tests sequentially without creating new profiles between test runs?
I just want to make sure that we're implementing things that serve a purpose. Also, right now we're inconsistent in our use of do_register_cleanup, so I bet there are tests in the tree that don't even try to clean up after themselves.
Updated•9 years ago
|
Flags: needinfo?(margaret.leibovic)
Assignee | ||
Comment 23•9 years ago
|
||
As it is, we can see:
a) we're not currently running the cleanup callbacks that the original devs thought they had implemented.
b) we have cruft in robocop_head.js to remove either way (patches 2-3).
The current attached patches (patches 1-4) would properly implement what was thought to be the case all along, ie: cleanup functions that work.
What you suggest is to remove all code (ala patches 1-3), and add a final patch to complete that by removing the callback invocations in each test, and we're done.
Either approach will be fine with me :-) I'm happy to provide what you and gbrown may decide.
Comment 24•9 years ago
|
||
(In reply to :Margaret Leibovic from comment #22)
> So are we going to start encouraging people to actually clean up after their
> tests? I feel like this pattern is borrowed from desktop, where tests run
> sequentially without restarting the browser, so spurious tabs can cause
> unexpected failures.
>
> I don't think cleanup functions like this actually serve a purpose in our
> test environment. Or is the long term plan to be able to run tests
> sequentially without creating new profiles between test runs?
>
> I just want to make sure that we're implementing things that serve a
> purpose. Also, right now we're inconsistent in our use of
> do_register_cleanup, so I bet there are tests in the tree that don't even
> try to clean up after themselves.
I mostly agree: In general, it should be unnecessary for robocop tests to cleanup, and if they don't need to, then they should not (to keep the test short and tidy if nothing else).
On the other hand...consider bug 1184186, where I aspire to migrate many Robocop JavascriptTests to mochitest-chrome. In that bug, I'm finding it quite handy to s/do_register_cleanup/SimpleTest.registerCleanupFunction/ -- and in those cases, cleanup is important, because the browser is not killed between tests and continues using the same profile. I hope that will be a one-time exercise, but I suppose other tests might one day be migrated to other test environments where cleanup is necessary. So in that light, I think there is some (minimal) value in having a way for a test to declare cleanup code, even if the cleanup is unnecessary.
Comment 25•9 years ago
|
||
(In reply to Geoff Brown [:gbrown] (pto July 22 - 27) from comment #24)
> (In reply to :Margaret Leibovic from comment #22)
> > So are we going to start encouraging people to actually clean up after their
> > tests? I feel like this pattern is borrowed from desktop, where tests run
> > sequentially without restarting the browser, so spurious tabs can cause
> > unexpected failures.
> >
> > I don't think cleanup functions like this actually serve a purpose in our
> > test environment. Or is the long term plan to be able to run tests
> > sequentially without creating new profiles between test runs?
> >
> > I just want to make sure that we're implementing things that serve a
> > purpose. Also, right now we're inconsistent in our use of
> > do_register_cleanup, so I bet there are tests in the tree that don't even
> > try to clean up after themselves.
>
> I mostly agree: In general, it should be unnecessary for robocop tests to
> cleanup, and if they don't need to, then they should not (to keep the test
> short and tidy if nothing else).
>
> On the other hand...consider bug 1184186, where I aspire to migrate many
> Robocop JavascriptTests to mochitest-chrome. In that bug, I'm finding it
> quite handy to s/do_register_cleanup/SimpleTest.registerCleanupFunction/ --
> and in those cases, cleanup is important, because the browser is not killed
> between tests and continues using the same profile. I hope that will be a
> one-time exercise, but I suppose other tests might one day be migrated to
> other test environments where cleanup is necessary. So in that light, I
> think there is some (minimal) value in having a way for a test to declare
> cleanup code, even if the cleanup is unnecessary.
Thanks for the context, this is exactly the type of thing I was wondering about. In this case, I think it does make sense to implement the cleanup capability.
After we land these patches, we should also make a post to mobile-firefox-dev explaining the situation, so that everyone understands what's going on when they attempt to write these cleanup functions.
Updated•9 years ago
|
Attachment #8635118 -
Flags: review?(gbrown) → review+
Comment 26•9 years ago
|
||
Comment on attachment 8635765 [details] [diff] [review]
bug1165556_remove_execute_test.diff
Review of attachment 8635765 [details] [diff] [review]:
-----------------------------------------------------------------
Nice cleanup!
Attachment #8635765 -
Flags: review?(gbrown) → review+
Assignee | ||
Comment 27•9 years ago
|
||
Thanks! So I'll stay on plan (these four patches), after margarets final approval :-)
Updated•9 years ago
|
Attachment #8635766 -
Flags: review?(margaret.leibovic) → review+
Comment 28•9 years ago
|
||
Comment 29•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/a6e752520331
https://hg.mozilla.org/mozilla-central/rev/cf3552e4a833
https://hg.mozilla.org/mozilla-central/rev/d48fbf54c553
https://hg.mozilla.org/mozilla-central/rev/5fc3405af99d
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox42:
--- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 42
Updated•4 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•