1 // RUN: %clang_pgogen -O2 -o %t.0 %s
2 // RUN: %clang_pgogen=%/t.d1 -O2 -o %t.1 %s
3 // RUN: %clang_pgogen=%/t.d1/%:t.d2 -O2 -o %t.2 %s
6 // RUN: env LLVM_PROFILE_FILE=%/t.d1/default.profraw %run %t.0 %/t.d1
7 // RUN: env LLVM_PROFILE_FILE=%/t.d1/%:t.d2/default.profraw %run %t.0 %/t.d1/%:t.d2
8 // RUN: %run %t.1 %/t.d1
9 // RUN: %run %t.2 %/t.d1/%:t.d2
10 // RUN: %run %t.2 %/t.d1/%:t.d2 %/t.d1/%:t.d2/%:t.d3/blah.profraw %/t.d1/%:t.d2/%:t.d3/
14 const char *__llvm_profile_get_path_prefix();
15 void __llvm_profile_set_filename(const char*);
17 int main(int argc
, const char *argv
[]) {
24 prefix
= __llvm_profile_get_path_prefix();
26 // The last character should be a trailing slash. Ignore it in the comparison
27 // since it could be '/' or '\\'.
28 int slashpos
= strlen(prefix
);
31 if (prefix
[slashpos
] != '/' && prefix
[slashpos
] != '\\')
35 if (strncmp(prefix
, expected
, slashpos
))
39 __llvm_profile_set_filename(argv
[2]);
40 prefix
= __llvm_profile_get_path_prefix();
42 if (strcmp(prefix
, expected
))