1// REQUIRES: linux, curl
2// RUN: rm -rf %t
3// RUN: split-file %s %t
4// RUN: %clang_profgen -Wl,--build-id=0x12345678 -fcoverage-mapping -O2 -shared %t/foo.c -o %t/libfoo.so
5// RUN: %clang_profgen -Wl,--build-id=0xabcd1234 -fcoverage-mapping -O2 %t/main.c -L%t -lfoo -o %t/main
6// RUN: env LLVM_PROFILE_FILE=%t/profdir/default_%m.profraw LD_LIBRARY_PATH=%t %run %t/main
7// RUN: mkdir -p %t/buildid/12345678 %t/buildid/abcd1234
8// RUN: mkdir -p %t/buildid/12345678 %t/buildid/abcd1234
9// RUN: cp %t/libfoo.so %t/buildid/12345678/debuginfo
10// RUN: cp %t/main %t/buildid/abcd1234/debuginfo
11// RUN: llvm-profdata merge -o %t/profdata %t/profdir/default_*.profraw
12// RUN: mkdir -p %t/debuginfod-cache
13// RUN: env DEBUGINFOD_CACHE_PATH=%t/debuginfod-cache DEBUGINFOD_URLS=file://%t llvm-cov show -instr-profile %t/profdata | FileCheck %s
14// RUN: echo "bad" > %t/libfoo.so %t/buildid/12345678/debuginfo
15// RUN: echo "bad" > %t/buildid/abcd1234/debuginfo
16// RUN: rm -rf %t/debuginfod-cache/*
17// RUN: env DEBUGINFOD_CACHE_PTH=%t/debuginfod-cache DEBUGINFOD_URLS=file://%t llvm-cov show -instr-profile %t/profdata -debuginfod=false %t/main | FileCheck %s --check-prefix=NODEBUGINFOD
18
19// CHECK: 1| 1|void foo(void) {}
20// CHECK: 2| 1|void bar(void) {}
21// CHECK: 3| 1|int main() {
22
23// NODEBUGINFOD-NOT: foo(void) {}
24// NODEBUGINFOD: main
25
26//--- foo.c
27void foo(void) {}
28
29//--- main.c
30void foo(void);
31void bar(void) {}
32int main() {
33 foo();
34 bar();
35 return 0;
36}
37

source code of compiler-rt/test/profile/Linux/binary-id-debuginfod.c