Files
creuse 0f134c2af1 Document new integration Makefile and add example
This documents the integration Makefile generated by gnattest and
adds a new "integration" example to showcase its use and how it
can be used to avoid incidental coverage.

Change-Id: I981049b8a52fa8ecf1c782a89028010c764c91e6
TN: U115-024
2021-09-24 16:15:45 +02:00

28 lines
1.2 KiB
Makefile

# This makefile demonstrates how to use the integration makefile generated
# by GNATtest to obtain coverage reports on the units tested by GNATtest.
# The project consists of two units, Pkg1 and Pkg2, with Pkg2 depending on
# Pkg1.
#
# The goal is to only have coverage from unit tests for each unit count
# towards the coverage assesment of taht particular unit (i.e. unit tests on
# Pkg2 should only contribute to coverage for unit Pkg2, and not Pkg1).
#
# Tests are partially implemented in the "tests" directory, only tests for
# Pkg2 have been implemented so that coverage violation on Pkg1 should appear,
# if coverage for each unit is indeed assessed in isolation.
.PHONY: clean
clean:
rm -rf obj/ harness/
# This rule shows how separate drivers can help avoid incidental coverage,
# by preventing calls to Pkg1 subprograms in Pkg2 testing from counting
# towards coverage for Pkg1.
gnattest-separate: clean
gnattest -P prj.gpr --separate-drivers=unit && make -C harness/ coverage
# This rule uses a single monolithic driver and shows how Pkg1 ends up fully
# covered despite no having any tests written for it.
gnattest-monolithic: clean
gnattest -P prj && make -C harness/ coverage