Skip to content

Commit

Permalink
Setup test case for coexisting object directories (gcovr#832)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Förderer <[email protected]>
  • Loading branch information
oleurodecision and Spacetown authored Dec 17, 2023
1 parent 064d409 commit 8e1a410
Show file tree
Hide file tree
Showing 219 changed files with 21,429 additions and 175 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Internal changes:
- Use ``build`` instead of calling ``setup.py`` directly. (:issue:`819`)
- Add nox session to import reference file from pipeline. (:issue:`831`)
- Add support for ``clang-15`` in our test suite and fix test with write protection under Mac OS. (:issue:`853`)
- Add test for parallel execution of multiple gcovr instances. (:issue:`832`)

6.0 (08 March 2023)
-------------------
Expand Down
2 changes: 1 addition & 1 deletion gcovr/tests/add_coverages/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ coverage_foo.json:
$(GCOVR) -d --json-pretty -o $@

# Just use --json-pretty and --json and pass the output filename directly.
coverage_bar.json:
coverage_bar.json: coverage_foo.json
./testcase_bar
$(GCOVR) -d --json-pretty --json $@

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.14)

project(gcovr_parallel_calls LANGUAGES CXX)

set(CMAKE_CXX_FLAGS_PROFILE --coverage)

add_executable(parallel_call)

target_sources (parallel_call
PRIVATE
source/fn_00.cpp
source/fn_01.cpp
source/fn_02.cpp
source/fn_03.cpp
source/fn_04.cpp
source/fn_05.cpp
source/fn_06.cpp
source/fn_07.cpp
source/fn_08.cpp
source/fn_09.cpp
source/main.cpp)

if(ODD)
target_compile_definitions (parallel_call PRIVATE ODD)
endif()

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

build.%:
mkdir -p build/$* && cmake -G "Ninja" -DCMAKE_BUILD_TYPE=PROFILE -S . -B build/$* -D ODD=$(if $(filter b,$*),OFF,ON)
cmake --build build/$* -- -v

all: build.a build.b build.c

run: txt cobertura html sonarqube coveralls

.NOTPARALLEL: coverage.a.json coverage.b.json coverage.c.json

coverage.%.json:
$(eval base_dir := $(shell pwd))
$(eval build_dir := $(base_dir)/build/$*)
cd $(build_dir) && ./parallel_call
cd $(build_dir) && $(GCOVR) --json-pretty --json $(base_dir)/$@ --root $(base_dir) $(build_dir)

coverage.%.txt: coverage.%.json
$(GCOVR) -a $< -o $@

txt: coverage.a.txt coverage.b.txt coverage.c.txt

cobertura.%.xml: coverage.%.json
$(GCOVR) -a $< --cobertura-pretty --cobertura $@

cobertura: cobertura.a.xml cobertura.b.xml cobertura.c.xml

coverage.%.html: coverage.%.json
$(GCOVR) -a $< --html-details -o $@

html: coverage.a.html coverage.b.html coverage.c.html

coveralls.%.json: coverage.%.json
$(GCOVR) -a $< --coveralls-pretty --coveralls $@

coveralls: coveralls.a.json coveralls.b.json coveralls.c.json

sonarqube.%.xml: coverage.%.json
$(GCOVR) -a $< --sonarqube -o $@

sonarqube: sonarqube.a.xml sonarqube.b.xml sonarqube.c.xml

