libstdc++: Fix tests relying on operator new/delete overload
commit2aa8ebc0a606c2b26a4297beb65127080f42e365
authorFrançois Dumont <fdumont@gcc.gnu.org>
Mon, 21 Aug 2023 05:02:06 +0000 (21 07:02 +0200)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Wed, 23 Aug 2023 04:35:24 +0000 (23 06:35 +0200)
treec1ebc8febd352af613dcd033b26a05ed293ae20a
parent3beef5e6b5b12b5c90040c8485f1836e2dd6cf83
libstdc++: Fix tests relying on operator new/delete overload

Fix tests that are checking for an expected allocation plan. They are failing if
an allocation is taking place outside the test main.

libstdc++-v3/ChangeLog

* testsuite/util/replacement_memory_operators.h
(counter::scope): New, capture and reset counter count at construction and
restore it at destruction.
(counter::check_new): Add scope instantiation.
* testsuite/23_containers/unordered_map/96088.cc (main):
Add counter::scope instantiation.
* testsuite/23_containers/unordered_multimap/96088.cc (main): Likewise.
* testsuite/23_containers/unordered_multiset/96088.cc (main): Likewise.
* testsuite/23_containers/unordered_set/96088.cc (main): Likewise.
* testsuite/ext/malloc_allocator/deallocate_local.cc (main): Likewise.
* testsuite/ext/new_allocator/deallocate_local.cc (main): Likewise.
* testsuite/ext/throw_allocator/deallocate_local.cc (main): Likewise.
* testsuite/ext/pool_allocator/allocate_chunk.cc (started): New global.
(operator new(size_t)): Check started.
(main): Set/Unset started.
* testsuite/17_intro/no_library_allocation.cc: New test case.
libstdc++-v3/testsuite/17_intro/no_library_allocation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_map/96088.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/96088.cc
libstdc++-v3/testsuite/23_containers/unordered_multiset/96088.cc
libstdc++-v3/testsuite/23_containers/unordered_set/96088.cc
libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_local.cc
libstdc++-v3/testsuite/ext/new_allocator/deallocate_local.cc
libstdc++-v3/testsuite/ext/pool_allocator/allocate_chunk.cc
libstdc++-v3/testsuite/ext/throw_allocator/deallocate_local.cc
libstdc++-v3/testsuite/util/replacement_memory_operators.h