[libc] Improve testing of mem functions
authorGuillaume Chatelet <gchatelet@google.com>
Thu, 27 Oct 2022 17:01:14 +0000 (17:01 +0000)
committerGuillaume Chatelet <gchatelet@google.com>
Wed, 2 Nov 2022 08:55:46 +0000 (08:55 +0000)
commit3635195e0d54162ba85124fdefcac39bff703149
tree9d5418180f44dc4af6e820a4b82854e452e3c853
parentbe369ea31b98f23c7d8e7a83ea4a1b4cf76b544f
[libc] Improve testing of mem functions

This patch extracts the testing logic from `op_tests.cpp` into
`memory_check_utils.h` so we can reuse it for mem* function integration
tests.

This makes testing consistent and thorough.
For instance this catches a bug that got unnoticed during submission of
D136595 and D135134. Integration test for memcmp was only testing a
single size.

This also leverages ASAN to make sure that data is not read / written
outside permitted boundaries

Differential Revision: https://reviews.llvm.org/D136865
libc/test/src/string/bcmp_test.cpp
libc/test/src/string/bzero_test.cpp
libc/test/src/string/memcmp_test.cpp
libc/test/src/string/memcpy_test.cpp
libc/test/src/string/memmove_test.cpp
libc/test/src/string/memory_utils/memory_check_utils.h [new file with mode: 0644]
libc/test/src/string/memory_utils/op_tests.cpp
libc/test/src/string/memset_test.cpp