| 1 | // REQUIRES: continuous-mode |
| 2 | |
| 3 | // RUN: %clang_pgogen -fprofile-continuous -o %t.exe %s |
| 4 | // RUN: env LLVM_PROFILE_FILE="%c%t.profraw" %run %t.exe %t.profraw %t.bad |
| 5 | |
| 6 | #include <string.h> |
| 7 | |
| 8 | extern int __llvm_profile_is_continuous_mode_enabled(void); |
| 9 | extern void __llvm_profile_set_filename(const char *); |
| 10 | extern const char *__llvm_profile_get_filename(); |
| 11 | |
| 12 | int main(int argc, char **argv) { |
| 13 | if (!__llvm_profile_is_continuous_mode_enabled()) |
| 14 | return 1; |
| 15 | |
| 16 | __llvm_profile_set_filename(argv[2]); // Try to set the filename to "%t.bad". |
| 17 | const char *Filename = __llvm_profile_get_filename(); |
| 18 | return strcmp(s1: Filename, s2: argv[1]); // Check that the filename is "%t.profraw". |
| 19 | } |
| 20 | |