[asan] Add failure logging to global-registration.c test case

llvm-svn: 273629
This commit is contained in:
Ryan Govostes 2016-06-23 23:26:25 +00:00
parent 14416ae6cd
commit 0ec8ab680f
1 changed files with 7 additions and 2 deletions

View File

@ -16,6 +16,7 @@
#if MAIN_FILE
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
extern char buffer2[1];
@ -31,12 +32,16 @@ int main(int argc, char *argv[]) {
// ASAN-CHECK-2: {{0x.* is located 1 bytes .* 'buffer2'}}
} else if (n == 3) {
void *handle = dlopen(DYNAMICLIB, RTLD_NOW);
if (!handle)
if (!handle) {
fprintf(stderr, "dlopen: %s\n", dlerror());
return 1;
}
char *buffer = (char *)dlsym(handle, "buffer3");
if (!buffer)
if (!buffer) {
fprintf(stderr, "dlsym: %s\n", dlerror());
return 1;
}
buffer[argc] = 0;
// ASAN-CHECK-3: {{0x.* is located 1 bytes .* 'buffer3'}}