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_profgen -fprofile-continuous -fcoverage-mapping -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>
15int f() { return 0; }
16
17int main(int argc, char **argv) {
18 FILE *File = fopen(filename: "default.profraw", modes: "w");
19 f();
20 return 0;
21}
22

Provided by KDAB

Privacy Policy
Improve your Profiling and Debugging skills
Find out more

source code of compiler-rt/test/profile/ContinuousSyncMode/reset-default-profile.c