Closed
Bug 889182
Opened 11 years ago
Closed 11 years ago
mozapps/extensions xpcshell tests cannot be run concurrently
Categories
(Toolkit :: Add-ons Manager, defect)
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: mihneadb, Assigned: mihneadb)
References
Details
Attachments
(1 file, 7 obsolete files)
341.26 KB,
patch
|
mihneadb
:
review+
|
Details | Diff | Splinter Review |
The main issue is that all the tests use a hardcoded 4444 port. What's worse is that the port is also hardcoded in the static files in the data/ folder.
Assignee | ||
Comment 1•11 years ago
|
||
I tried to intercept the port numbers and either remove them when comparing two URLs and swap out the 4444 to the actual port when handling the RDFs. Did not have much success. Any suggestion would be great!
Assignee: nobody → mihneadb
Assignee | ||
Comment 2•11 years ago
|
||
I am still blocked on this, not sure what's the best solution to this problem. Worst case we can just run these tests sequentially, but this should be avoided.
Comment 3•11 years ago
|
||
Dave, do you have any ideas for getting the hardcoded port out of the xml/rdf files for these tests? Or could you direct us towards the person we should be talking to? Much appreciated!
Flags: needinfo?(dtownsend+bugmail)
Comment 4•11 years ago
|
||
I guess you could create an sjs file that loads the rdf file, replaces %PORT% with the actual port and returns that.
Flags: needinfo?(dtownsend+bugmail)
Assignee | ||
Comment 5•11 years ago
|
||
(In reply to Dave Townsend (:Mossop) from comment #4) > I guess you could create an sjs file that loads the rdf file, replaces > %PORT% with the actual port and returns that. Would this be the best way of doing this? Also, I tried looking up on MDN "sjs" and found nothing, just a mention on the Mochitest wiki page. Some more information (or maybe someone more experienced who could help out with this) would be great! Thank you
Comment 6•11 years ago
|
||
I think sjs would be the best way. There is info on sjs in (just search the page for sjs) https://developer.mozilla.org/en-US/docs/Mochitest and to see different uses of them you can search mxr http://mxr.mozilla.org/mozilla-central/find?text=&string=\.sjs
Assignee | ||
Comment 7•11 years ago
|
||
Work in progress. Managed to do it, this fixes the test_AddonsRepository.js test. Did not use sjs files because getting the info of what static file to serve and what port to use was too complicated. This basically does the same thing, just that it uses a pathHandler instead of an SJS file.
Assignee | ||
Updated•11 years ago
|
Attachment #769983 -
Attachment is obsolete: true
Comment on attachment 775074 [details] [diff] [review] interpolate static files Review of attachment 775074 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/mozapps/extensions/test/xpcshell/head_addons.js @@ +1328,5 @@ > + data += str.value; > + } while (read != 0); > + } > + cstream.close(); // this closes fstream as well > + A quick drive by comment: I like the simplicity of this approach. Seems easier than dealing with a bunch of sjs files. This part here worries me, though. What if this throws? Shouldn't we use try/catch/finally to ensure this stream is closed regardless of whether this throws?
Assignee | ||
Comment 9•11 years ago
|
||
(In reply to Clint Talbert ( :ctalbert ) from comment #8) > Comment on attachment 775074 [details] [diff] [review] > interpolate static files > > Review of attachment 775074 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: toolkit/mozapps/extensions/test/xpcshell/head_addons.js > @@ +1328,5 @@ > > + data += str.value; > > + } while (read != 0); > > + } > > + cstream.close(); // this closes fstream as well > > + > > A quick drive by comment: > I like the simplicity of this approach. Seems easier than dealing with a > bunch of sjs files. This part here worries me, though. What if this throws? > Shouldn't we use try/catch/finally to ensure this stream is closed > regardless of whether this throws? I was thinking that if something in there throws then the test fails and that's it. I will wrap that in a try/catch/finally statement.
Assignee | ||
Comment 10•11 years ago
|
||
10 of the tests in the ini file have to be run sequentially. Will file a bug about those after we land the parallel harness.
Assignee | ||
Updated•11 years ago
|
Attachment #775074 -
Attachment is obsolete: true
Assignee | ||
Comment 11•11 years ago
|
||
:Mossop, should I flag you or :Unfocused for r? ?
Flags: needinfo?(dtownsend+bugmail)
Assignee | ||
Comment 12•11 years ago
|
||
Comment on attachment 775938 [details] [diff] [review] use dynamic ports Flagging both of you per review, as told in IRC by :Unfocused. Thanks!
Attachment #775938 -
Flags: review?(dtownsend+bugmail)
Attachment #775938 -
Flags: review?(bmcbride)
Assignee | ||
Updated•11 years ago
|
Flags: needinfo?(dtownsend+bugmail)
Assignee | ||
Comment 13•11 years ago
|
||
try run: https://tbpl.mozilla.org/?tree=Try&rev=3cc3d0e1e923
Assignee | ||
Comment 14•11 years ago
|
||
(In reply to Mihnea Dobrescu-Balaur (:mihneadb) from comment #12) > Comment on attachment 775938 [details] [diff] [review] > use dynamic ports > > Flagging both of you per review, as told in IRC by :Unfocused. > > Thanks! It's a lot of changes, but here's the summary (it applies to all files except for the ones that are related to the 10 tests that are run sequentially): * changed 4444 to %PORT% in all static files * for every test that uses a httpserver, start the server using a dynamic port * register all the used static files with the server using our custom handler * the custom handler respond with the static file over which it applied a match and replace regex that basically substitutes %PORT% with the value of gPort (found at runtime)
Comment 15•11 years ago
|
||
FYI I'm unlikely to get to this this week due to a work week
Updated•11 years ago
|
Attachment #775938 -
Flags: review?(dtownsend+bugmail)
Assignee | ||
Comment 16•11 years ago
|
||
Rebased my patch so it would apply on the last m-c.
Attachment #778592 -
Flags: review?(bmcbride)
Assignee | ||
Updated•11 years ago
|
Attachment #775938 -
Attachment is obsolete: true
Attachment #775938 -
Flags: review?(bmcbride)
Comment 17•11 years ago
|
||
Comment on attachment 775938 [details] [diff] [review] use dynamic ports Review of attachment 775938 [details] [diff] [review]: ----------------------------------------------------------------- There's a few files still referencing port 4444 related to tests that aren't run sequentially - ideally we should be able to verify that only files referencing port 4444 are related to tests we purposefully set to run sequentially. For the ones I looked at, some (nearly all?) of URLs aren't actually used, but they should be cleaned up anyway - otherwise it's going to cause confusion in the future. For example: http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/test/addons/test_bug470377_1/install.rdf#16 Should be able to just remove the em:updateURL property, since the test doesn't use it (for that specific test, at least - the file it points to doesn't even exist). test_bug299716_2.js should be skipped - it uses a hardcoded port in the install.rdf. The test does an update check and checks nothing changes - sadly, it looks like the test also passes if the update check fails, which seems to be what's happening. We should make that test more robust in a separate followup (it'll require an API change - out of scope here). Ditto with test_bug335238.js ::: toolkit/mozapps/extensions/test/xpcshell/test_bug559800.js @@ +42,1 @@ > } This should be: gServer.stop(do_test_finished); Ditto for the same change elsewhere, like test_dss.js ::: toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js @@ +76,5 @@ > > // Create and configure the HTTP server. > testserver = new HttpServer(); > testserver.registerDirectory("/addons/", do_get_file("addons")); > + testserver.start(-1); Er, I don't think the HTTP server is even used in this test... ::: toolkit/mozapps/extensions/test/xpcshell/test_migrate3.js @@ +121,5 @@ > + homepageURL: "http://localhost:" + gPort + "/data/index.html", > + headerURL: "http://localhost:" + gPort + "/data/header.png", > + footerURL: "http://localhost:" + gPort + "/data/footer.png", > + previewURL: "http://localhost:" + gPort + "/data/preview.png", > + iconURL: "http://localhost:" + gPort + "/data/icon.png" These URLs aren't requested - they just need to be valid URs. So don't need to create a server; don't even need to specify a port even. ::: toolkit/mozapps/extensions/test/xpcshell/test_migrateAddonRepository.js @@ +75,5 @@ > > stmt.params.addon_internal_id = 1; > stmt.params.num = 0; > + stmt.params.url = "http://localhost:" + gPort + "/full1-1.png"; > + stmt.params.thumbnailURL = "http://localhost:" + gPort + "/thumbnail1-1.png"; Same as test_migrate3.js ::: toolkit/mozapps/extensions/test/xpcshell/test_theme.js @@ +258,5 @@ > + homepageURL: "http://localhost:" + gPort + "/data/index.html", > + headerURL: "http://localhost:" + gPort + "/data/header.png", > + footerURL: "http://localhost:" + gPort + "/data/footer.png", > + previewURL: "http://localhost:" + gPort + "/data/preview.png", > + iconURL: "http://localhost:" + gPort + "/data/icon.png" Same as test_migrate3.js
Attachment #775938 -
Flags: review-
Comment 18•11 years ago
|
||
Comment on attachment 778592 [details] [diff] [review] use dynamic ports and interpolate static files Review of attachment 778592 [details] [diff] [review]: ----------------------------------------------------------------- Seemed easier to just finish my original review of the old patch. Since this revision is just dealing with bitrot (I compared the two, and didn't see anything substantially different), the review in comment 17 applies equally here.
Attachment #778592 -
Flags: review?(bmcbride) → review-
Assignee | ||
Comment 19•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Attachment #778592 -
Attachment is obsolete: true
Assignee | ||
Comment 20•11 years ago
|
||
(In reply to Blair McBride [:Unfocused] from comment #17) > Comment on attachment 775938 [details] [diff] [review] > use dynamic ports > > Review of attachment 775938 [details] [diff] [review]: > ----------------------------------------------------------------- > > There's a few files still referencing port 4444 related to tests that aren't > run sequentially - ideally we should be able to verify that only files > referencing port 4444 are related to tests we purposefully set to run > sequentially. I grepped and couldn't find any such files after fixing the stuff you suggested in the review. Can you please give me a list of these files that you are talking about? > > For the ones I looked at, some (nearly all?) of URLs aren't actually used, > but they should be cleaned up anyway - otherwise it's going to cause > confusion in the future. > For example: > http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/ > test/addons/test_bug470377_1/install.rdf#16 > Should be able to just remove the em:updateURL property, since the test > doesn't use it (for that specific test, at least - the file it points to > doesn't even exist). I didn't really touch the files (other than swapping out 4444 to %PORT%) since I don't know all the code and its behaviour. Wouldn't it be better to file a follow up bug after this where someone who knows more about the extensions subtree can offer some guidance on this? > > test_bug299716_2.js should be skipped - it uses a hardcoded port in the > install.rdf. The test does an update check and checks nothing changes - > sadly, it looks like the test also passes if the update check fails, which > seems to be what's happening. We should make that test more robust in a > separate followup (it'll require an API change - out of scope here). > > Ditto with test_bug335238.js So you mean skip these tests completely, or just run them seq? // fixed the other quirks.
Flags: needinfo?(bmcbride)
Comment 21•11 years ago
|
||
(In reply to Mihnea Dobrescu-Balaur (:mihneadb) from comment #20) > I grepped and couldn't find any such files after fixing the stuff you > suggested in the review. Can you please give me a list of these files that you are talking about? Just went through everything again - seems everything in tests/xpcshell is ok, so I must have just seen data files in tests/addons (which are only used by the xpcshell tests). > I didn't really touch the files (other than swapping out 4444 to %PORT%) > since I don't know all the code and its behaviour. Wouldn't it be better to > file a follow up bug after this where someone who knows more about the > extensions subtree can offer some guidance on this? My concern is that without going through those cases, there could be other tests like test_bug299716_2.js that are passing but are actually broken, and we won't know about them. We need to avoid the tree ever being in that state. For instance, looking at test_blocklistchange.js, the XPI files it uses all have hardcoded ports for the updateURL. Yet the test is passing. Looking at the test, it never checks for updates for those XPIs, so the update property should be removed. I think most of the cases should be pretty simple to figure out. They'll be like: * updateURL in install.rdf - check if the test uses the URL. If it does, test is probably broken. If it doesn't, the property should be removed. * URL for icons, lightweight theme images, etc - if these tests are passing, they should be fine (nearly all are dummy URLs). Change the port to 5555, re-run test to confirm its still passing. Whatever is left, I can help look through to see if the test is behaving correctly. > So you mean skip these tests completely, or just run them seq? Sorry, I mean run them sequentially.
Flags: needinfo?(bmcbride)
Assignee | ||
Comment 22•11 years ago
|
||
Let me know if there's anything missing. I also deleted some static files that weren't being used.
Attachment #779971 -
Flags: review?(bmcbride)
Assignee | ||
Updated•11 years ago
|
Attachment #779295 -
Attachment is obsolete: true
Assignee | ||
Comment 23•11 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=c542d4341fa3
Assignee | ||
Comment 24•11 years ago
|
||
I found a few more dummy URLs. Let me know if there's others. The ones that are still left are from tests that are run sequentially anyway and if I delete them (or change the port) the test fails.
Attachment #780802 -
Flags: review?(bmcbride)
Assignee | ||
Updated•11 years ago
|
Attachment #779971 -
Attachment is obsolete: true
Attachment #779971 -
Flags: review?(bmcbride)
Comment 25•11 years ago
|
||
Comment on attachment 780802 [details] [diff] [review] use dynamic ports and interpolate static files Review of attachment 780802 [details] [diff] [review]: ----------------------------------------------------------------- r+ with the following fixup: ::: toolkit/mozapps/extensions/test/xpcshell/test_bug559800.js @@ +39,5 @@ > } > > function end_test() { > do_test_finished(); > + gServer.stop(do_test_finished); do_test_finished should only be called as a callback to stop() in these cases - not before that as well. ie, the whole function should be: function end_test() { gServer.stop(do_test_finished); }
Attachment #780802 -
Flags: review?(bmcbride) → review+
Assignee | ||
Comment 26•11 years ago
|
||
Updated.
Assignee | ||
Updated•11 years ago
|
Attachment #780802 -
Attachment is obsolete: true
Assignee | ||
Comment 27•11 years ago
|
||
Comment on attachment 783838 [details] [diff] [review] use dynamic ports and interpolate static files keeping r+
Attachment #783838 -
Flags: review+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 28•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/408a7705c7a5
Flags: in-testsuite-
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/408a7705c7a5
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in
before you can comment on or make changes to this bug.
Description
•