diff options
Diffstat (limited to 'test/tools/llvm-cov')
-rw-r--r-- | test/tools/llvm-cov/Inputs/test_-b.output | 2 | ||||
-rw-r--r-- | test/tools/llvm-cov/Inputs/test_-f.output | 2 | ||||
-rw-r--r-- | test/tools/llvm-cov/Inputs/test_no_gcda.output | 2 | ||||
-rw-r--r-- | test/tools/llvm-cov/Inputs/test_no_options.output | 2 | ||||
-rw-r--r-- | test/tools/llvm-cov/Inputs/test_no_preserve_paths.output | 8 | ||||
-rw-r--r-- | test/tools/llvm-cov/Inputs/test_paths.cpp.gcov | 79 | ||||
-rw-r--r-- | test/tools/llvm-cov/Inputs/test_paths.gcda | bin | 0 -> 904 bytes | |||
-rw-r--r-- | test/tools/llvm-cov/Inputs/test_paths.gcno | bin | 0 -> 4476 bytes | |||
-rw-r--r-- | test/tools/llvm-cov/Inputs/test_paths.h.gcov | 8 | ||||
-rw-r--r-- | test/tools/llvm-cov/Inputs/test_preserve_paths.output | 8 | ||||
-rw-r--r-- | test/tools/llvm-cov/llvm-cov.test | 12 |
11 files changed, 119 insertions, 4 deletions
diff --git a/test/tools/llvm-cov/Inputs/test_-b.output b/test/tools/llvm-cov/Inputs/test_-b.output index 4003ce8e69..515987d45e 100644 --- a/test/tools/llvm-cov/Inputs/test_-b.output +++ b/test/tools/llvm-cov/Inputs/test_-b.output @@ -9,5 +9,5 @@ File './test.h' Lines executed:100.00% of 1 No branches No calls -./test.h:creating './test.h.gcov' +./test.h:creating 'test.h.gcov' diff --git a/test/tools/llvm-cov/Inputs/test_-f.output b/test/tools/llvm-cov/Inputs/test_-f.output index 9e98d88880..d97aa18174 100644 --- a/test/tools/llvm-cov/Inputs/test_-f.output +++ b/test/tools/llvm-cov/Inputs/test_-f.output @@ -34,5 +34,5 @@ test.cpp:creating 'test.cpp.gcov' File './test.h' Lines executed:100.00% of 1 -./test.h:creating './test.h.gcov' +./test.h:creating 'test.h.gcov' diff --git a/test/tools/llvm-cov/Inputs/test_no_gcda.output b/test/tools/llvm-cov/Inputs/test_no_gcda.output index 69adce209b..e994be7291 100644 --- a/test/tools/llvm-cov/Inputs/test_no_gcda.output +++ b/test/tools/llvm-cov/Inputs/test_no_gcda.output @@ -4,5 +4,5 @@ test.cpp:creating 'test.cpp.gcov' File './test.h' Lines executed:0.00% of 1 -./test.h:creating './test.h.gcov' +./test.h:creating 'test.h.gcov' diff --git a/test/tools/llvm-cov/Inputs/test_no_options.output b/test/tools/llvm-cov/Inputs/test_no_options.output index 93ea726720..8be8c1c210 100644 --- a/test/tools/llvm-cov/Inputs/test_no_options.output +++ b/test/tools/llvm-cov/Inputs/test_no_options.output @@ -4,5 +4,5 @@ test.cpp:creating 'test.cpp.gcov' File './test.h' Lines executed:100.00% of 1 -./test.h:creating './test.h.gcov' +./test.h:creating 'test.h.gcov' diff --git a/test/tools/llvm-cov/Inputs/test_no_preserve_paths.output b/test/tools/llvm-cov/Inputs/test_no_preserve_paths.output new file mode 100644 index 0000000000..ada0c36030 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test_no_preserve_paths.output @@ -0,0 +1,8 @@ +File 'srcdir/./nested_dir/../test.h' +Lines executed:100.00% of 1 +srcdir/./nested_dir/../test.h:creating 'test.h.gcov' + +File 'srcdir/./nested_dir/../test.cpp' +Lines executed:84.21% of 38 +srcdir/./nested_dir/../test.cpp:creating 'test.cpp.gcov' + diff --git a/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov b/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov new file mode 100644 index 0000000000..3982ddf4e5 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov @@ -0,0 +1,79 @@ + -: 0:Source:srcdir/./nested_dir/../test.cpp + -: 0:Graph:test_paths.gcno + -: 0:Data:test_paths.gcda + -: 0:Runs:3 + -: 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() { + 21: 33: for (int ii = 0; ii < 2; ii++) + 36: 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: + 66: 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; +25769803782: 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/test/tools/llvm-cov/Inputs/test_paths.gcda b/test/tools/llvm-cov/Inputs/test_paths.gcda Binary files differnew file mode 100644 index 0000000000..7e2cf9ef20 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test_paths.gcda diff --git a/test/tools/llvm-cov/Inputs/test_paths.gcno b/test/tools/llvm-cov/Inputs/test_paths.gcno Binary files differnew file mode 100644 index 0000000000..aada974bc5 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test_paths.gcno diff --git a/test/tools/llvm-cov/Inputs/test_paths.h.gcov b/test/tools/llvm-cov/Inputs/test_paths.h.gcov new file mode 100644 index 0000000000..95e90ca664 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test_paths.h.gcov @@ -0,0 +1,8 @@ + -: 0:Source:srcdir/./nested_dir/../test.h + -: 0:Graph:test_paths.gcno + -: 0:Data:test_paths.gcda + -: 0:Runs:3 + -: 0:Programs:1 + 6: 1:struct A { + -: 2: virtual void B(); + -: 3:}; diff --git a/test/tools/llvm-cov/Inputs/test_preserve_paths.output b/test/tools/llvm-cov/Inputs/test_preserve_paths.output new file mode 100644 index 0000000000..5331972556 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test_preserve_paths.output @@ -0,0 +1,8 @@ +File 'srcdir/./nested_dir/../test.h' +Lines executed:100.00% of 1 +srcdir/./nested_dir/../test.h:creating 'srcdir#nested_dir#^#test.h.gcov' + +File 'srcdir/./nested_dir/../test.cpp' +Lines executed:84.21% of 38 +srcdir/./nested_dir/../test.cpp:creating 'srcdir#nested_dir#^#test.cpp.gcov' + diff --git a/test/tools/llvm-cov/llvm-cov.test b/test/tools/llvm-cov/llvm-cov.test index 239108240e..c52a981522 100644 --- a/test/tools/llvm-cov/llvm-cov.test +++ b/test/tools/llvm-cov/llvm-cov.test @@ -21,6 +21,18 @@ RUN: llvm-cov -o objdir test.c | diff -u test_no_options.output - RUN: diff -aub test_objdir.cpp.gcov test.cpp.gcov RUN: diff -aub test_objdir.h.gcov test.h.gcov +# Preserve paths. This mangles the output filenames. +RUN: mkdir -p %t/srcdir/nested_dir +RUN: cp test.cpp test.h %t/srcdir +RUN: llvm-cov -p test_paths.cpp | diff -u test_preserve_paths.output - +RUN: diff -aub test_paths.cpp.gcov srcdir#nested_dir#^#test.cpp.gcov +RUN: diff -aub test_paths.h.gcov srcdir#nested_dir#^#test.h.gcov + +# Don't preserve paths. Same results as preserve paths, but no mangling. +RUN: llvm-cov test_paths.cpp | diff -u test_no_preserve_paths.output - +RUN: diff -aub test_paths.cpp.gcov test.cpp.gcov +RUN: diff -aub test_paths.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 |