Closed Bug 1313470 Opened 3 years ago Closed 3 years ago

Convert XPCOM test TestCOMPtr to a gtest

Categories

(Core :: XPCOM, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: erahm, Assigned: erahm)

References

Details

Attachments

(3 files)

Convert xpcom/tests/TestCOMPtr.cpp to a gtest and move to xpcom/tests/gtest/.
This is just whitespace changes with a few minor deletions.

MozReview-Commit-ID: A7fpHLqt5fU
Attachment #8806112 - Flags: review?(nfroyd)
Assignee: nobody → erahm
Status: NEW → ASSIGNED
This just splits out test functions, no logic is changed.

MozReview-Commit-ID: EjGYyUjf1b2
Attachment #8806113 - Flags: review?(nfroyd)
MozReview-Commit-ID: HfcLTmvkRc8
Attachment #8806114 - Flags: review?(nfroyd)
Comment on attachment 8806112 [details] [diff] [review]
Part 0: Cleanup indentation

Review of attachment 8806112 [details] [diff] [review]:
-----------------------------------------------------------------

Please delete trailing whitespace while you are here.
Attachment #8806112 - Flags: review?(nfroyd) → review+
Attachment #8806113 - Flags: review?(nfroyd) → review+
Attachment #8806114 - Flags: review?(nfroyd) → review+
(In reply to Nathan Froyd [:froydnj] from comment #4)
> Comment on attachment 8806112 [details] [diff] [review]
> Part 0: Cleanup indentation
> 
> Review of attachment 8806112 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Please delete trailing whitespace while you are here.

The offending line gets deleted later in the patchset.
I can't repro this locally with an OSX debug build.

Relevant log snippet:

> 21:06:34     INFO -  TEST-START | COMPtr.Bloat_Smart
> 21:06:34     INFO -  [2276] ###!!! ASSERTION: QueryInterface needed: 'query_result.get() == mRawPtr', file /builds/slave/m-in-m64-d-0000000000000000000/build/src/obj-firefox/dist/include/nsCOMPtr.h, line 414
> 21:07:04 INFO - #01: COMPtr_Bloat_Smart_Test::TestBody() [xpcom/tests/gtest/TestCOMPtr.cpp:234]

So |COMPtr.Bloat_Smart| is crashing at:

> nsresult rv = CreateIBar( getter_AddRefs(barP) );

Where CreateIBar looks like:

> CreateIBar( void** result )
> {
>   IBar* barp = new IBar;
>   barp->AddRef();
>   *result = barp;
>   return NS_OK;
> }

The assertion is in:

>  void Assert_NoQueryNeeded()
>  {
>    if (mRawPtr) {
>      nsCOMPtr<T> query_result(do_QueryInterface(mRawPtr));
>      NS_ASSERTION(query_result.get() == mRawPtr, "QueryInterface needed");
>    }
>  }
Okay I can repro with the whole patchset applied which implies some misbehavior from having multiple file-scoped definitions of IFoo or IBar.
https://hg.mozilla.org/mozilla-central/rev/351981a14a43
https://hg.mozilla.org/mozilla-central/rev/733ef60958c1
https://hg.mozilla.org/mozilla-central/rev/fa89c7fb9657
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
For posterity: my fix was just to move the support code into a private namespace.
You need to log in before you can comment on or make changes to this bug.