[libc] Switch to using the generic `<gpuintrin.h>` implementations (#121810)
[llvm-project.git] / compiler-rt / test / profile / instrprof-set-file-object-merging.c
blobbaabb21cd672ce0a0e3739980d951e20fadf6849
1 // Test that the specified output merges the profiling data.
2 // Run the program twice so that the counters accumulate.
3 // RUN: %clang_profgen -fcoverage-mapping -o %t %s
4 // RUN: rm -f %t.merging.profraw %t.merging.profdata
5 // RUN: %run %t %t.merging.profraw
6 // RUN: %run %t %t.merging.profraw
7 // RUN: test -f %t.merging.profraw
8 // RUN: llvm-profdata merge -o %t.merging.profdata %t.merging.profraw
9 // RUN: llvm-cov show -instr-profile %t.merging.profdata %t | FileCheck %s --match-full-lines
10 #include <stdio.h>
12 extern void __llvm_profile_set_file_object(FILE *, int);
14 int main(int argc, const char *argv[]) {
15 if (argc < 2)
16 return 1;
18 FILE *F = fopen(argv[1], "r+b");
19 if (!F) {
20 // File might not exist, try opening with truncation
21 F = fopen(argv[1], "w+b");
23 __llvm_profile_set_file_object(F, 1);
25 return 0;
27 // XFAIL: target={{.*}}-aix{{.*}}
28 // CHECK: 10| |#include <stdio.h>
29 // CHECK: 11| |
30 // CHECK: 12| |extern void __llvm_profile_set_file_object(FILE *, int);
31 // CHECK: 13| |
32 // CHECK: 14| 2|int main(int argc, const char *argv[]) {
33 // CHECK: 15| 2| if (argc < 2)
34 // CHECK: 16| 0| return 1;
35 // CHECK: 17| |
36 // CHECK: 18| 2| FILE *F = fopen(argv[1], "r+b");
37 // CHECK: 19| 2| if (!F) {
38 // CHECK: 20| | // File might not exist, try opening with truncation
39 // CHECK: 21| 1| F = fopen(argv[1], "w+b");
40 // CHECK: 22| 1| }
41 // CHECK: 23| 2| __llvm_profile_set_file_object(F, 1);
42 // CHECK: 24| |
43 // CHECK: 25| 2| return 0;
44 // CHECK: 26| 2|}