summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-02-04 06:41:33 +0000
committerJustin Bogner <mail@justinbogner.com>2014-02-04 06:41:33 +0000
commitf7d0d0798ea06dfc2629cd458a273197b6bb73e1 (patch)
tree3f94372a224b2b24de5121df5870af8f036bcd15
parent1a3b25343f41bbd64e8c61a13e06a7dd6c66d334 (diff)
downloadllvm-f7d0d0798ea06dfc2629cd458a273197b6bb73e1.tar.gz
llvm-f7d0d0798ea06dfc2629cd458a273197b6bb73e1.tar.bz2
llvm-f7d0d0798ea06dfc2629cd458a273197b6bb73e1.tar.xz
llvm-cov: Document the llvm-cov tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200739 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/tools/llvm-cov/llvm-cov.test40
1 files changed, 31 insertions, 9 deletions
diff --git a/test/tools/llvm-cov/llvm-cov.test b/test/tools/llvm-cov/llvm-cov.test
index 411ac1f873..cb0c99b747 100644
--- a/test/tools/llvm-cov/llvm-cov.test
+++ b/test/tools/llvm-cov/llvm-cov.test
@@ -1,38 +1,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* .
-RUN: llvm-cov test.c | diff test_no_options.output -
-RUN: llvm-cov test.c -f | diff test_-f.output -
+# 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
-RUN: llvm-cov test.c -a
+# 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
-RUN: llvm-cov test.c -a -b | diff test_-b.output -
-# This is expected to fail because gcov doesn't actually output real branch or
-# call statistics on a per function basis.
-RUN: llvm-cov test.c -a -b -f | not diff test_-b_-f.output -
+# 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
-RUN: llvm-cov test.c -a -b -u
+# 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
-RUN: llvm-cov test.c -a -b -c -u
+# 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