diff options
author | Clement Courbet <courbet@google.com> | 2019-03-01 16:42:08 +0000 |
---|---|---|
committer | Clement Courbet <courbet@google.com> | 2019-03-01 16:42:08 +0000 |
commit | 10b5efbee8ff86bb2e9a830f0d54667dfe1a5736 (patch) | |
tree | 73547b486b06d68d689747812e9e443913e36997 /test/sanitizer_common | |
parent | fbd3bd9385a37814d013818b11e186aa854f5550 (diff) | |
download | compiler-rt-10b5efbee8ff86bb2e9a830f0d54667dfe1a5736.tar.gz |
Reland "[compiler-rt] Intercept the bcmp() function."
Fix test issues on darwin: The REQUIRES for the test should be the same as the
guard for whether we intercept bcmp.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355204 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/sanitizer_common')
-rw-r--r-- | test/sanitizer_common/TestCases/Posix/weak_hook_test.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/sanitizer_common/TestCases/Posix/weak_hook_test.cc b/test/sanitizer_common/TestCases/Posix/weak_hook_test.cc index 9176a524d..ba98f47b3 100644 --- a/test/sanitizer_common/TestCases/Posix/weak_hook_test.cc +++ b/test/sanitizer_common/TestCases/Posix/weak_hook_test.cc @@ -6,8 +6,11 @@ // XFAIL: lsan // XFAIL: ubsan -#include <string.h> #include <assert.h> +#include <string.h> +#if defined(_GNU_SOURCE) +#include <strings.h> // for bcmp +#endif bool seen_memcmp, seen_strncmp, seen_strncasecmp, seen_strcmp, seen_strcasecmp, seen_strstr, seen_strcasestr, seen_memmem; @@ -59,6 +62,12 @@ int main() { int_sink = memcmp(s1, s2, sizeof(s2)); assert(seen_memcmp); +#if (defined(__linux__) && !defined(__ANDROID__) && defined(_GNU_SOURCE)) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) + seen_memcmp = false; + int_sink = bcmp(s1, s2, sizeof(s2)); + assert(seen_memcmp); +#endif + int_sink = strncmp(s1, s2, sizeof(s2)); assert(seen_strncmp); |