diff options
author | Mohit K. Bhakkad <mohit.bhakkad@gmail.com> | 2016-05-23 07:02:26 +0000 |
---|---|---|
committer | Mohit K. Bhakkad <mohit.bhakkad@gmail.com> | 2016-05-23 07:02:26 +0000 |
commit | 35a1fb48881a07400406b6c1f7d2e713da99b1d5 (patch) | |
tree | df34080e07ba83b33f4c5164a3eb2f827dd90fa1 | |
parent | 84062bfecb9a754d0947c031ea272fbeacc59bfe (diff) | |
download | compiler-rt-35a1fb48881a07400406b6c1f7d2e713da99b1d5.tar.gz |
Merging r261723:
------------------------------------------------------------------------
r261723 | mohit.bhakkad | 2016-02-24 13:44:41 +0530 (Wed, 24 Feb 2016) | 7 lines
[MSan] fix process_vm_readv test: Exit silently if syscall is not implemeted
Reviewers: eugenis
Subscribers: jaydeep, sagar, llvm-commits
Differential Revision: http://reviews.llvm.org/D17560
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_38@270398 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/msan/Linux/process_vm_readv.cc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/test/msan/Linux/process_vm_readv.cc b/test/msan/Linux/process_vm_readv.cc index 601c0d247..b61578d1b 100644 --- a/test/msan/Linux/process_vm_readv.cc +++ b/test/msan/Linux/process_vm_readv.cc @@ -9,26 +9,31 @@ #include <sys/types.h> #include <sys/uio.h> #include <unistd.h> +#include <errno.h> typedef ssize_t (*process_vm_readwritev_fn)(pid_t, const iovec *, unsigned long, const iovec *, unsigned long, unsigned long); -int main(void) { - // This requires glibc 2.15. - process_vm_readwritev_fn libc_process_vm_readv = - (process_vm_readwritev_fn)dlsym(RTLD_NEXT, "process_vm_readv"); - if (!libc_process_vm_readv) { // Exit with success, emulating the expected output. +int exit_dummy() +{ #ifdef POSITIVE - printf("process_vm_readv not found!\n"); + printf("process_vm_readv not found or not implemented!\n"); printf( "WARNING: MemorySanitizer: use-of-uninitialized-value (not really)\n"); return 1; #else return 0; #endif - } +} + +int main(void) { + // This requires glibc 2.15. + process_vm_readwritev_fn libc_process_vm_readv = + (process_vm_readwritev_fn)dlsym(RTLD_NEXT, "process_vm_readv"); + if (!libc_process_vm_readv) + return exit_dummy(); process_vm_readwritev_fn process_vm_readv = (process_vm_readwritev_fn)dlsym(RTLD_DEFAULT, "process_vm_readv"); @@ -44,6 +49,9 @@ int main(void) { __msan_poison(&b, sizeof(b)); ssize_t res = process_vm_readv(getpid(), iov_b, 2, iov_a, 2, 0); + if (errno == ENOSYS) // Function not implemented + return exit_dummy(); + assert(res == 30); __msan_check_mem_is_initialized(b + 10, 10); __msan_check_mem_is_initialized(b + 30, 20); |