• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1The coverage reader should be able to handle archives, and archives embedded within
2MachO universal binaries.
3
4---
5Steps to re-generate these files on macOS:
6
7clang -fprofile-instr-generate -fcoverage-mapping -c obj1.c -o obj1_32.o -arch i386
8clang -fprofile-instr-generate -fcoverage-mapping -c obj2.c -o obj2_32.o -arch i386
9clang -fprofile-instr-generate -fcoverage-mapping -c obj1.c -o obj1_64.o -arch x86_64
10clang -fprofile-instr-generate -fcoverage-mapping -c obj2.c -o obj2_64.o -arch x86_64
11ar -q archive_32 obj1_32.o obj2_32.o
12ar -q archive_64 obj1_64.o obj2_64.o
13lipo -output universal_bin_wrapping_archives -create archive_32 archive_64
14---
15REQUIRES: zlib
16
17RUN: llvm-profdata merge %S/Inputs/universal_bin_wrapping_archives/universal_bin_wrapping_archives.proftext -o %t.profdata
18
19RUN: llvm-cov show %S/Inputs/universal_bin_wrapping_archives/universal_bin_wrapping_archives \
20RUN:   -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs/universal_bin_wrapping_archives -arch i386 \
21RUN:   | FileCheck %s --check-prefix=SHOW_ARCHIVE
22
23RUN: llvm-cov show %S/Inputs/universal_bin_wrapping_archives/universal_bin_wrapping_archives \
24RUN:   -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs/universal_bin_wrapping_archives -arch x86_64 \
25RUN:   | FileCheck %s --check-prefix=SHOW_ARCHIVE
26
27SHOW_ARCHIVE: {{.*}}obj1.c:
28SHOW_ARCHIVE-NEXT: 1|    100|void f1() {}
29SHOW_ARCHIVE: {{.*}}obj2.c:
30SHOW_ARCHIVE-NEXT: 1|    100|void f2() {}
31
32RUN: llvm-cov report %S/Inputs/universal_bin_wrapping_archives/universal_bin_wrapping_archives \
33RUN:   -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs/universal_bin_wrapping_archives %s -arch i386 \
34RUN:   | FileCheck %s --check-prefix=REPORT_ARCHIVE
35
36RUN: llvm-cov report %S/Inputs/universal_bin_wrapping_archives/universal_bin_wrapping_archives \
37RUN:   -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs/universal_bin_wrapping_archives %s -arch x86_64 \
38RUN:   | FileCheck %s --check-prefix=REPORT_ARCHIVE
39
40RUN: llvm-ar rcT %t.thin32.a %S/Inputs/universal_bin_wrapping_archives/obj1_32.o %S/Inputs/universal_bin_wrapping_archives/obj2_32.o
41RUN: llvm-cov report %t.thin32.a -instr-profile %t.profdata | FileCheck %s --check-prefix=REPORT_ARCHIVE
42
43REPORT_ARCHIVE: obj1.c 1 0 100.00% 1 0 100.00% 1 0 100.00%
44REPORT_ARCHIVE: obj2.c 1 0 100.00% 1 0 100.00% 1 0 100.00%
45REPORT_ARCHIVE: TOTAL 2 0 100.00% 2 0 100.00% 2 0 100.00%
46