Page MenuHomePhabricator

Move more tests to globalMemCounter and reset.
ClosedPublic

Authored by danalbert on Mar 12 2020, 12:17 PM.

Details

Summary

Android's libc uses new/delete internally and these are counted, so
the counter needs to be reset to zero at the start of the test.

Diff Detail

Event Timeline

danalbert created this revision.Mar 12 2020, 12:17 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Mar 12 2020, 3:20 PM
This revision is now accepted and ready to land.Mar 12 2020, 3:20 PM
This revision was automatically updated to reflect the committed changes.
EricWF reopened this revision.Mar 13 2020, 1:24 PM

Some of the changes in this patch are not correct. Please revert them in a follow up commit.

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
33

This change isn't correct.

The test was looking to ensure a *specific* overload of new/delete was replaceable and getting called.
It now checks that *any* overload is called.

Please revert this change.

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
35

This change isn't correct.

The test was looking to ensure a *specific* overload of new/delete was replaceable and getting called.
It now checks that *any* overload is called.

Please revert this change.

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp
34

This change isn't correct.

The test was looking to ensure a *specific* overload of new/delete was replaceable and getting called.
It now checks that *any* overload is called.

Please revert this change.

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
21

This change isn't correct.

The test was looking to ensure a *specific* overload of new/delete was replaceable and getting called.
It now checks that *any* overload is called.

Please revert this change.

This revision is now accepted and ready to land.Mar 13 2020, 1:24 PM

Some of the changes in this patch are not correct. Please revert them in a follow up commit.

Thanks for spotting that. Reverted the whole patch and will follow up soon.

ldionne added inline comments.Mar 13 2020, 1:40 PM
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
33

Wait, how's that true? The only operator new that modifies the result of globalMemCounter.checkOutstandingNewEq in count_new.h is void* operator new(std::size_t s) TEST_THROW_SPEC(std::bad_alloc), which is the same as here, no?

Other overloads of new have different counters, don't they?

danalbert marked an inline comment as done.Mar 13 2020, 5:09 PM
danalbert added inline comments.
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
33

I think the problem is that this test is trying to make sure this replacement is called by the implementation if the array variant is not _also_ replaced. Including count_new.hpp causes all of the replacements to be used, so the behavior of the actual array new implementation isn't what ends up being tested.

This was in fact covering up a failing test on Android (albeit not one I can do anything about, since we fixed it ages ago but still affects older devices that I support), so the test definitely is doing its job :)

Repushed this in 9c5d0ea6784bf08337bd20d44911ebf6bfbd2822, with these tests fixed.

danalbert closed this revision.Mar 13 2020, 5:34 PM