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