summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.covmappingbin0 -> 192 bytes
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.h3
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.proftext16
-rw-r--r--llvm/test/tools/llvm-cov/zeroFunctionFile.c19
4 files changed, 38 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.covmapping b/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.covmapping
new file mode 100644
index 00000000000..b2c198a8fe0
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.covmapping
Binary files differ
diff --git a/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.h b/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.h
new file mode 100644
index 00000000000..1703e8e47d6
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.h
@@ -0,0 +1,3 @@
+// This header has no functions
+
+#define NOFUNCTIONS(x) (x) > 0 ? 0 : 1
diff --git a/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.proftext b/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.proftext
new file mode 100644
index 00000000000..55187c1a486
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.proftext
@@ -0,0 +1,16 @@
+foo
+# Func Hash:
+13
+# Num Counters:
+2
+# Counter Values:
+1
+1
+
+main
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+1
diff --git a/llvm/test/tools/llvm-cov/zeroFunctionFile.c b/llvm/test/tools/llvm-cov/zeroFunctionFile.c
new file mode 100644
index 00000000000..87b6ecd3abb
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/zeroFunctionFile.c
@@ -0,0 +1,19 @@
+#include "Inputs/zeroFunctionFile.h"
+
+int foo(int x) {
+ return NOFUNCTIONS(x);
+}
+int main() {
+ return foo(2);
+}
+
+// RUN: llvm-profdata merge %S/Inputs/zeroFunctionFile.proftext -o %t.profdata
+
+// RUN: llvm-cov report %S/Inputs/zeroFunctionFile.covmapping -instr-profile %t.profdata 2>&1 | FileCheck --check-prefix=REPORT --strict-whitespace %s
+// REPORT: 0 0 - 0 0 - 0 0 - 0 0 -
+// REPORT-NO: 0%
+
+// RUN: llvm-cov show %S/Inputs/zeroFunctionFile.covmapping -format html -instr-profile %t.profdata -o %t.dir
+// RUN: FileCheck %s -input-file=%t.dir/index.html -check-prefix=HTML
+// HTML: <td class='column-entry-green'><pre>- (0/0)
+// HTML-NO: 0.00% (0/0)
OpenPOWER on IntegriCloud