diff options
author | Michael Zolotukhin <mzolotukhin@apple.com> | 2018-07-07 00:07:00 +0000 |
---|---|---|
committer | Michael Zolotukhin <mzolotukhin@apple.com> | 2018-07-07 00:07:00 +0000 |
commit | 94e3d5fef4f126a865dfd491d76b5d6ab739723d (patch) | |
tree | d712eae4ad224ff4ce753ab782eca971fe691c6d /test/profile | |
parent | 5f86245e650b724fc59a1eb19d536090773c48cd (diff) |
Revert "Make __gcov_flush flush counters for all shared libraries"
This reverts r336365: the added tests are failing on various
configurations (e.g. on green-dragon).
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336474 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/profile')
19 files changed, 16 insertions, 598 deletions
diff --git a/test/profile/Inputs/instrprof-dlopen-dlclose-main.c b/test/profile/Inputs/instrprof-dlopen-dlclose-main.c index 3f4a4f6cc..198e4e82f 100644 --- a/test/profile/Inputs/instrprof-dlopen-dlclose-main.c +++ b/test/profile/Inputs/instrprof-dlopen-dlclose-main.c @@ -10,12 +10,6 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - void (*func)(void) = (void (*)(void))dlsym(f1_handle, "func"); - if (func == NULL) { - fprintf(stderr, "unable to lookup symbol 'func': %s\n", dlerror()); - return EXIT_FAILURE; - } - dlerror(); void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL); if (f2_handle == NULL) { @@ -23,44 +17,31 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - void (*func2)(void) = (void (*)(void))dlsym(f2_handle, "func2"); - if (func2 == NULL) { - fprintf(stderr, "unable to lookup symbol 'func2': %s\n", dlerror()); - return EXIT_FAILURE; - } - func2(); - -#ifdef USE_LIB3 - void *f3_handle = dlopen("func3.shared", RTLD_LAZY | RTLD_GLOBAL); - if (f3_handle == NULL) { - fprintf(stderr, "unable to open 'func3.shared': %s\n", dlerror()); - return EXIT_FAILURE; - } - - void (*func3)(void) = (void (*)(void))dlsym(f3_handle, "func3"); - if (func3 == NULL) { - fprintf(stderr, "unable to lookup symbol 'func3': %s\n", dlerror()); + dlerror(); + void (*gcov_flush)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); + if (gcov_flush != NULL || dlerror() == NULL) { + fprintf(stderr, "__gcov_flush should not be visible in func.shared'\n"); return EXIT_FAILURE; } - func3(); -#endif dlerror(); - void (*gcov_flush1)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); - if (gcov_flush1 == NULL) { - fprintf(stderr, "unable to find __gcov_flush in func.shared': %s\n", dlerror()); + void (*f1_flush)() = (void (*)())dlsym(f1_handle, "llvm_gcov_flush"); + if (f1_flush == NULL) { + fprintf(stderr, "unable to find llvm_gcov_flush in func.shared': %s\n", dlerror()); return EXIT_FAILURE; } + f1_flush(); dlerror(); - void (*gcov_flush2)() = (void (*)())dlsym(f2_handle, "__gcov_flush"); - if (gcov_flush2 == NULL) { - fprintf(stderr, "unable to find __gcov_flush in func2.shared': %s\n", dlerror()); + void (*f2_flush)() = (void (*)())dlsym(f2_handle, "llvm_gcov_flush"); + if (f2_flush == NULL) { + fprintf(stderr, "unable to find llvm_gcov_flush in func2.shared': %s\n", dlerror()); return EXIT_FAILURE; } + f2_flush(); - if (gcov_flush1 == gcov_flush2) { - fprintf(stderr, "Same __gcov_flush found in func.shared and func2.shared\n"); + if (f1_flush == f2_flush) { + fprintf(stderr, "Same llvm_gcov_flush found in func.shared and func2.shared\n"); return EXIT_FAILURE; } @@ -70,17 +51,6 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - func(); - - int g1 = 0; - int g2 = 0; - int n = 10; - - if (n % 5 == 0) - g1++; - else - g2++; - return EXIT_SUCCESS; } diff --git a/test/profile/Inputs/instrprof-dlopen-dlclose-main.c.gcov b/test/profile/Inputs/instrprof-dlopen-dlclose-main.c.gcov deleted file mode 100644 index acb2076fd..000000000 --- a/test/profile/Inputs/instrprof-dlopen-dlclose-main.c.gcov +++ /dev/null @@ -1,91 +0,0 @@ -// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-dlopen-dlclose-main.c -// CHECK-NEXT: -: 0:Graph:instrprof-dlopen-dlclose-main.gcno -// CHECK-NEXT: -: 0:Data:instrprof-dlopen-dlclose-main.gcda -// CHECK-NEXT: -: 0:Runs:1 -// CHECK-NEXT: -: 0:Programs:1 -// CHECK-NEXT: -: 1:#include <dlfcn.h> -// CHECK-NEXT: -: 2:#include <stdio.h> -// CHECK-NEXT: -: 3:#include <stdlib.h> -// CHECK-NEXT: -: 4: -// CHECK-NEXT: -: 5:int main(int argc, char *argv[]) { -// CHECK-NEXT: 1: 6: dlerror(); -// CHECK-NEXT: 1: 7: void *f1_handle = dlopen("func.shared", RTLD_LAZY | RTLD_GLOBAL); -// CHECK-NEXT: 1: 8: if (f1_handle == NULL) { -// CHECK-NEXT: #####: 9: fprintf(stderr, "unable to open 'func.shared': %s\n", dlerror()); -// CHECK-NEXT: #####: 10: return EXIT_FAILURE; -// CHECK-NEXT: -: 11: } -// CHECK-NEXT: -: 12: -// CHECK-NEXT: 1: 13: void (*func)(void) = (void (*)(void))dlsym(f1_handle, "func"); -// CHECK-NEXT: 1: 14: if (func == NULL) { -// CHECK-NEXT: #####: 15: fprintf(stderr, "unable to lookup symbol 'func': %s\n", dlerror()); -// CHECK-NEXT: #####: 16: return EXIT_FAILURE; -// CHECK-NEXT: -: 17: } -// CHECK-NEXT: -: 18: -// CHECK-NEXT: 1: 19: dlerror(); -// CHECK-NEXT: 1: 20: void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL); -// CHECK-NEXT: 1: 21: if (f2_handle == NULL) { -// CHECK-NEXT: #####: 22: fprintf(stderr, "unable to open 'func2.shared': %s\n", dlerror()); -// CHECK-NEXT: #####: 23: return EXIT_FAILURE; -// CHECK-NEXT: -: 24: } -// CHECK-NEXT: -: 25: -// CHECK-NEXT: 1: 26: void (*func2)(void) = (void (*)(void))dlsym(f2_handle, "func2"); -// CHECK-NEXT: 1: 27: if (func2 == NULL) { -// CHECK-NEXT: #####: 28: fprintf(stderr, "unable to lookup symbol 'func2': %s\n", dlerror()); -// CHECK-NEXT: #####: 29: return EXIT_FAILURE; -// CHECK-NEXT: -: 30: } -// CHECK-NEXT: 1: 31: func2(); -// CHECK-NEXT: -: 32: -// CHECK-NEXT: -: 33:#ifdef USE_LIB3 -// CHECK-NEXT: -: 34: void *f3_handle = dlopen("func3.shared", RTLD_LAZY | RTLD_GLOBAL); -// CHECK-NEXT: -: 35: if (f3_handle == NULL) { -// CHECK-NEXT: -: 36: fprintf(stderr, "unable to open 'func3.shared': %s\n", dlerror()); -// CHECK-NEXT: -: 37: return EXIT_FAILURE; -// CHECK-NEXT: -: 38: } -// CHECK-NEXT: -: 39: -// CHECK-NEXT: -: 40: void (*func3)(void) = (void (*)(void))dlsym(f3_handle, "func3"); -// CHECK-NEXT: -: 41: if (func3 == NULL) { -// CHECK-NEXT: -: 42: fprintf(stderr, "unable to lookup symbol 'func3': %s\n", dlerror()); -// CHECK-NEXT: -: 43: return EXIT_FAILURE; -// CHECK-NEXT: -: 44: } -// CHECK-NEXT: -: 45: func3(); -// CHECK-NEXT: -: 46:#endif -// CHECK-NEXT: -: 47: -// CHECK-NEXT: 1: 48: dlerror(); -// CHECK-NEXT: 1: 49: void (*gcov_flush1)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); -// CHECK-NEXT: 1: 50: if (gcov_flush1 == NULL) { -// CHECK-NEXT: #####: 51: fprintf(stderr, "unable to find __gcov_flush in func.shared': %s\n", dlerror()); -// CHECK-NEXT: #####: 52: return EXIT_FAILURE; -// CHECK-NEXT: -: 53: } -// CHECK-NEXT: -: 54: -// CHECK-NEXT: 1: 55: dlerror(); -// CHECK-NEXT: 1: 56: void (*gcov_flush2)() = (void (*)())dlsym(f2_handle, "__gcov_flush"); -// CHECK-NEXT: 1: 57: if (gcov_flush2 == NULL) { -// CHECK-NEXT: #####: 58: fprintf(stderr, "unable to find __gcov_flush in func2.shared': %s\n", dlerror()); -// CHECK-NEXT: #####: 59: return EXIT_FAILURE; -// CHECK-NEXT: -: 60: } -// CHECK-NEXT: -: 61: -// CHECK-NEXT: 1: 62: if (gcov_flush1 == gcov_flush2) { -// CHECK-NEXT: #####: 63: fprintf(stderr, "Same __gcov_flush found in func.shared and func2.shared\n"); -// CHECK-NEXT: #####: 64: return EXIT_FAILURE; -// CHECK-NEXT: -: 65: } -// CHECK-NEXT: -: 66: -// CHECK-NEXT: 1: 67: dlerror(); -// CHECK-NEXT: 1: 68: if (dlclose(f2_handle) != 0) { -// CHECK-NEXT: #####: 69: fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror()); -// CHECK-NEXT: #####: 70: return EXIT_FAILURE; -// CHECK-NEXT: -: 71: } -// CHECK-NEXT: -: 72: -// CHECK-NEXT: 1: 73: func(); -// CHECK-NEXT: -: 74: -// CHECK-NEXT: 1: 75: int g1 = 0; -// CHECK-NEXT: 1: 76: int g2 = 0; -// CHECK-NEXT: 1: 77: int n = 10; -// CHECK-NEXT: -: 78: -// CHECK-NEXT: 1: 79: if (n % 5 == 0) -// CHECK-NEXT: 1: 80: g1++; -// CHECK-NEXT: -: 81: else -// CHECK-NEXT: #####: 82: g2++; -// CHECK-NEXT: -: 83: -// CHECK-NEXT: 1: 84: return EXIT_SUCCESS; -// CHECK-NEXT: 1: 85:} -// CHECK-NEXT: -: 86: diff --git a/test/profile/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov b/test/profile/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov deleted file mode 100644 index 97eef4c3b..000000000 --- a/test/profile/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov +++ /dev/null @@ -1,91 +0,0 @@ -// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-dlopen-dlclose-main.c -// CHECK-NEXT: -: 0:Graph:instrprof-dlopen-dlclose-main.gcno -// CHECK-NEXT: -: 0:Data:instrprof-dlopen-dlclose-main.gcda -// CHECK-NEXT: -: 0:Runs:1 -// CHECK-NEXT: -: 0:Programs:1 -// CHECK-NEXT: -: 1:#include <dlfcn.h> -// CHECK-NEXT: -: 2:#include <stdio.h> -// CHECK-NEXT: -: 3:#include <stdlib.h> -// CHECK-NEXT: -: 4: -// CHECK-NEXT: -: 5:int main(int argc, char *argv[]) { -// CHECK-NEXT: 1: 6: dlerror(); -// CHECK-NEXT: 1: 7: void *f1_handle = dlopen("func.shared", RTLD_LAZY | RTLD_GLOBAL); -// CHECK-NEXT: 1: 8: if (f1_handle == NULL) { -// CHECK-NEXT: #####: 9: fprintf(stderr, "unable to open 'func.shared': %s\n", dlerror()); -// CHECK-NEXT: #####: 10: return EXIT_FAILURE; -// CHECK-NEXT: -: 11: } -// CHECK-NEXT: -: 12: -// CHECK-NEXT: 1: 13: void (*func)(void) = (void (*)(void))dlsym(f1_handle, "func"); -// CHECK-NEXT: 1: 14: if (func == NULL) { -// CHECK-NEXT: #####: 15: fprintf(stderr, "unable to lookup symbol 'func': %s\n", dlerror()); -// CHECK-NEXT: #####: 16: return EXIT_FAILURE; -// CHECK-NEXT: -: 17: } -// CHECK-NEXT: -: 18: -// CHECK-NEXT: 1: 19: dlerror(); -// CHECK-NEXT: 1: 20: void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL); -// CHECK-NEXT: 1: 21: if (f2_handle == NULL) { -// CHECK-NEXT: #####: 22: fprintf(stderr, "unable to open 'func2.shared': %s\n", dlerror()); -// CHECK-NEXT: #####: 23: return EXIT_FAILURE; -// CHECK-NEXT: -: 24: } -// CHECK-NEXT: -: 25: -// CHECK-NEXT: 1: 26: void (*func2)(void) = (void (*)(void))dlsym(f2_handle, "func2"); -// CHECK-NEXT: 1: 27: if (func2 == NULL) { -// CHECK-NEXT: #####: 28: fprintf(stderr, "unable to lookup symbol 'func2': %s\n", dlerror()); -// CHECK-NEXT: #####: 29: return EXIT_FAILURE; -// CHECK-NEXT: -: 30: } -// CHECK-NEXT: 1: 31: func2(); -// CHECK-NEXT: -: 32: -// CHECK-NEXT: -: 33:#ifdef USE_LIB3 -// CHECK-NEXT: 1: 34: void *f3_handle = dlopen("func3.shared", RTLD_LAZY | RTLD_GLOBAL); -// CHECK-NEXT: 1: 35: if (f3_handle == NULL) { -// CHECK-NEXT: #####: 36: fprintf(stderr, "unable to open 'func3.shared': %s\n", dlerror()); -// CHECK-NEXT: #####: 37: return EXIT_FAILURE; -// CHECK-NEXT: -: 38: } -// CHECK-NEXT: -: 39: -// CHECK-NEXT: 1: 40: void (*func3)(void) = (void (*)(void))dlsym(f3_handle, "func3"); -// CHECK-NEXT: 1: 41: if (func3 == NULL) { -// CHECK-NEXT: #####: 42: fprintf(stderr, "unable to lookup symbol 'func3': %s\n", dlerror()); -// CHECK-NEXT: #####: 43: return EXIT_FAILURE; -// CHECK-NEXT: -: 44: } -// CHECK-NEXT: 1: 45: func3(); -// CHECK-NEXT: -: 46:#endif -// CHECK-NEXT: -: 47: -// CHECK-NEXT: 1: 48: dlerror(); -// CHECK-NEXT: 1: 49: void (*gcov_flush1)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); -// CHECK-NEXT: 1: 50: if (gcov_flush1 == NULL) { -// CHECK-NEXT: #####: 51: fprintf(stderr, "unable to find __gcov_flush in func.shared': %s\n", dlerror()); -// CHECK-NEXT: #####: 52: return EXIT_FAILURE; -// CHECK-NEXT: -: 53: } -// CHECK-NEXT: -: 54: -// CHECK-NEXT: 1: 55: dlerror(); -// CHECK-NEXT: 1: 56: void (*gcov_flush2)() = (void (*)())dlsym(f2_handle, "__gcov_flush"); -// CHECK-NEXT: 1: 57: if (gcov_flush2 == NULL) { -// CHECK-NEXT: #####: 58: fprintf(stderr, "unable to find __gcov_flush in func2.shared': %s\n", dlerror()); -// CHECK-NEXT: #####: 59: return EXIT_FAILURE; -// CHECK-NEXT: -: 60: } -// CHECK-NEXT: -: 61: -// CHECK-NEXT: 1: 62: if (gcov_flush1 == gcov_flush2) { -// CHECK-NEXT: #####: 63: fprintf(stderr, "Same __gcov_flush found in func.shared and func2.shared\n"); -// CHECK-NEXT: #####: 64: return EXIT_FAILURE; -// CHECK-NEXT: -: 65: } -// CHECK-NEXT: -: 66: -// CHECK-NEXT: 1: 67: dlerror(); -// CHECK-NEXT: 1: 68: if (dlclose(f2_handle) != 0) { -// CHECK-NEXT: #####: 69: fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror()); -// CHECK-NEXT: #####: 70: return EXIT_FAILURE; -// CHECK-NEXT: -: 71: } -// CHECK-NEXT: -: 72: -// CHECK-NEXT: 1: 73: func(); -// CHECK-NEXT: -: 74: -// CHECK-NEXT: 1: 75: int g1 = 0; -// CHECK-NEXT: 1: 76: int g2 = 0; -// CHECK-NEXT: 1: 77: int n = 10; -// CHECK-NEXT: -: 78: -// CHECK-NEXT: 1: 79: if (n % 5 == 0) -// CHECK-NEXT: 1: 80: g1++; -// CHECK-NEXT: -: 81: else -// CHECK-NEXT: #####: 82: g2++; -// CHECK-NEXT: -: 83: -// CHECK-NEXT: 1: 84: return EXIT_SUCCESS; -// CHECK-NEXT: 1: 85:} -// CHECK-NEXT: -: 86: diff --git a/test/profile/Inputs/instrprof-dlopen-func.c.gcov b/test/profile/Inputs/instrprof-dlopen-func.c.gcov deleted file mode 100644 index 5c7c7f1ca..000000000 --- a/test/profile/Inputs/instrprof-dlopen-func.c.gcov +++ /dev/null @@ -1,6 +0,0 @@ -// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-dlopen-func.c -// CHECK-NEXT: -: 0:Graph:instrprof-dlopen-func.gcno -// CHECK-NEXT: -: 0:Data:instrprof-dlopen-func.gcda -// CHECK-NEXT: -: 0:Runs:1 -// CHECK-NEXT: -: 0:Programs:1 -// CHECK-NEXT: 3: 1:void func(int K) { if (K) {} } diff --git a/test/profile/Inputs/instrprof-dlopen-func2.c.gcov b/test/profile/Inputs/instrprof-dlopen-func2.c.gcov deleted file mode 100644 index 5bfcf6f15..000000000 --- a/test/profile/Inputs/instrprof-dlopen-func2.c.gcov +++ /dev/null @@ -1,6 +0,0 @@ -// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-dlopen-func2.c -// CHECK-NEXT: -: 0:Graph:instrprof-dlopen-func2.gcno -// CHECK-NEXT: -: 0:Data:instrprof-dlopen-func2.gcda -// CHECK-NEXT: -: 0:Runs:1 -// CHECK-NEXT: -: 0:Programs:1 -// CHECK-NEXT: 3: 1:void func2(int K) { if (K) {} } diff --git a/test/profile/Inputs/instrprof-dlopen-func3.c b/test/profile/Inputs/instrprof-dlopen-func3.c deleted file mode 100644 index 5785f46cc..000000000 --- a/test/profile/Inputs/instrprof-dlopen-func3.c +++ /dev/null @@ -1 +0,0 @@ -void func3(int K) { if (K) {} } diff --git a/test/profile/Inputs/instrprof-dlopen-func3.c.gcov b/test/profile/Inputs/instrprof-dlopen-func3.c.gcov deleted file mode 100644 index 5bfcf6f15..000000000 --- a/test/profile/Inputs/instrprof-dlopen-func3.c.gcov +++ /dev/null @@ -1,6 +0,0 @@ -// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-dlopen-func2.c -// CHECK-NEXT: -: 0:Graph:instrprof-dlopen-func2.gcno -// CHECK-NEXT: -: 0:Data:instrprof-dlopen-func2.gcda -// CHECK-NEXT: -: 0:Runs:1 -// CHECK-NEXT: -: 0:Programs:1 -// CHECK-NEXT: 3: 1:void func2(int K) { if (K) {} } diff --git a/test/profile/Inputs/instrprof-shared-lib.c.gcov b/test/profile/Inputs/instrprof-shared-lib.c.gcov deleted file mode 100644 index fbc43d5f7..000000000 --- a/test/profile/Inputs/instrprof-shared-lib.c.gcov +++ /dev/null @@ -1,14 +0,0 @@ -// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-lib.c -// CHECK-NEXT: -: 0:Graph:instrprof-shared-lib.gcno -// CHECK-NEXT: -: 0:Data:instrprof-shared-lib.gcda -// CHECK-NEXT: -: 0:Runs:1 -// CHECK-NEXT: -: 0:Programs:1 -// CHECK-NEXT: -: 1:int g1 = 0; -// CHECK-NEXT: -: 2:int g2 = 1; -// CHECK-NEXT: -: 3: -// CHECK-NEXT: -: 4:void foo(int n) { -// CHECK-NEXT: 1: 5: if (n % 5 == 0) -// CHECK-NEXT: #####: 6: g1++; -// CHECK-NEXT: -: 7: else -// CHECK-NEXT: 1: 8: g2++; -// CHECK-NEXT: 1: 9:} diff --git a/test/profile/Inputs/instrprof-shared-lib_called-twice.c.gcov b/test/profile/Inputs/instrprof-shared-lib_called-twice.c.gcov deleted file mode 100644 index 779c885d8..000000000 --- a/test/profile/Inputs/instrprof-shared-lib_called-twice.c.gcov +++ /dev/null @@ -1,14 +0,0 @@ -// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-lib.c -// CHECK-NEXT: -: 0:Graph:instrprof-shared-lib.gcno -// CHECK-NEXT: -: 0:Data:instrprof-shared-lib.gcda -// CHECK-NEXT: -: 0:Runs:1 -// CHECK-NEXT: -: 0:Programs:1 -// CHECK-NEXT: -: 1:int g1 = 0; -// CHECK-NEXT: -: 2:int g2 = 1; -// CHECK-NEXT: -: 3: -// CHECK-NEXT: -: 4:void foo(int n) { -// CHECK-NEXT: 2: 5: if (n % 5 == 0) -// CHECK-NEXT: #####: 6: g1++; -// CHECK-NEXT: -: 7: else -// CHECK-NEXT: 2: 8: g2++; -// CHECK-NEXT: 2: 9:} diff --git a/test/profile/Inputs/instrprof-shared-lib_in-loop.c.gcov b/test/profile/Inputs/instrprof-shared-lib_in-loop.c.gcov deleted file mode 100644 index 76503d914..000000000 --- a/test/profile/Inputs/instrprof-shared-lib_in-loop.c.gcov +++ /dev/null @@ -1,14 +0,0 @@ -// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-lib.c -// CHECK-NEXT: -: 0:Graph:instrprof-shared-lib.gcno -// CHECK-NEXT: -: 0:Data:instrprof-shared-lib.gcda -// CHECK-NEXT: -: 0:Runs:1 -// CHECK-NEXT: -: 0:Programs:1 -// CHECK-NEXT: -: 1:int g1 = 0; -// CHECK-NEXT: -: 2:int g2 = 1; -// CHECK-NEXT: -: 3: -// CHECK-NEXT: -: 4:void foo(int n) { -// CHECK-NEXT: 1000000: 5: if (n % 5 == 0) -// CHECK-NEXT: 360000: 6: g1++; -// CHECK-NEXT: -: 7: else -// CHECK-NEXT: 640000: 8: g2++; -// CHECK-NEXT: 1000000: 9:} diff --git a/test/profile/Inputs/instrprof-shared-main-gcov-flush.c b/test/profile/Inputs/instrprof-shared-main-gcov-flush.c deleted file mode 100644 index 9f41b7e63..000000000 --- a/test/profile/Inputs/instrprof-shared-main-gcov-flush.c +++ /dev/null @@ -1,36 +0,0 @@ -extern void foo(int n); -extern void __gcov_flush(void); - -int bar1 = 0; -int bar2 = 1; - -void bar(int n) { - if (n % 5 == 0) - bar1++; - else - bar2++; -} - -int main(int argc, char *argv[]) { -#ifdef SHARED_CALL_BEFORE_GCOV_FLUSH - foo(1); -#endif - - bar(5); - - __gcov_flush(); - - bar(5); - -#ifdef SHARED_CALL_AFTER_GCOV_FLUSH - foo(1); -#endif - -#ifdef EXIT_ABRUPTLY - _exit(0); -#endif - - bar(5); - - return 0; -} diff --git a/test/profile/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov b/test/profile/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov deleted file mode 100644 index b2dfe2acd..000000000 --- a/test/profile/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov +++ /dev/null @@ -1,41 +0,0 @@ -// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-main-gcov-flush.c -// CHECK-NEXT: -: 0:Graph:instrprof-shared-main-gcov-flush.gcno -// CHECK-NEXT: -: 0:Data:instrprof-shared-main-gcov-flush.gcda -// CHECK-NEXT: -: 0:Runs:1 -// CHECK-NEXT: -: 0:Programs:1 -// CHECK-NEXT: -: 1:extern void foo(int n); -// CHECK-NEXT: -: 2:extern void __gcov_flush(void); -// CHECK-NEXT: -: 3: -// CHECK-NEXT: -: 4:int bar1 = 0; -// CHECK-NEXT: -: 5:int bar2 = 1; -// CHECK-NEXT: -: 6: -// CHECK-NEXT: -: 7:void bar(int n) { -// CHECK-NEXT: 1: 8: if (n % 5 == 0) -// CHECK-NEXT: 1: 9: bar1++; -// CHECK-NEXT: -: 10: else -// CHECK-NEXT: #####: 11: bar2++; -// CHECK-NEXT: 1: 12:} -// CHECK-NEXT: -: 13: -// CHECK-NEXT: -: 14:int main(int argc, char *argv[]) { -// CHECK-NEXT: -: 15:#ifdef SHARED_CALL_BEFORE_GCOV_FLUSH -// CHECK-NEXT: 1: 16: foo(1); -// CHECK-NEXT: -: 17:#endif -// CHECK-NEXT: -: 18: -// CHECK-NEXT: 1: 19: bar(5); -// CHECK-NEXT: -: 20: -// CHECK-NEXT: 1: 21: __gcov_flush(); -// CHECK-NEXT: -: 22: -// CHECK-NEXT: 1: 23: bar(5); -// CHECK-NEXT: -: 24: -// CHECK-NEXT: -: 25:#ifdef SHARED_CALL_AFTER_GCOV_FLUSH -// CHECK-NEXT: 1: 26: foo(1); -// CHECK-NEXT: -: 27:#endif -// CHECK-NEXT: -: 28: -// CHECK-NEXT: -: 29:#ifdef EXIT_ABRUPTLY -// CHECK-NEXT: 1: 30: _exit(0); -// CHECK-NEXT: -: 31:#endif -// CHECK-NEXT: -: 32: -// CHECK-NEXT: -: 33: bar(5); -// CHECK-NEXT: -: 34: -// CHECK-NEXT: -: 35: return 0; -// CHECK-NEXT: #####: 36:} diff --git a/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov b/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov deleted file mode 100644 index f70e34e52..000000000 --- a/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov +++ /dev/null @@ -1,41 +0,0 @@ -// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-main-gcov-flush.c -// CHECK-NEXT: -: 0:Graph:instrprof-shared-main-gcov-flush.gcno -// CHECK-NEXT: -: 0:Data:instrprof-shared-main-gcov-flush.gcda -// CHECK-NEXT: -: 0:Runs:1 -// CHECK-NEXT: -: 0:Programs:1 -// CHECK-NEXT: -: 1:extern void foo(int n); -// CHECK-NEXT: -: 2:extern void __gcov_flush(void); -// CHECK-NEXT: -: 3: -// CHECK-NEXT: -: 4:int bar1 = 0; -// CHECK-NEXT: -: 5:int bar2 = 1; -// CHECK-NEXT: -: 6: -// CHECK-NEXT: -: 7:void bar(int n) { -// CHECK-NEXT: 3: 8: if (n % 5 == 0) -// CHECK-NEXT: 3: 9: bar1++; -// CHECK-NEXT: -: 10: else -// CHECK-NEXT: #####: 11: bar2++; -// CHECK-NEXT: 3: 12:} -// CHECK-NEXT: -: 13: -// CHECK-NEXT: -: 14:int main(int argc, char *argv[]) { -// CHECK-NEXT: -: 15:#ifdef SHARED_CALL_BEFORE_GCOV_FLUSH -// CHECK-NEXT: -: 16: foo(1); -// CHECK-NEXT: -: 17:#endif -// CHECK-NEXT: -: 18: -// CHECK-NEXT: 1: 19: bar(5); -// CHECK-NEXT: -: 20: -// CHECK-NEXT: 1: 21: __gcov_flush(); -// CHECK-NEXT: -: 22: -// CHECK-NEXT: 1: 23: bar(5); -// CHECK-NEXT: -: 24: -// CHECK-NEXT: -: 25:#ifdef SHARED_CALL_AFTER_GCOV_FLUSH -// CHECK-NEXT: 1: 26: foo(1); -// CHECK-NEXT: -: 27:#endif -// CHECK-NEXT: -: 28: -// CHECK-NEXT: -: 29:#ifdef EXIT_ABRUPTLY -// CHECK-NEXT: -: 30: _exit(0); -// CHECK-NEXT: -: 31:#endif -// CHECK-NEXT: -: 32: -// CHECK-NEXT: 1: 33: bar(5); -// CHECK-NEXT: -: 34: -// CHECK-NEXT: 1: 35: return 0; -// CHECK-NEXT: -: 36:} diff --git a/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov b/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov deleted file mode 100644 index b9ecff698..000000000 --- a/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov +++ /dev/null @@ -1,41 +0,0 @@ -// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-main-gcov-flush.c -// CHECK-NEXT: -: 0:Graph:instrprof-shared-main-gcov-flush.gcno -// CHECK-NEXT: -: 0:Data:instrprof-shared-main-gcov-flush.gcda -// CHECK-NEXT: -: 0:Runs:1 -// CHECK-NEXT: -: 0:Programs:1 -// CHECK-NEXT: -: 1:extern void foo(int n); -// CHECK-NEXT: -: 2:extern void __gcov_flush(void); -// CHECK-NEXT: -: 3: -// CHECK-NEXT: -: 4:int bar1 = 0; -// CHECK-NEXT: -: 5:int bar2 = 1; -// CHECK-NEXT: -: 6: -// CHECK-NEXT: -: 7:void bar(int n) { -// CHECK-NEXT: 3: 8: if (n % 5 == 0) -// CHECK-NEXT: 3: 9: bar1++; -// CHECK-NEXT: -: 10: else -// CHECK-NEXT: #####: 11: bar2++; -// CHECK-NEXT: 3: 12:} -// CHECK-NEXT: -: 13: -// CHECK-NEXT: -: 14:int main(int argc, char *argv[]) { -// CHECK-NEXT: -: 15:#ifdef SHARED_CALL_BEFORE_GCOV_FLUSH -// CHECK-NEXT: 1: 16: foo(1); -// CHECK-NEXT: -: 17:#endif -// CHECK-NEXT: -: 18: -// CHECK-NEXT: 1: 19: bar(5); -// CHECK-NEXT: -: 20: -// CHECK-NEXT: 1: 21: __gcov_flush(); -// CHECK-NEXT: -: 22: -// CHECK-NEXT: 1: 23: bar(5); -// CHECK-NEXT: -: 24: -// CHECK-NEXT: -: 25:#ifdef SHARED_CALL_AFTER_GCOV_FLUSH -// CHECK-NEXT: 1: 26: foo(1); -// CHECK-NEXT: -: 27:#endif -// CHECK-NEXT: -: 28: -// CHECK-NEXT: -: 29:#ifdef EXIT_ABRUPTLY -// CHECK-NEXT: -: 30: _exit(0); -// CHECK-NEXT: -: 31:#endif -// CHECK-NEXT: -: 32: -// CHECK-NEXT: 1: 33: bar(5); -// CHECK-NEXT: -: 34: -// CHECK-NEXT: 1: 35: return 0; -// CHECK-NEXT: -: 36:} diff --git a/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov b/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov deleted file mode 100644 index 7c9e0afa1..000000000 --- a/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov +++ /dev/null @@ -1,41 +0,0 @@ -// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-main-gcov-flush.c -// CHECK-NEXT: -: 0:Graph:instrprof-shared-main-gcov-flush.gcno -// CHECK-NEXT: -: 0:Data:instrprof-shared-main-gcov-flush.gcda -// CHECK-NEXT: -: 0:Runs:1 -// CHECK-NEXT: -: 0:Programs:1 -// CHECK-NEXT: -: 1:extern void foo(int n); -// CHECK-NEXT: -: 2:extern void __gcov_flush(void); -// CHECK-NEXT: -: 3: -// CHECK-NEXT: -: 4:int bar1 = 0; -// CHECK-NEXT: -: 5:int bar2 = 1; -// CHECK-NEXT: -: 6: -// CHECK-NEXT: -: 7:void bar(int n) { -// CHECK-NEXT: 3: 8: if (n % 5 == 0) -// CHECK-NEXT: 3: 9: bar1++; -// CHECK-NEXT: -: 10: else -// CHECK-NEXT: #####: 11: bar2++; -// CHECK-NEXT: 3: 12:} -// CHECK-NEXT: -: 13: -// CHECK-NEXT: -: 14:int main(int argc, char *argv[]) { -// CHECK-NEXT: -: 15:#ifdef SHARED_CALL_BEFORE_GCOV_FLUSH -// CHECK-NEXT: 1: 16: foo(1); -// CHECK-NEXT: -: 17:#endif -// CHECK-NEXT: -: 18: -// CHECK-NEXT: 1: 19: bar(5); -// CHECK-NEXT: -: 20: -// CHECK-NEXT: 1: 21: __gcov_flush(); -// CHECK-NEXT: -: 22: -// CHECK-NEXT: 1: 23: bar(5); -// CHECK-NEXT: -: 24: -// CHECK-NEXT: -: 25:#ifdef SHARED_CALL_AFTER_GCOV_FLUSH -// CHECK-NEXT: -: 26: foo(1); -// CHECK-NEXT: -: 27:#endif -// CHECK-NEXT: -: 28: -// CHECK-NEXT: -: 29:#ifdef EXIT_ABRUPTLY -// CHECK-NEXT: -: 30: _exit(0); -// CHECK-NEXT: -: 31:#endif -// CHECK-NEXT: -: 32: -// CHECK-NEXT: 1: 33: bar(5); -// CHECK-NEXT: -: 34: -// CHECK-NEXT: 1: 35: return 0; -// CHECK-NEXT: -: 36:} diff --git a/test/profile/Inputs/instrprof-shared-main.c.gcov b/test/profile/Inputs/instrprof-shared-main.c.gcov deleted file mode 100644 index 70be36750..000000000 --- a/test/profile/Inputs/instrprof-shared-main.c.gcov +++ /dev/null @@ -1,18 +0,0 @@ -// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-main.c -// CHECK-NEXT: -: 0:Graph:instrprof-shared-main.gcno -// CHECK-NEXT: -: 0:Data:instrprof-shared-main.gcda -// CHECK-NEXT: -: 0:Runs:1 -// CHECK-NEXT: -: 0:Programs:1 -// CHECK-NEXT: -: 1:extern int g1, g2; -// CHECK-NEXT: -: 2:extern void foo(int n); -// CHECK-NEXT: -: 3: -// CHECK-NEXT: -: 4:int main() { -// CHECK-NEXT: -: 5: int i, j; -// CHECK-NEXT: 2002: 6: for (i = 0; i < 1000; i++) -// CHECK-NEXT: 2002000: 7: for (j = 0; j < 1000; j++) -// CHECK-NEXT: 1001000: 8: foo(i * j); -// CHECK-NEXT: -: 9: -// CHECK-NEXT: 1: 10: if (g2 - g1 == 280001) -// CHECK-NEXT: 1: 11: return 0; -// CHECK-NEXT: #####: 12: return 1; -// CHECK-NEXT: 1: 13:} diff --git a/test/profile/instrprof-dlopen-dlclose-gcov.test b/test/profile/instrprof-dlopen-dlclose-gcov.test index 0444fca26..a785fe32d 100644 --- a/test/profile/instrprof-dlopen-dlclose-gcov.test +++ b/test/profile/instrprof-dlopen-dlclose-gcov.test @@ -1,30 +1,6 @@ RUN: mkdir -p %t.d -RUN: cd %t.d - -RUN: %clang --coverage -o func.shared -fPIC -shared %S/Inputs/instrprof-dlopen-func.c -RUN: %clang --coverage -o func2.shared -fPIC -shared %S/Inputs/instrprof-dlopen-func2.c -RUN: %clang --coverage -o func3.shared -fPIC -shared %S/Inputs/instrprof-dlopen-func3.c +RUN: %clang --coverage -o %t.d/func.shared -fPIC -shared %S/Inputs/instrprof-dlopen-func.c +RUN: %clang --coverage -o %t.d/func2.shared -fPIC -shared %S/Inputs/instrprof-dlopen-func2.c RUN: %clang --coverage -o %t -fPIC -rpath %t.d %S/Inputs/instrprof-dlopen-dlclose-main.c -# Test with two dlopened libraries. -RUN: %run %t -RUN: llvm-cov gcov instrprof-dlopen-dlclose-main.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-dlopen-dlclose-main.c.gcov %S/Inputs/instrprof-dlopen-dlclose-main.c.gcov -RUN: llvm-cov gcov instrprof-dlopen-func.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-dlopen-func.c.gcov %S/Inputs/instrprof-dlopen-func.c.gcov -RUN: llvm-cov gcov instrprof-dlopen-func2.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-dlopen-func2.c.gcov %S/Inputs/instrprof-dlopen-func2.c.gcov -RUN: rm instrprof-dlopen-dlclose-main.gcda instrprof-dlopen-func.gcda instrprof-dlopen-func2.gcda - -# Test with three dlopened libraries. -RUN: %clang -DUSE_LIB3 --coverage -o %t -fPIC -rpath %t.d %S/Inputs/instrprof-dlopen-dlclose-main.c RUN: %run %t -RUN: llvm-cov gcov instrprof-dlopen-dlclose-main.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-dlopen-dlclose-main.c.gcov %S/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov -RUN: llvm-cov gcov instrprof-dlopen-func.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-dlopen-func.c.gcov %S/Inputs/instrprof-dlopen-func.c.gcov -RUN: llvm-cov gcov instrprof-dlopen-func2.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-dlopen-func2.c.gcov %S/Inputs/instrprof-dlopen-func2.c.gcov -RUN: llvm-cov gcov instrprof-dlopen-func3.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-dlopen-func2.c.gcov %S/Inputs/instrprof-dlopen-func3.c.gcov -RUN: rm instrprof-dlopen-dlclose-main.gcda instrprof-dlopen-func.gcda instrprof-dlopen-func2.gcda instrprof-dlopen-func3.gcda diff --git a/test/profile/instrprof-gcov-two-objects.test b/test/profile/instrprof-gcov-two-objects.test deleted file mode 100644 index a53d51dce..000000000 --- a/test/profile/instrprof-gcov-two-objects.test +++ /dev/null @@ -1,18 +0,0 @@ -RUN: mkdir -p %t.d -RUN: cd %t.d - -RUN: %clang --coverage -o instrprof-shared-lib.o -c %S/Inputs/instrprof-shared-lib.c -RUN: test -f instrprof-shared-lib.gcno - -RUN: %clang --coverage -o instrprof-shared-main.o -c %S/Inputs/instrprof-shared-main.c -RUN: test -f instrprof-shared-main.gcno - -RUN: %clang --coverage -o %t instrprof-shared-main.o instrprof-shared-lib.o -RUN: test -f %t - -RUN: %run %t -RUN: llvm-cov gcov instrprof-shared-main.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-main.c.gcov %S/Inputs/instrprof-shared-main.c.gcov -RUN: llvm-cov gcov instrprof-shared-lib.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/Inputs/instrprof-shared-lib_in-loop.c.gcov -RUN: rm instrprof-shared-main.gcda instrprof-shared-lib.gcda diff --git a/test/profile/instrprof-shared-gcov-flush.test b/test/profile/instrprof-shared-gcov-flush.test deleted file mode 100644 index 33bcc275f..000000000 --- a/test/profile/instrprof-shared-gcov-flush.test +++ /dev/null @@ -1,49 +0,0 @@ -RUN: mkdir -p %t.d -RUN: cd %t.d - -RUN: %clang --coverage -o libfunc.so -fPIC -shared %S/Inputs/instrprof-shared-lib.c -RUN: test -f instrprof-shared-lib.gcno - -# Test the case where we exit abruptly after calling __gcov_flush, which means we don't write out the counters at exit. -RUN: %clang -DEXIT_ABRUPTLY -DSHARED_CALL_BEFORE_GCOV_FLUSH -DSHARED_CALL_AFTER_GCOV_FLUSH --coverage -o %t -L%t.d -rpath %t.d -lfunc %S/Inputs/instrprof-shared-main-gcov-flush.c -RUN: test -f instrprof-shared-main-gcov-flush.gcno - -RUN: %run %t -RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-main-gcov-flush.c.gcov %S/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov -RUN: llvm-cov gcov instrprof-shared-lib.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/Inputs/instrprof-shared-lib.c.gcov -RUN: rm instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda - -# Test the case where we exit normally and we have a call to the shared library function before __gcov_flush. -RUN: %clang -DSHARED_CALL_BEFORE_GCOV_FLUSH --coverage -o %t -L%t.d -rpath %t.d -lfunc %S/Inputs/instrprof-shared-main-gcov-flush.c -RUN: test -f instrprof-shared-main-gcov-flush.gcno - -RUN: %run %t -RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-main-gcov-flush.c.gcov %S/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov -RUN: llvm-cov gcov instrprof-shared-lib.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/Inputs/instrprof-shared-lib.c.gcov -RUN: rm instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda - -# Test the case where we exit normally and we have a call to the shared library function after __gcov_flush. -RUN: %clang -DSHARED_CALL_AFTER_GCOV_FLUSH --coverage -o %t -L%t.d -rpath %t.d -lfunc %S/Inputs/instrprof-shared-main-gcov-flush.c -RUN: test -f instrprof-shared-main-gcov-flush.gcno - -RUN: %run %t -RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-main-gcov-flush.c.gcov %S/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov -RUN: llvm-cov gcov instrprof-shared-lib.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/Inputs/instrprof-shared-lib.c.gcov -RUN: rm instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda - -# Test the case where we exit normally and we have calls to the shared library function before and after __gcov_flush. -RUN: %clang -DSHARED_CALL_BEFORE_GCOV_FLUSH -DSHARED_CALL_AFTER_GCOV_FLUSH --coverage -o %t -L%t.d -rpath %t.d -lfunc %S/Inputs/instrprof-shared-main-gcov-flush.c -RUN: test -f instrprof-shared-main-gcov-flush.gcno - -RUN: %run %t -RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-main-gcov-flush.c.gcov %S/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov -RUN: llvm-cov gcov instrprof-shared-lib.gcda -RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/Inputs/instrprof-shared-lib_called-twice.c.gcov -RUN: rm instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda |