Skip to content

Commit 6908864

Browse files
committed
Additional test cases:
- Simple static library, which requires to .gcov files to be merged in the GCOV workflow, and for multiple records to be merged in the LCOV workflow - Simple template library, which requires to .gcov files to be merged in the GCOV workflow, and for multiple records to be merged in the LCOV workflow - Out of tree test, where --root is used to specify a separate source directory as the base file path - Missing files test - which ensures that files are reported as missing, even if it hasn't been linked into any test - File / directory exlcusion patterns (gcov only) - File / directory explicit inclusions (gcov only)
1 parent 4fd5b13 commit 6908864

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+506
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pip-log.txt
2727
nosetests.xml
2828
*_test_output
2929
*.gcov
30+
output.json
3031

3132

3233
# Translations

test-src/excluded_files/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
part_unused.o: part_unused.h part_unused.cpp
2+
g++ --coverage -c -o part_unused.o part_unused.cpp
3+
4+
toy.o: extra_lib/toy.cpp extra_lib/toy.h
5+
g++ --coverage -c -o toy.o extra_lib/toy.cpp
6+
7+
a_toy.o: another_extra_lib/another_toy.cpp another_extra_lib/another_toy.h
8+
g++ --coverage -c -o a_toy.o another_extra_lib/another_toy.cpp
9+
10+
foo: foo.cpp part_unused.o toy.o a_toy.o extra_lib/toy.h another_extra_lib/another_toy.h
11+
g++ --coverage -o foo foo.cpp part_unused.o toy.o a_toy.o
12+
13+
clean:
14+
rm -f foo *.gcno *.gcda output *.gcov output.json part_unused.o toy.o a_toy.o
15+
16+
prepare_test: foo
17+
18+
test: foo
19+
./foo
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include "another_toy.h"
2+
3+
int a_toy(int& i) {
4+
i*=2;
5+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int a_toy(int& i);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int toy(int& i);

test-src/excluded_files/config.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
#
4+
# Only run in gcov mdoe: exclusions are irrelevant when processing lcov files,
5+
# these should already been done when manually assembling the lcov file...
6+
#
7+
modes="gcov"
8+
9+
gcov_coveralls_flags="-e part_unused.cpp -e part_unused.h -e extra_lib -E .*another_extra_lib.*"
10+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"source_files": [{
3+
"name": "foo.cpp",
4+
"coverage": [null, null, null, null, 1, 1, 1, null, 1, 1, 1, 1, 0, null, null, null, null, 0, null, 1, 0, null, null, 1, null]
5+
}]
6+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include "toy.h"
2+
3+
int toy(int& i) {
4+
i*=2;
5+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int toy(int& i);

test-src/excluded_files/foo.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include "part_unused.h"
2+
#include "extra_lib/toy.h"
3+
#include "another_extra_lib/another_toy.h"
4+
5+
int main() {
6+
int a = 1;
7+
g(a);
8+
Inline i;
9+
i.inline_g(a);
10+
toy(a);
11+
a_toy(a);
12+
if(a == 2) {
13+
a = 3;
14+
/* LCOV_EXCL_START */
15+
a = 4;
16+
a = 5;
17+
/* LCOV_EXCL_STOP */
18+
a = 6;
19+
}
20+
if(a == 7) {
21+
a = 8;
22+
a = 9; /* LCOV_EXCL_LINE */
23+
}
24+
return 0;
25+
}

0 commit comments

Comments
 (0)