xref: /llvm-project/compiler-rt/test/profile/Posix/instrprof-get-filename-merge-mode.c (revision af8205d0eb47b416b6865488056797f4162321e4)
1 // Test __llvm_profile_get_filename when the on-line merging mode is enabled.
2 //
3 // RUN: echo get_filename_from_DSO > shr.exp
4 // RUN: %clang_pgogen -fPIC -shared %shared_linker_xopts -o %t.dso %p/../Inputs/instrprof-get-filename-dso.c
5 // RUN: %clang_pgogen -o %t %s %t.dso
6 // RUN: env LLVM_PROFILE_FILE="%t-%m.profraw" %run %t
7 
8 #include <string.h>
9 
10 const char *__llvm_profile_get_filename(void);
11 extern const char *get_filename_from_DSO(void);
12 
main(int argc,const char * argv[])13 int main(int argc, const char *argv[]) {
14   const char *filename1 = __llvm_profile_get_filename();
15   const char *filename2 = get_filename_from_DSO();
16 
17   // Exit with code 1 if the two filenames are the same.
18   return strcmp(filename1, filename2) == 0;
19 }
20