53 lines · plain
1// The undefined symbol should not cause link errors, and we should2// obtain the expected coverage report.3 4// Test the --coverage option.5RUN: rm -rf %t0 && split-file %s %t0 && cd %t06RUN: %clang bar.c main.c undef.c --coverage -c7RUN: ar -X32_64 -rv libfoo.a undef.o bar.o8RUN: %clang main.o -L. -lfoo --coverage -o main.exe9RUN: %run ./main.exe10RUN: llvm-cov gcov -t main.gcda | FileCheck --check-prefix=MAIN %s11RUN: llvm-cov gcov -t bar.gcda | FileCheck --check-prefix=BAR %s12 13// Test the pgogen -fprofile-arcs -ftest-coverage option combination.14RUN: rm -rf %t1 && split-file %s %t1 && cd %t115RUN: %clang_pgogen bar.c main.c undef.c -fprofile-arcs -ftest-coverage -c16RUN: ar -X32_64 -rv libfoo.a undef.o bar.o17RUN: %clang_pgogen main.o -L. -lfoo -fprofile-generate -fprofile-arcs -ftest-coverage -o main.exe18RUN: %run ./main.exe19RUN: llvm-cov gcov -t main.gcda | FileCheck --check-prefix=MAIN %s20RUN: llvm-cov gcov -t bar.gcda | FileCheck --check-prefix=BAR %s21 22// Test the pgogen -Wl,-bcdtors:mbr option combination.23RUN: rm -rf %t2 && split-file %s %t2 && cd %t224RUN: %clang_pgogen bar.c main.c undef.c -fprofile-arcs -ftest-coverage -c25RUN: ar -X32_64 -rv libfoo.a undef.o bar.o26RUN: %clang_pgogen main.o -L. -lfoo -fprofile-generate -fprofile-arcs -ftest-coverage -Wl,-bcdtors:mbr -o main.exe27RUN: %run ./main.exe28RUN: llvm-cov gcov -t main.gcda | FileCheck --check-prefix=MAIN %s29RUN: llvm-cov gcov -t bar.gcda | FileCheck --check-prefix=BAR %s30 31MAIN: 1: 2:int main() {32MAIN: 1: 3: return bar();33BAR: 1: 1:int bar() {34BAR: 1: 2: return 0;35 36//--- main.c37int bar();38int main() {39 return bar();40}41 42 43//--- bar.c44int bar() {45 return 0;46}47 48//--- undef.c49void undef_func();50void foo() {51 undef_func();52}53