1 | // REQUIRES: darwin |
2 | |
3 | // RUN: %clang_pgogen -o %t.exe %s |
4 | // RUN: env LLVM_PROFILE_FILE="%c%t.profraw" %run %t.exe %t.profraw |
5 | // RUN: env LLVM_PROFILE_FILE="%t%c.profraw" %run %t.exe %t.profraw |
6 | // RUN: env LLVM_PROFILE_FILE="%t.profraw%c" %run %t.exe %t.profraw |
7 | |
8 | #include <string.h> |
9 | #include <stdio.h> |
10 | |
11 | extern int __llvm_profile_is_continuous_mode_enabled(void); |
12 | extern const char *__llvm_profile_get_filename(); |
13 | extern void __llvm_profile_set_dumped(void); |
14 | |
15 | int main(int argc, char **argv) { |
16 | if (!__llvm_profile_is_continuous_mode_enabled()) |
17 | return 1; |
18 | |
19 | // Check that the filename is "%t.profraw", followed by a null terminator. |
20 | size_t n = strlen(s: argv[1]) + 1; |
21 | const char *Filename = __llvm_profile_get_filename(); |
22 | |
23 | for (int i = 0; i < n; ++i) { |
24 | if (Filename[i] != argv[1][i]) { |
25 | printf(format: "Difference at: %d, Got: %c, Expected: %c\n" , i, Filename[i], argv[1][i]); |
26 | printf(format: "Got: %s\n" , Filename); |
27 | printf(format: "Expected: %s\n" , argv[1]); |
28 | return 1; |
29 | } |
30 | } |
31 | return 0; |
32 | } |
33 | |