Open Bug 844279 Opened 11 years ago Updated 2 years ago

Integrate GTest with TestHarness.h

Categories

(Testing :: GTest, defect)

x86
macOS
defect

Tracking

(Not tracked)

People

(Reporter: BenWa, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

This was original planned with bug 767231 but I reduced to scope to speed up the landing. This still needs to be done.

See attachment 635578 [details] [diff] [review] in bug 767231 for a WIP.
Attached patch Add GTestHarness (obsolete) — Splinter Review
Assignee: nobody → brian
Status: NEW → ASSIGNED
Now that I look at this, there is not much to it. ASSERT_NSRESULT_SUCCEEDED and ASSERT_NSRESULT_FAILED seem useful and the automatic logging configuration seems useful.

The part that is missing is the use of ScopedXPCOM to start up and shut down XPCOM. I am nervous about the idea of starting up XPCOM and shutting it down multiple times in the same process, especially since nothing else seems to do that.

In the old version of this patch, main() instantiated a ScopedXPCOM instance that lived across all the invocations of all the tests. That had the advantage of avoiding multiple instantiations of XPCOM but it had the disadvantage of reducing the isolation of each test from the others. Now, there's the further complication that main() is already provided by the non-XPCOM GTestRunner so it is not trivial to just add it to main(), especially since we don't want non-XPCOM GTests to start up or shut down XPCOM.
(In reply to Brian Smith (:briansmith, was :bsmith@mozilla.com) from comment #3)
> Now that I look at this, there is not much to it. ASSERT_NSRESULT_SUCCEEDED
> and ASSERT_NSRESULT_FAILED seem useful and the automatic logging
> configuration seems useful.
> 
> The part that is missing is the use of ScopedXPCOM to start up and shut down
> XPCOM. I am nervous about the idea of starting up XPCOM and shutting it down
> multiple times in the same process, especially since nothing else seems to
> do that.

Right, initially I wanted to do something like that but someone pointed out that this likely would be stable. Not a fan of the overhead of starting a new gecko process per test either (great for flaky tests though ^-^). 

Thus GTest currently gets a global ScopedXPCOM pointer. Ignore the bad name for it:
http://mxr.mozilla.org/mozilla-central/source/testing/gtest/mozilla/GTestRunner.cpp#85
Assignee: brian → nobody
Component: General → GTest
No assignee, updating the status.
Status: ASSIGNED → NEW
No assignee, updating the status.
No assignee, updating the status.
No assignee, updating the status.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: