llvm-cov: Document the llvm-cov tests
[oota-llvm.git] / test / tools / llvm-cov / llvm-cov.test
1 # Tests for compatibility between llvm-cov and gcov. These work by
2 # comparing llvm-cov against reference outputs generated by gcov 4.2.
3
4 # "cd" and globbing are unsupported in lit internal runner.
5 REQUIRES: shell
6
7 RUN: rm -rf %t
8 RUN: mkdir %t
9 RUN: cd %t
10 RUN: cp %p/Inputs/test* .
11
12 # Basic behaviour with no flags
13 RUN: llvm-cov test.c | diff -u test_no_options.output -
14 RUN: diff -aub test_no_options.cpp.gcov test.cpp.gcov
15 RUN: diff -aub test_no_options.h.gcov test.h.gcov
16
17 # Function summaries. This changes stdout, but not the gcov files.
18 RUN: llvm-cov test.c -f | diff -u test_-f.output -
19 RUN: diff -aub test_no_options.cpp.gcov test.cpp.gcov
20 RUN: diff -aub test_no_options.h.gcov test.h.gcov
21
22 # All blocks. This doesn't affect stdout, only the gcov files.
23 RUN: llvm-cov test.c -a | diff -u test_no_options.output -
24 RUN: diff -aub test_-a.cpp.gcov test.cpp.gcov
25 RUN: diff -aub test_-a.h.gcov test.h.gcov
26
27 # Branch probabilities.
28 RUN: llvm-cov test.c -a -b | diff -u test_-b.output -
29 RUN: diff -aub test_-a_-b.cpp.gcov test.cpp.gcov
30 RUN: diff -aub test_-a_-b.h.gcov test.h.gcov
31
32 # Function summaries including branch probabilities.
33
34 # FIXME: We don't correctly handle calls when -b and -f are used
35 # together, so our output differs from gcov. Remove the 'not' from
36 # this test once this is fixed.
37 RUN: llvm-cov test.c -a -b -f | not diff -u test_-b_-f.output - >/dev/null
38 RUN: diff -aub test_-a_-b.cpp.gcov test.cpp.gcov
39 RUN: diff -aub test_-a_-b.h.gcov test.h.gcov
40
41 # Summarize unconditional branches too.
42 RUN: llvm-cov test.c -a -b -u | diff -u test_-b.output -
43 RUN: diff -aub test_-a_-b_-u.cpp.gcov test.cpp.gcov
44 RUN: diff -aub test_-a_-b_-u.h.gcov test.h.gcov
45
46 # Absolute counts for branches.
47 RUN: llvm-cov test.c -a -b -c -u | diff -u test_-b.output -
48 RUN: diff -aub test_-a_-b_-c_-u.cpp.gcov test.cpp.gcov
49 RUN: diff -aub test_-a_-b_-c_-u.h.gcov test.h.gcov
50
51 # Invalid gcno file.
52 RUN: not llvm-cov test.c -gcno=test_read_fail.gcno
53
54 # Bad file checksum on gcda.
55 RUN: not llvm-cov test.c -gcda=test_file_checksum_fail.gcda
56
57 # Bad function checksum on gcda
58 RUN: not llvm-cov test.c -gcda=test_func_checksum_fail.gcda
59
60 XFAIL: powerpc64, s390x, mips, sparc