1 // The undefined symbol should not cause link errors, and we should
2 // obtain the expected coverage report.
4 // Test the --coverage option.
5 RUN: rm -rf %t0 && split-file %s %t0 && cd %t0
6 RUN: %clang bar.c main.c undef.c --coverage -c
7 RUN: ar -X32_64 -rv libfoo.a undef.o bar.o
8 RUN: %clang main.o -L. -lfoo --coverage -o main.exe
10 RUN: llvm-cov gcov -t main.gcda | FileCheck --check-prefix=MAIN %s
11 RUN: llvm-cov gcov -t bar.gcda | FileCheck --check-prefix=BAR %s
13 // Test the pgogen -fprofile-arcs -ftest-coverage option combination.
14 RUN: rm -rf %t1 && split-file %s %t1 && cd %t1
15 RUN: %clang_pgogen bar.c main.c undef.c -fprofile-arcs -ftest-coverage -c
16 RUN: ar -X32_64 -rv libfoo.a undef.o bar.o
17 RUN: %clang_pgogen main.o -L. -lfoo -fprofile-generate -fprofile-arcs -ftest-coverage -o main.exe
19 RUN: llvm-cov gcov -t main.gcda | FileCheck --check-prefix=MAIN %s
20 RUN: llvm-cov gcov -t bar.gcda | FileCheck --check-prefix=BAR %s
22 // Test the pgogen -Wl,-bcdtors:mbr option combination.
23 RUN: rm -rf %t2 && split-file %s %t2 && cd %t2
24 RUN: %clang_pgogen bar.c main.c undef.c -fprofile-arcs -ftest-coverage -c
25 RUN: ar -X32_64 -rv libfoo.a undef.o bar.o
26 RUN: %clang_pgogen main.o -L. -lfoo -fprofile-generate -fprofile-arcs -ftest-coverage -Wl,-bcdtors:mbr -o main.exe
28 RUN: llvm-cov gcov -t main.gcda | FileCheck --check-prefix=MAIN %s
29 RUN: llvm-cov gcov -t bar.gcda | FileCheck --check-prefix=BAR %s
31 MAIN: 1: 2:int main() {
32 MAIN: 1: 3: return bar();