[libcxx-commits] [libcxx] [ASan][libc++] std::basic_string annotations (PR #72677)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 4 14:38:40 PST 2023


AdvenamTacet wrote:

Hey @EricWF , that way of testing ASan is already established in `std::deque` and `std::vector`.
Overhead for tests runtime exists only when those tests are compiled with ASan (therefore, only the `generic-asan` build) plus the overhead for `safe_allocator` tests (basically `min_allocator` with cleaning memory).

We did the same thing with `std::deque` and certain bugs remained undetected before upstreaming, what suggests that ASan tests cannot be less extensive.

Creating a separate set of tests is not  feasible, as it would basically require copy-pasting all tests we have, as almost every function has to be carefully tested. And if a new function is added/overloaded in future, tests should be added in two places.

To address performance concerns when running tests with `safe_allocator`, I can replace `min_allocator` tests with `safe_allocator`, as the latter tests everything what the former and extends beyond it (instead of duplicating tests by adding same ones with the `safe_allocator`, I can replace all instances of `min_allocator` with `safe_allocator` wherever `safe_allocator` is used).
If we don't want two tests, I'm in favor of replacing `min_allocator` with `safe_allocators`, but another approach is to guard `safe_allocator` tests by an ifdef to ensure execution only when compiled with AddressSanitizer. 

What do you think?

https://github.com/llvm/llvm-project/pull/72677


More information about the libcxx-commits mailing list