clean:
rm -rf build
rm -f run.*.done
rm -f coverage.*.* cobertura.*.* sonarqube.*.* coveralls.*.*
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE coverage SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-04.dtd'>
<coverage line-rate="0.60526" branch-rate="1.0" lines-covered="23" lines-valid="38" branches-covered="0" branches-valid="0" complexity="0.0" timestamp="" version="gcovr 6.0+master">
<sources>
<source>.</source>
</sources>
<packages>
<package name="source" line-rate="0.60526" branch-rate="1.0" complexity="0.0">
<classes>
<class name="fn_00_cpp" filename="source/fn_00.cpp" line-rate="1.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="1" branch="false"/>
<line number="3" hits="1" branch="false"/>
<line number="4" hits="1" branch="false"/>
</lines>
</class>
<class name="fn_01_cpp" filename="source/fn_01.cpp" line-rate="1.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="1" branch="false"/>
<line number="3" hits="1" branch="false"/>
<line number="4" hits="1" branch="false"/>
</lines>
</class>
<class name="fn_02_cpp" filename="source/fn_02.cpp" line-rate="1.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="1" branch="false"/>
<line number="3" hits="1" branch="false"/>
<line number="4" hits="1" branch="false"/>
</lines>
</class>
<class name="fn_03_cpp" filename="source/fn_03.cpp" line-rate="1.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="1" branch="false"/>
<line number="3" hits="1" branch="false"/>
<line number="4" hits="1" branch="false"/>
</lines>
</class>
<class name="fn_04_cpp" filename="source/fn_04.cpp" line-rate="1.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="1" branch="false"/>
<line number="3" hits="1" branch="false"/>
<line number="4" hits="1" branch="false"/>
</lines>
</class>
<class name="fn_05_cpp" filename="source/fn_05.cpp" line-rate="0.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="0" branch="false"/>
<line number="3" hits="0" branch="false"/>
<line number="4" hits="0" branch="false"/>
</lines>
</class>
<class name="fn_06_cpp" filename="source/fn_06.cpp" line-rate="0.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="0" branch="false"/>
<line number="3" hits="0" branch="false"/>
<line number="4" hits="0" branch="false"/>
</lines>
</class>
<class name="fn_07_cpp" filename="source/fn_07.cpp" line-rate="0.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="0" branch="false"/>
<line number="3" hits="0" branch="false"/>
<line number="4" hits="0" branch="false"/>
</lines>
</class>
<class name="fn_08_cpp" filename="source/fn_08.cpp" line-rate="0.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="0" branch="false"/>
<line number="3" hits="0" branch="false"/>
<line number="4" hits="0" branch="false"/>
</lines>
</class>
<class name="fn_09_cpp" filename="source/fn_09.cpp" line-rate="0.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="0" branch="false"/>
<line number="3" hits="0" branch="false"/>
<line number="4" hits="0" branch="false"/>
</lines>
</class>
<class name="main_cpp" filename="source/main.cpp" line-rate="1.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="1" branch="false"/>
<line number="4" hits="1" branch="false"/>
<line number="6" hits="1" branch="false"/>
<line number="8" hits="1" branch="false"/>
<line number="10" hits="1" branch="false"/>
<line number="12" hits="1" branch="false"/>
<line number="14" hits="1" branch="false"/>
<line number="28" hits="1" branch="false"/>
</lines>
</class>
</classes>
</package>
</packages>
</coverage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE coverage SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-04.dtd'>
<coverage line-rate="0.60526" branch-rate="1.0" lines-covered="23" lines-valid="38" branches-covered="0" branches-valid="0" complexity="0.0" timestamp="" version="gcovr 6.0+master">
<sources>
<source>.</source>
</sources>
<packages>
<package name="source" line-rate="0.60526" branch-rate="1.0" complexity="0.0">
<classes>
<class name="fn_00_cpp" filename="source/fn_00.cpp" line-rate="0.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="0" branch="false"/>
<line number="3" hits="0" branch="false"/>
<line number="4" hits="0" branch="false"/>
</lines>
</class>
<class name="fn_01_cpp" filename="source/fn_01.cpp" line-rate="0.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="0" branch="false"/>
<line number="3" hits="0" branch="false"/>
<line number="4" hits="0" branch="false"/>
</lines>
</class>
<class name="fn_02_cpp" filename="source/fn_02.cpp" line-rate="0.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="0" branch="false"/>
<line number="3" hits="0" branch="false"/>
<line number="4" hits="0" branch="false"/>
</lines>
</class>
<class name="fn_03_cpp" filename="source/fn_03.cpp" line-rate="0.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="0" branch="false"/>
<line number="3" hits="0" branch="false"/>
<line number="4" hits="0" branch="false"/>
</lines>
</class>
<class name="fn_04_cpp" filename="source/fn_04.cpp" line-rate="0.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="0" branch="false"/>
<line number="3" hits="0" branch="false"/>
<line number="4" hits="0" branch="false"/>
</lines>
</class>
<class name="fn_05_cpp" filename="source/fn_05.cpp" line-rate="1.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="1" branch="false"/>
<line number="3" hits="1" branch="false"/>
<line number="4" hits="1" branch="false"/>
</lines>
</class>
<class name="fn_06_cpp" filename="source/fn_06.cpp" line-rate="1.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="1" branch="false"/>
<line number="3" hits="1" branch="false"/>
<line number="4" hits="1" branch="false"/>
</lines>
</class>
<class name="fn_07_cpp" filename="source/fn_07.cpp" line-rate="1.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="1" branch="false"/>
<line number="3" hits="1" branch="false"/>
<line number="4" hits="1" branch="false"/>
</lines>
</class>
<class name="fn_08_cpp" filename="source/fn_08.cpp" line-rate="1.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="1" branch="false"/>
<line number="3" hits="1" branch="false"/>
<line number="4" hits="1" branch="false"/>
</lines>
</class>
<class name="fn_09_cpp" filename="source/fn_09.cpp" line-rate="1.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="1" branch="false"/>
<line number="3" hits="1" branch="false"/>
<line number="4" hits="1" branch="false"/>
</lines>
</class>
<class name="main_cpp" filename="source/main.cpp" line-rate="1.0" branch-rate="1.0" complexity="0.0">
<methods/>
<lines>
<line number="2" hits="1" branch="false"/>
<line number="16" hits="1" branch="false"/>
<line number="18" hits="1" branch="false"/>
<line number="20" hits="1" branch="false"/>
<line number="22" hits="1" branch="false"/>
<line number="24" hits="1" branch="false"/>
<line number="26" hits="1" branch="false"/>
<line number="28" hits="1" branch="false"/>
</lines>
</class>
</classes>
</package>
</packages>
</coverage>
Loading

0 comments on commit 8e1a410

Please sign in to comment.