summaryrefslogtreecommitdiff
path: root/test/tools/llvm-cov/llvm-cov.test
blob: cb0c99b7470b9e3de8b82bf93a6ac5d24dc55ba1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Tests for compatibility between llvm-cov and gcov. These work by
# comparing llvm-cov against reference outputs generated by gcov 4.2.

# "cd" and globbing are unsupported in lit internal runner.
REQUIRES: shell

RUN: rm -rf %t
RUN: mkdir %t
RUN: cd %t
RUN: cp %p/Inputs/test* .

# Basic behaviour with no flags
RUN: llvm-cov test.c | diff -u test_no_options.output -
RUN: diff -aub test_no_options.cpp.gcov test.cpp.gcov
RUN: diff -aub test_no_options.h.gcov test.h.gcov

# Function summaries. This changes stdout, but not the gcov files.
RUN: llvm-cov test.c -f | diff -u test_-f.output -
RUN: diff -aub test_no_options.cpp.gcov test.cpp.gcov
RUN: diff -aub test_no_options.h.gcov test.h.gcov

# All blocks. This doesn't affect stdout, only the gcov files.
RUN: llvm-cov test.c -a | diff -u test_no_options.output -
RUN: diff -aub test_-a.cpp.gcov test.cpp.gcov
RUN: diff -aub test_-a.h.gcov test.h.gcov

# Branch probabilities.
RUN: llvm-cov test.c -a -b | diff -u test_-b.output -
RUN: diff -aub test_-a_-b.cpp.gcov test.cpp.gcov
RUN: diff -aub test_-a_-b.h.gcov test.h.gcov

# Function summaries including branch probabilities.

# FIXME: We don't correctly handle calls when -b and -f are used
# together, so our output differs from gcov. Remove the 'not' from
# this test once this is fixed.
RUN: llvm-cov test.c -a -b -f | not diff -u test_-b_-f.output - >/dev/null
RUN: diff -aub test_-a_-b.cpp.gcov test.cpp.gcov
RUN: diff -aub test_-a_-b.h.gcov test.h.gcov

# Summarize unconditional branches too.
RUN: llvm-cov test.c -a -b -u | diff -u test_-b.output -
RUN: diff -aub test_-a_-b_-u.cpp.gcov test.cpp.gcov
RUN: diff -aub test_-a_-b_-u.h.gcov test.h.gcov

# Absolute counts for branches.
RUN: llvm-cov test.c -a -b -c -u | diff -u test_-b.output -
RUN: diff -aub test_-a_-b_-c_-u.cpp.gcov test.cpp.gcov
RUN: diff -aub test_-a_-b_-c_-u.h.gcov test.h.gcov

# Invalid gcno file.
RUN: not llvm-cov test.c -gcno=test_read_fail.gcno

# Bad file checksum on gcda.
RUN: not llvm-cov test.c -gcda=test_file_checksum_fail.gcda

# Bad function checksum on gcda
RUN: not llvm-cov test.c -gcda=test_func_checksum_fail.gcda

XFAIL: powerpc64, s390x, mips, sparc