xref: /llvm-project/compiler-rt/test/profile/ContinuousSyncMode/reset-default-profile.c (revision 4f2651c36361468cf35cdcdf841d3abed9d0d1cc)
1 // REQUIRES: target={{.*(darwin|linux|aix).*}}
2 
3 // Test when LLVM_PROFILE_FILE is set incorrectly, it should fall backs to use default.profraw without runtime error.
4 
5 // Create & cd into a temporary directory.
6 // RUN: rm -rf %t.dir && mkdir -p %t.dir && cd %t.dir
7 // RUN: %clang -fprofile-instr-generate -fcoverage-mapping -mllvm -runtime-counter-relocation=true -o %t.exe %s
8 // RUN: env LLVM_PROFILE_FILE="incorrect-profile-name%m%c%c.profraw" %run %t.exe
9 // RUN: ls -l | FileCheck %s
10 
11 // CHECK:     default.profraw
12 // CHECK-NOT: incorrect-profile-name.profraw
13 
14 #include <stdio.h>
15 int f() { return 0; }
16 
17 int main(int argc, char **argv) {
18   FILE *File = fopen("default.profraw", "w");
19   f();
20   return 0;
21 }
22