Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fff2d5c
commit 16e97e6
Showing
10 changed files
with
632 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
CFLAGS= -fprofile-arcs -ftest-coverage -fPIC | ||
|
||
all: | ||
$(CXX) $(CFLAGS) -c foo.cpp -o foo.o | ||
$(CXX) $(CFLAGS) -c bar.cpp -o bar.o | ||
$(CXX) $(CFLAGS) -DFOO -c main.cpp -o main_foo.o | ||
$(CXX) $(CFLAGS) main_foo.o foo.o -o testcase_foo | ||
$(CXX) $(CFLAGS) -DBAR -c main.cpp -o main_bar.o | ||
$(CXX) $(CFLAGS) main_bar.o bar.o -o testcase_bar | ||
|
||
run: txt xml html sonarqube json | ||
|
||
json_foo: | ||
./testcase_foo | ||
$(GCOVR) -d --json-pretty -o coverage_foo.json | ||
|
||
json_bar: | ||
./testcase_bar | ||
$(GCOVR) -d --json -o coverage_bar.json | ||
|
||
txt: json_foo json_bar | ||
$(GCOVR) -a coverage_foo.json -a coverage_bar.json -o coverage.txt | ||
|
||
xml: json_foo json_bar | ||
$(GCOVR) -a coverage_foo.json -a coverage_bar.json -x -o coverage.xml | ||
|
||
html: json_foo json_bar | ||
$(GCOVR) -a coverage_foo.json -a coverage_bar.json --html-details -o coverage.html | ||
|
||
sonarqube: json_foo json_bar | ||
$(GCOVR) -a coverage_foo.json -a coverage_bar.json --sonarqube sonarqube.xml | ||
|
||
json: json_foo json_bar | ||
$(GCOVR) -a coverage_foo.json -a coverage_bar.json --json-pretty -o coverage.json | ||
|
||
clean: | ||
rm -f testcase_* | ||
rm -f *.gc* | ||
rm -f *.o | ||
rm -f coverage.txt coverage.xml coverage*.html sonarqube.xml coverage*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A simple test that verifies adding coverages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
int bar() | ||
{ | ||
int x=2; | ||
int y=2; | ||
return x-y; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
int foo() | ||
{ | ||
int x=2; | ||
int y=2; | ||
return x+y; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <iostream> | ||
|
||
#ifdef FOO | ||
extern int foo(); | ||
#endif | ||
#ifdef BAR | ||
extern int bar(); | ||
#endif | ||
|
||
int main(int argc, char* argv[]) { | ||
#ifdef FOO | ||
foo(); | ||
#endif | ||
#ifdef BAR | ||
bar(); | ||
#endif | ||
|
||
return 0; | ||
} |
Oops, something went wrong.