Closed
Bug 1313141
Opened 8 years ago
Closed 8 years ago
Change the linkage of GeckoCppUnitTests to compile them inside of xul-gtest
Categories
(Firefox Build System :: General, defect)
Firefox Build System
General
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: benjamin, Assigned: n.nethercote)
References
Details
Attachments
(1 obsolete file)
Currently GeckoCppUnitTests compile against the dependent XPCOM glue, each test as an indepdendent binary. Each test is then run separately.
But the XPCOM glue is going away: so what I think we should do here is compile each of these tests into xul-gtest. But unlike gtests, which may not start have global state or start XPCOM, the GeckoCppUnitTests will still run as indendent processes and may start XPCOM if required.
I'd like help with this if there is help available! This is a blocker for bug 1299187.
Flags: needinfo?(n.nethercote)
Assignee | ||
Comment 1•8 years ago
|
||
I'm happy to attempt this, though froydnj and erahm likely know more about this than I do, so any additional info on how to get started would be welcome...
Flags: needinfo?(nfroyd)
Flags: needinfo?(n.nethercote)
Flags: needinfo?(erahm)
Comment 2•8 years ago
|
||
gtests start XPCOM:
http://dxr.mozilla.org/mozilla-central/source/testing/gtest/mozilla/GTestRunner.cpp#90
I wouldn't be at all surprised if they start threads, too:
http://dxr.mozilla.org/mozilla-central/source/xpcom/tests/gtest/TestThreads.cpp#44
http://dxr.mozilla.org/mozilla-central/source/xpcom/tests/gtest/TestThreadPool.cpp#50
I'm not exactly sure how you want them to start as independent processes, but be gtests too...You want to link them against xul-gtest and then...what?
Flags: needinfo?(nfroyd) → needinfo?(benjamin)
Reporter | ||
Comment 3•8 years ago
|
||
I don't want them to *be* gtests. I just want them to be built *within* the gtest-xul library.
Then instead of each one having a separate main() method, we'd have some way to start xpcshell -xpcomtest <testname> and have it dispatch to each test.
Flags: needinfo?(benjamin)
Comment 4•8 years ago
|
||
Seems like we'd be better served just making these gtests and getting rid of GeckoCppUnitTests entirely, there aren't *that* many [1].
[1] http://searchfox.org/mozilla-central/search?q=GeckoCppUnitTests&path=
Flags: needinfo?(erahm)
Comment 5•8 years ago
|
||
(In reply to Eric Rahm [:erahm] from comment #4)
> Seems like we'd be better served just making these gtests and getting rid of
> GeckoCppUnitTests entirely, there aren't *that* many [1].
>
> [1] http://searchfox.org/mozilla-central/search?q=GeckoCppUnitTests&path=
There are 65, some of which don't link libxul.
Comment 6•8 years ago
|
||
(In reply to Benjamin Smedberg [:bsmedberg] from comment #0)
> Currently GeckoCppUnitTests compile against the dependent XPCOM glue, each
> test as an indepdendent binary. Each test is then run separately.
>
> But the XPCOM glue is going away
I'm curious here. I can see the XPCOM dependent glue going away, but that also requires switching plugin-container and several other programs to the XPCOM standalone glue. Can't many of the GeckoCppUnitTests receive the same treatment (use the standalone glue)?
Reporter | ||
Comment 7•8 years ago
|
||
The standalone glue is also going away, except for a little bit of support code.
erahm, as I understand it gtests aren't allowed to change global state/start XPCOM; and so many of these tests aren't gtests because they need start XPCOM/create XPCOM services or use the event loop.
Comment 8•8 years ago
|
||
(In reply to Benjamin Smedberg [:bsmedberg] from comment #7)
> erahm, as I understand it gtests aren't allowed to change global state/start
> XPCOM; and so many of these tests aren't gtests because they need start
> XPCOM/create XPCOM services or use the event loop.
Our mozillafied-gtest thing definitely starts XPCOM [1] and I'm reasonably sure we have tests using the event loop. I'm not sure about the creating services part, but that seems like it would be okay. If they need to *stop* xpcom that might be an issue, but I'm not sure what the use case for that is.
If certain tests need a pristine state it might be possible to specify that they should be run one at a time (as in launch gtest with the specific test path rather than running all).
[1] http://searchfox.org/mozilla-central/rev/4012e61cc38758ffa1f7ce26039173f67b048853/testing/gtest/mozilla/GTestRunner.cpp#90
Comment 9•8 years ago
|
||
(In reply to Benjamin Smedberg [:bsmedberg] from comment #7)
> The standalone glue is also going away, except for a little bit of support
> code.
Is there a bug # for this?
Reporter | ||
Comment 10•8 years ago
|
||
Not a specific one yet. I've been filing bugs attached to 1299187 as I get closer to removing all of those exports.
Reporter | ||
Comment 11•8 years ago
|
||
> Our mozillafied-gtest thing definitely starts XPCOM [1] and I'm reasonably
> sure we have tests using the event loop. I'm not sure about the creating
> services part, but that seems like it would be okay.
Are the tests run single-threaded now, or are they still run on a bunch of worker threads? The thought of having a bunch of tests creating services randomly from various threads fills me with dread. And what would NS_IsMainThread report for tests?
Reporter | ||
Comment 12•8 years ago
|
||
for instance there are things like TestBind.cpp which are currently CppUnitTests, which bind sockets and use the STS.
Comment 13•8 years ago
|
||
(In reply to Benjamin Smedberg [:bsmedberg] from comment #11)
> > Our mozillafied-gtest thing definitely starts XPCOM [1] and I'm reasonably
> > sure we have tests using the event loop. I'm not sure about the creating
> > services part, but that seems like it would be okay.
>
> Are the tests run single-threaded now, or are they still run on a bunch of
> worker threads? The thought of having a bunch of tests creating services
> randomly from various threads fills me with dread. And what would
> NS_IsMainThread report for tests?
I believe they're run one at a time, but possibly are started on a child thread. The child thread would be the XPCOM main thread in this case. I'll double check of course.
Comment 14•8 years ago
|
||
(In reply to Eric Rahm [:erahm] from comment #13)
> I believe they're run one at a time, but possibly are started on a child
> thread. The child thread would be the XPCOM main thread in this case. I'll
> double check of course.
Confirmed, NS_IsMainThread() in a moz-gtest returns true.
Reporter | ||
Comment 15•8 years ago
|
||
glandium actually I did file xpcom glue removal already, it's bug 1306329
Assignee | ||
Comment 16•8 years ago
|
||
I just discussed this with glandium and it sounds like converting these tests to gtests is the best solution -- there might be some tricky ones, but gtests should work for most of them. I will start doing that.
Assignee: nobody → n.nethercote
Assignee | ||
Comment 17•8 years ago
|
||
bsmedberg: erahm tells me you may have started converting TestStartupCache.cpp, is that right? Have you done any others? erahm is working on the xpcom/ ones in bug 1313463.
Flags: needinfo?(benjamin)
Reporter | ||
Comment 18•8 years ago
|
||
Yes TestStartupCache is bug 1314378. I saw the XPCOM bugs so I didn't touch them. I did a few others, you can check the dependency tree of bug 1299178. Here's the unowned ones that are left that I know about:
TestCSPParser
TestIsCertBuiltInRoot
test_AsXXX_helpers
test_async_callbacks_with_spun_event_loops
TestSTSParser
test_asyncStatementExecution_transaction
TestCertDB
test_binding_params
test_file_perms
test_IHistory
Flags: needinfo?(benjamin)
Reporter | ||
Comment 19•8 years ago
|
||
Here is a better list of the remaining tests that need to be converted. With existing conversions in tree and this patch, I can get Firefox to build with no xpcomglue_s library.
Assignee | ||
Comment 20•8 years ago
|
||
(In reply to Benjamin Smedberg [:bsmedberg] from comment #18)
> Yes TestStartupCache is bug 1314378. I saw the XPCOM bugs so I didn't touch
> them. I did a few others, you can check the dependency tree of bug 1299178.
That should be bug 1299187. To clarify things, I've updated the dependencies so that the test-related bugs all block this bug.
> Here's the unowned ones that are left that I know about:
>
> TestCSPParser
> TestIsCertBuiltInRoot
> test_AsXXX_helpers
> test_async_callbacks_with_spun_event_loops
> TestSTSParser
> test_asyncStatementExecution_transaction
> TestCertDB
> test_binding_params
> test_file_perms
> test_IHistory
Thank you for the list. I'll start chipping away at these today.
Assignee | ||
Comment 21•8 years ago
|
||
> Here is a better list of the remaining tests that need to be converted. With
> existing conversions in tree and this patch, I can get Firefox to build with
> no xpcomglue_s library.
Did you do that test build on Windows? There are some more GeckoCppUnitTests in media/webrtc/signaling/test/ that aren't built on Windows. They look a bit tricky.
Most of them are actually already gtests, but they invoke RUN_ALL_TESTS themselves. Those ones look like they won't be too hard. But mediaconduit_unittests.cpp and signaling_unittests.cpp do some threaded gtest stuff that I don't yet understand, so I'm not sure if they'll be difficult to convert.
Flags: needinfo?(benjamin)
Reporter | ||
Comment 22•8 years ago
|
||
Yes, my tree is currently a windows tree.
Flags: needinfo?(benjamin)
Reporter | ||
Comment 23•8 years ago
|
||
I filed bug 1316611 about the webrtc/signaling/test issue.
Assignee | ||
Comment 24•8 years ago
|
||
Comment on attachment 8806764 [details]
bug1313141-list.txt
All the tests identified in the attached file (plus the WebRTC ones) now have an in-progress blocking bug report on file.
Attachment #8806764 -
Attachment is obsolete: true
Reporter | ||
Comment 25•8 years ago
|
||
As a tracking bug this is done! Yay. There's one disabled webrtc test that dmajor is working on, but it doesn't block this any more.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
Updated•7 years ago
|
Product: Core → Firefox Build System
You need to log in
before you can comment on or make changes to this bug.
Description
•