Generate coverage report

This commit is contained in:
Toby Jaffey 2025-12-13 17:53:55 +00:00
parent 1e5555f66d
commit 2e1f4d3f93
5 changed files with 28 additions and 4 deletions

View file

@ -16,4 +16,16 @@ jobs:
- name: Build
run: make dockerbuild && make docker
working-directory: uvm32
- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: uvm32/test/coverage.xml
badge: true
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'

View file

@ -35,3 +35,7 @@ RUN apt-get install -y qemu-system-misc
# host-sdl
RUN apt-get install -y libsdl3-0 libsdl3-dev
# code coverage
RUN apt-get install -y gcovr

View file

@ -1,12 +1,12 @@
.PHONY: test
all:
make -C test
(cd test && make clean)
(cd hosts && make)
(cd apps && make)
clean:
make -C test clean
(cd test && make clean)
(cd hosts && make clean)
(cd apps && make clean)

View file

@ -9,9 +9,17 @@ TESTS = \
RUNCMD = $(foreach TEST,${TESTS},make -C ${TEST} &&)
CLEANCMD = $(foreach TEST,${TESTS},make -C ${TEST} clean &&)
ifeq (,$(shell which gcovr))
GCOVRCMD=echo Install gcovr for code coverage reports
else
GCOVRCMD=gcovr -r ../ --filter ".*uvm32.c" && gcovr -r ../ --filter ".*uvm32.c" --cobertura-pretty --cobertura coverage.xml
endif
all:
${RUNCMD} true
${GCOVRCMD}
clean:
${CLEANCMD} true
rm -f coverage.xml

View file

@ -7,8 +7,8 @@ UVM32_MEMORY_SIZE ?= 16384
CFLAGS +=-std=c99
CFLAGS += -Wall
CFLAGS += -Werror
CFLAGS += -DUVM32_MEMORY_SIZE=${UVM32_MEMORY_SIZE}
CFLAGS += -fprofile-arcs -ftest-coverage
SUITE_NAME=tests
@ -31,6 +31,6 @@ test/test_runners/${SUITE_NAME}_Runner.c: test/${SUITE_NAME}.c
@ruby $(UNITY_ROOT)/auto/generate_test_runner.rb test/${SUITE_NAME}.c test/test_runners/${SUITE_NAME}_Runner.c
clean:
rm -rf $(TARGET1) test/test_runners
rm -rf $(TARGET1) test/test_runners *.gcno *.gcda *.gcov
(cd rom && make clean)