brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 4dbd5e2 Raw
46 lines · c
1// REQUIRES: linux2// RUN: split-file %s %t3// RUN: %clang_profgen -Wl,--build-id=0x12345678 -fcoverage-mapping -O2 -shared %t/foo.c -o %t/libfoo.so4// RUN: %clang_profgen -Wl,--build-id=0xabcd1234 -fcoverage-mapping -O2 %t/main.c -L%t -lfoo -o %t.main5// RUN: rm -rf %t.profdir6// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw LD_LIBRARY_PATH=%t %run %t.main7// RUN: mkdir -p %t/.build-id/12 %t/.build-id/ab8// RUN: cp %t/libfoo.so %t/.build-id/12/345678.debug9// RUN: cp %t.main %t/.build-id/ab/cd1234.debug10// RUN: llvm-profdata merge -o %t.profdata %t.profdir/default_*.profraw11 12// RUN: llvm-cov show -instr-profile %t.profdata -debug-file-directory %t | FileCheck %s13// RUN: llvm-cov show -instr-profile %t.profdata %t/libfoo.so -sources %t/foo.c -object %t.main | FileCheck %s --check-prefix=FOO-ONLY14// RUN: llvm-cov show -instr-profile %t.profdata -debug-file-directory %t -sources %t/foo.c | FileCheck %s --check-prefix=FOO-ONLY15// RUN: llvm-cov show -instr-profile %t.profdata -debug-file-directory %t %t/libfoo.so -sources %t/foo.c | FileCheck %s --check-prefix=FOO-ONLY16 17// RUN: rm %t/.build-id/ab/cd1234.debug18// RUN: llvm-cov show -instr-profile %t.profdata -debug-file-directory %t %t.main | FileCheck %s19// RUN: llvm-cov show -instr-profile %t.profdata -debug-file-directory %t | FileCheck %s --check-prefix=FOO-ONLY20// RUN: not llvm-cov show -instr-profile %t.profdata -debug-file-directory %t --check-binary-ids 2>&1 | FileCheck %s --check-prefix=MISSING-BINARY-ID -DFILENAME=%t.profdata21 22// RUN: echo "bad" > %t/.build-id/ab/cd1234.debug23// RUN: llvm-cov show -instr-profile %t.profdata -debug-file-directory %t %t.main | FileCheck %s24 25// RUN: not llvm-cov show -instr-profile %t.profdata -debug-file-directory %t/empty 2>&1 | FileCheck %s --check-prefix=NODATA26 27// CHECK: 1| 1|void foo(void) {}28// CHECK: 2| 1|void bar(void) {}29// CHECK: 3| 1|int main() {30 31// FOO-ONLY: 1| 1|void foo(void) {}32// MISSING-BINARY-ID: error: failed to load coverage: '[[FILENAME]]': Missing binary ID: abcd123433// NODATA: error: failed to load coverage: '': no coverage data found34 35//--- foo.c36void foo(void) {}37 38//--- main.c39void foo(void);40void bar(void) {}41int main() {42  foo();43  bar();44  return 0;45}46