[llvm] 904b971 - [gcov] Make `Creating 'filename'` compatible with gcov
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 3 21:48:21 PDT 2020
Author: Fangrui Song
Date: 2020-06-03T21:48:01-07:00
New Revision: 904b971aaca3af7b4cd7fb414da508690e37f6a7
URL: https://github.com/llvm/llvm-project/commit/904b971aaca3af7b4cd7fb414da508690e37f6a7
DIFF: https://github.com/llvm/llvm-project/commit/904b971aaca3af7b4cd7fb414da508690e37f6a7.diff
LOG: [gcov] Make `Creating 'filename'` compatible with gcov
And clean up llvm-cov.test a bit
Added:
Modified:
llvm/lib/ProfileData/GCOV.cpp
llvm/test/tools/llvm-cov/gcov-4.7.c
llvm/test/tools/llvm-cov/gcov-8.c
llvm/test/tools/llvm-cov/gcov-9.c
llvm/test/tools/llvm-cov/llvm-cov.test
Removed:
llvm/test/tools/llvm-cov/Inputs/test_-b.output
llvm/test/tools/llvm-cov/Inputs/test_-b_-f.output
llvm/test/tools/llvm-cov/Inputs/test_-f.output
llvm/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda
llvm/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcno
llvm/test/tools/llvm-cov/Inputs/test_hash.output
llvm/test/tools/llvm-cov/Inputs/test_no_gcda.output
llvm/test/tools/llvm-cov/Inputs/test_no_options.output
llvm/test/tools/llvm-cov/Inputs/test_no_output.output
llvm/test/tools/llvm-cov/Inputs/test_no_preserve_paths.output
llvm/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov
llvm/test/tools/llvm-cov/Inputs/test_paths.h.gcov
llvm/test/tools/llvm-cov/Inputs/test_preserve_paths.output
################################################################################
diff --git a/llvm/lib/ProfileData/GCOV.cpp b/llvm/lib/ProfileData/GCOV.cpp
index 280440532be0..0b50bebe674d 100644
--- a/llvm/lib/ProfileData/GCOV.cpp
+++ b/llvm/lib/ProfileData/GCOV.cpp
@@ -823,7 +823,7 @@ void FileInfo::printFileCoverage(raw_ostream &OS) const {
OS << "File '" << Coverage.Name << "'\n";
printCoverage(OS, Coverage);
if (!Options.NoOutput)
- OS << Coverage.Name << ":creating '" << Filename << "'\n";
+ OS << "Creating '" << Filename << "'\n";
OS << "\n";
}
}
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_-b.output b/llvm/test/tools/llvm-cov/Inputs/test_-b.output
deleted file mode 100644
index 5417f7e73585..000000000000
--- a/llvm/test/tools/llvm-cov/Inputs/test_-b.output
+++ /dev/null
@@ -1,13 +0,0 @@
-File './test.h'
-Lines executed:100.00% of 1
-No branches
-No calls
-./test.h:creating 'test.h.gcov'
-
-File 'test.cpp'
-Lines executed:81.40% of 43
-Branches executed:100.00% of 15
-Taken at least once:86.67% of 15
-No calls
-test.cpp:creating 'test.cpp.gcov'
-
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_-b_-f.output b/llvm/test/tools/llvm-cov/Inputs/test_-b_-f.output
deleted file mode 100644
index c3ccd05b1710..000000000000
--- a/llvm/test/tools/llvm-cov/Inputs/test_-b_-f.output
+++ /dev/null
@@ -1,65 +0,0 @@
-Function '_ZN1A1BEv'
-Lines executed:100.00% of 1
-No branches
-No calls
-
-Function '_Z7uselessv'
-Lines executed:0.00% of 1
-No branches
-No calls
-
-Function '_Z12more_uselessv'
-Lines executed:0.00% of 1
-No branches
-No calls
-
-Function '_Z3foov'
-Lines executed:100.00% of 2
-No branches
-No calls
-
-Function '_Z3barv'
-Lines executed:0.00% of 2
-No branches
-No calls
-
-Function '_Z6assignii'
-Lines executed:100.00% of 3
-No branches
-No calls
-
-Function '_Z15initialize_gridv'
-Lines executed:100.00% of 4
-Branches executed:100.00% of 4
-Taken at least once:100.00% of 4
-No calls
-
-Function 'main'
-Lines executed:91.67% of 24
-Branches executed:100.00% of 11
-Taken at least once:81.82% of 11
-No calls
-
-Function '_ZN1AC1Ev'
-Lines executed:100.00% of 1
-No branches
-No calls
-
-Function '_ZN1AC2Ev'
-No executable lines
-No branches
-No calls
-
-File 'test.cpp'
-Lines executed:84.21% of 38
-Branches executed:100.00% of 15
-Taken at least once:86.67% of 15
-No calls
-test.cpp:creating 'test.cpp.gcov'
-
-File './test.h'
-Lines executed:100.00% of 1
-No branches
-No calls
-./test.h:creating 'test.h.gcov'
-
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_-f.output b/llvm/test/tools/llvm-cov/Inputs/test_-f.output
deleted file mode 100644
index 39b56e434b0b..000000000000
--- a/llvm/test/tools/llvm-cov/Inputs/test_-f.output
+++ /dev/null
@@ -1,35 +0,0 @@
-Function '_ZN1AC2Ev'
-Lines executed:100.00% of 1
-
-Function '_ZN1A1BEv'
-Lines executed:100.00% of 1
-
-Function '_Z7uselessv'
-Lines executed:0.00% of 1
-
-Function '_Z12more_uselessv'
-Lines executed:0.00% of 2
-
-Function '_Z3foov'
-Lines executed:100.00% of 3
-
-Function '_Z3barv'
-Lines executed:0.00% of 3
-
-Function '_Z6assignii'
-Lines executed:100.00% of 3
-
-Function '_Z15initialize_gridv'
-Lines executed:100.00% of 5
-
-Function 'main'
-Lines executed:92.00% of 25
-
-File './test.h'
-Lines executed:100.00% of 1
-./test.h:creating 'test.h.gcov'
-
-File 'test.cpp'
-Lines executed:81.40% of 43
-test.cpp:creating 'test.cpp.gcov'
-
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda b/llvm/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda
deleted file mode 100644
index 3ca483d1f466..000000000000
Binary files a/llvm/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda and /dev/null
diff er
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcno b/llvm/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcno
deleted file mode 100644
index d453566282f9..000000000000
Binary files a/llvm/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcno and /dev/null
diff er
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_hash.output b/llvm/test/tools/llvm-cov/Inputs/test_hash.output
deleted file mode 100644
index 3f8b3f614d5a..000000000000
--- a/llvm/test/tools/llvm-cov/Inputs/test_hash.output
+++ /dev/null
@@ -1,8 +0,0 @@
-File 'srcdir/./nested_dir/../test.cpp'
-Lines executed:84.21% of 38
-srcdir/./nested_dir/../test.cpp:creating 'test.cpp##a806e5b3093cd6f683da88c0da150daf.gcov'
-
-File 'srcdir/./nested_dir/../test.h'
-Lines executed:100.00% of 1
-srcdir/./nested_dir/../test.h:creating 'test.h##0cbee7e2421fa4517420ac4f935620ca.gcov'
-
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_no_gcda.output b/llvm/test/tools/llvm-cov/Inputs/test_no_gcda.output
deleted file mode 100644
index 8e3b18606ada..000000000000
--- a/llvm/test/tools/llvm-cov/Inputs/test_no_gcda.output
+++ /dev/null
@@ -1,8 +0,0 @@
-File './test.h'
-Lines executed:0.00% of 1
-./test.h:creating 'test.h.gcov'
-
-File 'test.cpp'
-Lines executed:0.00% of 43
-test.cpp:creating 'test.cpp.gcov'
-
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_no_options.output b/llvm/test/tools/llvm-cov/Inputs/test_no_options.output
deleted file mode 100644
index ffc09f8a6c9d..000000000000
--- a/llvm/test/tools/llvm-cov/Inputs/test_no_options.output
+++ /dev/null
@@ -1,8 +0,0 @@
-File './test.h'
-Lines executed:100.00% of 1
-./test.h:creating 'test.h.gcov'
-
-File 'test.cpp'
-Lines executed:81.40% of 43
-test.cpp:creating 'test.cpp.gcov'
-
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_no_output.output b/llvm/test/tools/llvm-cov/Inputs/test_no_output.output
deleted file mode 100644
index 9d9d7ad7fc0b..000000000000
--- a/llvm/test/tools/llvm-cov/Inputs/test_no_output.output
+++ /dev/null
@@ -1,6 +0,0 @@
-File './test.h'
-Lines executed:100.00% of 1
-
-File 'test.cpp'
-Lines executed:81.40% of 43
-
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_no_preserve_paths.output b/llvm/test/tools/llvm-cov/Inputs/test_no_preserve_paths.output
deleted file mode 100644
index a3e32dd7daae..000000000000
--- a/llvm/test/tools/llvm-cov/Inputs/test_no_preserve_paths.output
+++ /dev/null
@@ -1,8 +0,0 @@
-File 'srcdir/./nested_dir/../test.cpp'
-Lines executed:84.21% of 38
-srcdir/./nested_dir/../test.cpp:creating 'test.cpp.gcov'
-
-File 'srcdir/./nested_dir/../test.h'
-Lines executed:100.00% of 1
-srcdir/./nested_dir/../test.h:creating 'test.h.gcov'
-
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov b/llvm/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov
deleted file mode 100644
index ffa1591d061d..000000000000
--- a/llvm/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov
+++ /dev/null
@@ -1,79 +0,0 @@
- -: 0:Source:srcdir/./nested_dir/../test.cpp
- -: 0:Graph:test_paths.gcno
- -: 0:Data:test_paths.gcda
- -: 0:Runs:0
- -: 0:Programs:1
- -: 1:#include "test.h"
- -: 2:#include <cstdlib>
- -: 3:
- -: 4:bool on = false;
- -: 5:int len = 42;
- -: 6:double grid[10][10] = {0};
- -: 7:const char * hello = "world";
- -: 8:const char * world = "hello";
- -: 9:
-12884901888: 10:void A::B() {}
- -: 11:
- #####: 12:void useless() {}
- -: 13:
- -: 14:double more_useless() {
- #####: 15: return 0;
- -: 16:}
- -: 17:
- -: 18:int foo() {
- 3: 19: on = true;
- 3: 20: return 3;
- -: 21:}
- -: 22:
- -: 23:int bar() {
- #####: 24: len--;
- #####: 25: return foo() + 45;
- -: 26:}
- -: 27:
- 12: 28:void assign(int ii, int jj) {
- 12: 29: grid[ii][jj] = (ii+1) * (jj+1);
- 12: 30:}
- -: 31:
- -: 32:void initialize_grid() {
- 9: 33: for (int ii = 0; ii < 2; ii++)
- 18: 34: for (int jj = 0; jj < 2; jj++)
- 18: 35: assign(ii, jj);
- 3: 36:}
- -: 37:
- -: 38:int main() {
- 3: 39: initialize_grid();
- -: 40:
- 3: 41: int a = 2;
- 3: 42: on = rand() % 2;
- 3: 43: if (on) {
- 3: 44: foo();
- 3: 45: ++a;
- 3: 46: } else {
- #####: 47: bar();
- #####: 48: a += rand();
- -: 49: }
- -: 50:
- 33: 51: for (int ii = 0; ii < 10; ++ii) {
- 30: 52: switch (rand() % 5) {
- -: 53: case 0:
- 6: 54: a += rand();
- 6: 55: break;
- -: 56: case 1:
- -: 57: case 2:
- 3: 58: a += rand() / rand();
- 3: 59: break;
- -: 60: case 3:
- 9: 61: a -= rand();
- 9: 62: break;
- -: 63: default:
- 12: 64: a = -1;
- 12: 65: }
- 30: 66: }
- -: 67:
- 3: 68: A thing;
-12884901891: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
-12884901888: 70: thing.B();
- -: 71:
- 3: 72: return a + 8 + grid[2][3] + len;
- -: 73: return more_useless();
- -: 74:}
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_paths.h.gcov b/llvm/test/tools/llvm-cov/Inputs/test_paths.h.gcov
deleted file mode 100644
index f8be8405c4f1..000000000000
--- a/llvm/test/tools/llvm-cov/Inputs/test_paths.h.gcov
+++ /dev/null
@@ -1,8 +0,0 @@
- -: 0:Source:srcdir/./nested_dir/../test.h
- -: 0:Graph:test_paths.gcno
- -: 0:Data:test_paths.gcda
- -: 0:Runs:0
- -: 0:Programs:1
- 6: 1:struct A {
- -: 2: virtual void B();
- -: 3:};
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_preserve_paths.output b/llvm/test/tools/llvm-cov/Inputs/test_preserve_paths.output
deleted file mode 100644
index 86e81592f397..000000000000
--- a/llvm/test/tools/llvm-cov/Inputs/test_preserve_paths.output
+++ /dev/null
@@ -1,8 +0,0 @@
-File 'src/./n/../a.c'
-Lines executed:100.00% of 1
-srcdir/./nested_dir/../test.cpp:creating 'srcdir#nested_dir#^#test.cpp.gcov'
-
-File 'srcdir/./nested_dir/../test.h'
-Lines executed:100.00% of 1
-srcdir/./nested_dir/../test.h:creating 'srcdir#nested_dir#^#test.h.gcov'
-
diff --git a/llvm/test/tools/llvm-cov/gcov-4.7.c b/llvm/test/tools/llvm-cov/gcov-4.7.c
index 594382bf2900..d92953a6b0b6 100644
--- a/llvm/test/tools/llvm-cov/gcov-4.7.c
+++ b/llvm/test/tools/llvm-cov/gcov-4.7.c
@@ -22,7 +22,7 @@ int main() { // GCOV: #####: [[@LINE]]
// RUN: llvm-cov gcov gcov-4.7.c | FileCheck %s
// CHECK: File 'gcov-4.7.c'
// CHECK-NEXT: Lines executed:55.56% of 9
-// CHECK-NEXT: gcov-4.7.c:creating 'gcov-4.7.c.gcov'
+// CHECK-NEXT: Creating 'gcov-4.7.c.gcov'
// RUN: FileCheck --input-file=%t/gcov-4.7.c.gcov --check-prefix=HEADER %s
// RUN: FileCheck --input-file=%t/gcov-4.7.c.gcov --check-prefix=GCOV %s
diff --git a/llvm/test/tools/llvm-cov/gcov-8.c b/llvm/test/tools/llvm-cov/gcov-8.c
index 4ac9cd671fe2..8099d22accc5 100644
--- a/llvm/test/tools/llvm-cov/gcov-8.c
+++ b/llvm/test/tools/llvm-cov/gcov-8.c
@@ -22,7 +22,7 @@ int main() { // GCOV: 1: [[@LINE]]:int
// RUN: llvm-cov gcov gcov-8.c | FileCheck %s
// CHECK: File 'gcov-8.c'
// CHECK-NEXT: Lines executed:77.78% of 9
-// CHECK-NEXT: gcov-8.c:creating 'gcov-8.c.gcov'
+// CHECK-NEXT: Creating 'gcov-8.c.gcov'
// RUN: FileCheck --input-file=%t/gcov-8.c.gcov --check-prefix=HEADER %s
// RUN: FileCheck --input-file=%t/gcov-8.c.gcov --check-prefix=GCOV %s
diff --git a/llvm/test/tools/llvm-cov/gcov-9.c b/llvm/test/tools/llvm-cov/gcov-9.c
index db6190ad5fbb..335e6c0663db 100644
--- a/llvm/test/tools/llvm-cov/gcov-9.c
+++ b/llvm/test/tools/llvm-cov/gcov-9.c
@@ -22,7 +22,7 @@ int main() { // GCOV: 1: [[@LINE]]:int
// RUN: llvm-cov gcov gcov-9.c | FileCheck %s
// CHECK: File 'gcov-9.c'
// CHECK-NEXT: Lines executed:77.78% of 9
-// CHECK-NEXT: gcov-9.c:creating 'gcov-9.c.gcov'
+// CHECK-NEXT: Creating 'gcov-9.c.gcov'
// RUN: FileCheck --input-file=%t/gcov-9.c.gcov --check-prefix=HEADER %s
// RUN: FileCheck --input-file=%t/gcov-9.c.gcov --check-prefix=GCOV %s
diff --git a/llvm/test/tools/llvm-cov/llvm-cov.test b/llvm/test/tools/llvm-cov/llvm-cov.test
index 4b3f490065ea..e4a5bdfdf9a1 100644
--- a/llvm/test/tools/llvm-cov/llvm-cov.test
+++ b/llvm/test/tools/llvm-cov/llvm-cov.test
@@ -11,28 +11,28 @@ RUN: cd %t
RUN: cp %p/Inputs/test* .
# Basic behaviour with no flags
-RUN: llvm-cov gcov test.c |
diff -u test_no_options.output -
-RUN: FileCheck --input-file=test.cpp.gcov %s --check-prefix=C
+RUN: llvm-cov gcov test.c | FileCheck %s --check-prefixes=OUT,OUTFILE --match-full-lines --strict-whitespace
+RUN: FileCheck %s --check-prefix=C --match-full-lines --strict-whitespace < test.cpp.gcov
RUN:
diff -aub test_no_options.h.gcov test.h.gcov
# Same, but specifying the object directory
RUN: mkdir -p %t/objdir
RUN: cp test.gcno test.gcda %t/objdir
-RUN: llvm-cov gcov -o objdir test.c |
diff -u test_no_options.output -
+RUN: llvm-cov gcov -o objdir test.c | FileCheck %s --check-prefixes=OUT,OUTFILE
RUN: FileCheck --input-file=test.cpp.gcov %s --check-prefix=OBJDIR
OBJDIR: 0:Graph:objdir/test.gcno
OBJDIR-NEXT: 0:Data:objdir/test.gcda
# Specifying an object file
-RUN: llvm-cov gcov -o objdir/test.o test.c |
diff -u test_no_options.output -
+RUN: llvm-cov gcov -o objdir/test.o test.c
RUN: FileCheck --input-file=test.cpp.gcov %s --check-prefix=OBJDIR
# Specifying an object file that could be ambiguous with a directory
-RUN: llvm-cov gcov -o objdir/test test.c |
diff -u test_no_options.output -
+RUN: llvm-cov gcov -o objdir/test test.c
RUN: FileCheck --input-file=test.cpp.gcov %s --check-prefix=OBJDIR
# With gcov output disabled
-RUN: llvm-cov gcov -n test.c |
diff -u test_no_output.output -
+RUN: llvm-cov gcov -n test.c | FileCheck %s --check-prefix=OUT
# Print to stdout.
RUN: llvm-cov gcov -t test.c > stdout
@@ -43,13 +43,13 @@ RUN: llvm-cov gcov -n -t test.c | count 0
RUN: llvm-cov gcov test_paths.cpp 2>/dev/null | FileCheck %s --check-prefix=MISSING
RUN: ls a.c.gcov
MISSING: File 'src/./n/../a.c'
-MISSING: src/./n/../a.c:creating 'a.c.gcov'
+MISSING: Creating 'a.c.gcov'
# Preserve paths. This mangles the output filenames.
RUN: llvm-cov gcov -p test_paths.cpp 2>/dev/null | FileCheck %s --check-prefix=PRESERVE
RUN: ls src#n#^#a.c.gcov
PRESERVE: File 'src/./n/../a.c'
-PRESERVE: src/./n/../a.c:creating 'src#n#^#a.c.gcov'
+PRESERVE: Creating 'src#n#^#a.c.gcov'
# Long file names.
RUN: llvm-cov gcov -l test_paths.cpp
@@ -64,27 +64,87 @@ RUN: llvm-cov gcov -x -gcno test_paths.gcno -gcda test_paths.gcda src/../test_pa
RUN: ls a.c##4784150e272908907eaa7380ca3eced8.gcov
# Function summaries. This changes stdout, but not the gcov files.
-RUN: llvm-cov gcov test.c -f |
diff -u test_-f.output -
+RUN: llvm-cov gcov test.c -f | FileCheck %s --check-prefixes=OUT,OUTFILE,OUT-F
RUN: FileCheck --input-file=test.cpp.gcov %s --check-prefix=C
RUN: FileCheck --input-file=test.h.gcov %s --check-prefix=H
# All blocks. This doesn't affect stdout, only the gcov files.
-RUN: llvm-cov gcov test.c -a |
diff -u test_no_options.output -
+RUN: llvm-cov gcov test.c -a | FileCheck %s --check-prefixes=OUT,OUTFILE
RUN: FileCheck --input-file=test.cpp.gcov %s --check-prefixes=C,C-A
RUN: FileCheck --input-file=test.h.gcov %s --check-prefixes=H,H-A
# Branch probabilities.
-RUN: llvm-cov gcov test.c -a -b |
diff -u test_-b.output -
+RUN: llvm-cov gcov test.c -a -b | FileCheck %s --check-prefixes=OUT,OUTFILE,OUT-B
RUN: FileCheck --input-file=test.cpp.gcov %s --check-prefixes=C,C-A,C-B
RUN: FileCheck --input-file=test.h.gcov %s --check-prefixes=H,H-A,H-B
# Function summaries including branch probabilities.
-RUN: llvm-cov gcov test.c -a -b -f | not
diff -u test_-b_-f.output - >/dev/null
-RUN: FileCheck --input-file=test.cpp.gcov %s --check-prefixes=C,C-A,C-B
-RUN: FileCheck --input-file=test.h.gcov %s --check-prefixes=H,H-A,H-B
+RUN: llvm-cov gcov test.c -a -b -f | FileCheck %s --check-prefixes=OUT,OUTFILE,OUT-F,OUT-B,OUT-FB --match-full-lines --strict-whitespace
+RUN: FileCheck %s --check-prefixes=C,C-A,C-B --match-full-lines --strict-whitespace < test.cpp.gcov
+RUN: FileCheck %s --check-prefixes=H,H-A,H-B --match-full-lines --strict-whitespace < test.h.gcov
+
+ OUT-F:Function '_ZN1AC2Ev'
+ OUT-F-NEXT:Lines executed:100.00% of 1
+ OUT-FB-NEXT:No branches
+ OUT-FB-NEXT:No calls
+ OUT-F-EMPTY:
+ OUT-F-NEXT:Function '_ZN1A1BEv'
+ OUT-F-NEXT:Lines executed:100.00% of 1
+ OUT-FB-NEXT:No branches
+ OUT-FB-NEXT:No calls
+ OUT-F-EMPTY:
+ OUT-F-NEXT:Function '_Z7uselessv'
+ OUT-F-NEXT:Lines executed:0.00% of 1
+ OUT-FB-NEXT:No branches
+ OUT-FB-NEXT:No calls
+ OUT-F-EMPTY:
+ OUT-F-NEXT:Function '_Z12more_uselessv'
+ OUT-F-NEXT:Lines executed:0.00% of 2
+ OUT-FB-NEXT:No branches
+ OUT-FB-NEXT:No calls
+ OUT-F-EMPTY:
+ OUT-F-NEXT:Function '_Z3foov'
+ OUT-F-NEXT:Lines executed:100.00% of 3
+ OUT-FB-NEXT:No branches
+ OUT-FB-NEXT:No calls
+ OUT-F-EMPTY:
+ OUT-F-NEXT:Function '_Z3barv'
+ OUT-F-NEXT:Lines executed:0.00% of 3
+ OUT-FB-NEXT:No branches
+ OUT-FB-NEXT:No calls
+ OUT-F-EMPTY:
+ OUT-F-NEXT:Function '_Z6assignii'
+ OUT-F-NEXT:Lines executed:100.00% of 3
+ OUT-FB-NEXT:No branches
+ OUT-FB-NEXT:No calls
+ OUT-F-EMPTY:
+ OUT-F-NEXT:Function '_Z15initialize_gridv'
+ OUT-F-NEXT:Lines executed:100.00% of 5
+ OUT-FB-NEXT:Branches executed:100.00% of 4
+ OUT-FB-NEXT:Taken at least once:100.00% of 4
+ OUT-FB-NEXT:No calls
+ OUT-F-EMPTY:
+ OUT-F-NEXT:Function 'main'
+ OUT-F-NEXT:Lines executed:92.00% of 25
+ OUT-FB-NEXT:Branches executed:100.00% of 11
+ OUT-FB-NEXT:Taken at least once:81.82% of 11
+ OUT-FB-NEXT:No calls
+ OUT-F-EMPTY:
+ OUT:File './test.h'
+ OUT-NEXT:Lines executed:100.00% of 1
+ OUT-B-NEXT:No branches
+ OUT-B-NEXT:No calls
+OUTFILE-NEXT:Creating 'test.h.gcov'
+ OUT-EMPTY:
+ OUT-NEXT:File 'test.cpp'
+ OUT-NEXT:Lines executed:81.40% of 43
+ OUT-B-NEXT:Branches executed:100.00% of 15
+ OUT-B-NEXT:Taken at least once:86.67% of 15
+ OUT-B-NEXT:No calls
+OUTFILE-NEXT:Creating 'test.cpp.gcov'
# Summarize unconditional branches too.
-RUN: llvm-cov gcov test.c -a -b -u |
diff -u test_-b.output -
+RUN: llvm-cov gcov test.c -a -b -u | FileCheck %s --check-prefixes=OUT,OUTFILE,OUT-B
RUN: FileCheck --input-file=test.cpp.gcov %s --check-prefixes=C,C-A,C-B,C-U
RUN: FileCheck --input-file=test.h.gcov %s --check-prefixes=H,H-A,H-B,H-U
@@ -94,9 +154,16 @@ RUN: FileCheck --input-file=test.h.gcov %s --check-prefix=H-C
H-C: unconditional 0 taken 1
# Missing gcda file just gives 0 counts.
-RUN: llvm-cov gcov test.c -gcda=no_such_gcda_file |
diff -u test_no_gcda.output -
+RUN: llvm-cov gcov test.c -gcda=no_such_gcda_file | FileCheck %s --check-prefix=NO-GCDA
RUN:
diff -aub test_no_gcda.cpp.gcov test.cpp.gcov
RUN:
diff -aub test_no_gcda.h.gcov test.h.gcov
+NO-GCDA: File './test.h'
+NO-GCDA-NEXT: Lines executed:0.00% of 1
+NO-GCDA-NEXT: Creating 'test.h.gcov'
+NO-GCDA-EMPTY:
+NO-GCDA-NEXT: File 'test.cpp'
+NO-GCDA-NEXT: Lines executed:0.00% of 43
+NO-GCDA-NEXT: Creating 'test.cpp.gcov'
# Invalid gcno file.
RUN: llvm-cov gcov test.c -gcno=test_read_fail.gcno
More information about the llvm-commits
mailing list