[PATCH] Fix tests sensitive to internal library allocations

François Dumont frs.dumont@gmail.com
Mon Aug 21 17:04:15 GMT 2023


Hi

Here is a propocal to fix tests sensitive to libstdc++ internal allocations.

Tested by restoring allocation in tzdb.cc.

As announced I'm also adding a test to detect such allocations. If it is 
ok let me know if you prefer to see it in a different place.

     libstdc++: Fix tests relying on operator new/delete overload

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

     libstdc++-v3/ChangeLog

             * testsuite/util/replacement_memory_operators.h
             (counter::_M_pre_enter_count): New.
             (counter::enter, counter::exit): New static methods to call 
on main() enter/exit.
             * testsuite/23_containers/unordered_map/96088.cc (main):
             Call __gnu_test::counter::enter/exit.
             * 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/ext/no_library_allocation.cc: New test case.

Ok to commit ?

François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloc_aware_tests.patch
Type: text/x-patch
Size: 6940 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20230821/13b58f5a/attachment.bin>


More information about the Libstdc++ mailing list