[PATCH 00/12] Support gcov instrumentation
Sebastian Huber
sebastian.huber at embedded-brains.de
Wed Jun 29 06:30:36 UTC 2022
This patch set adds support to build the RTEMS libraries with gcov
instrumentation to get code and branch coverage. There are some improvements
necessary in the build system to support different compiler flags for libraries
and tests. In general, code coverage is enabled by the new RTEMS_COVERAGE
build configuration option. The user can fine tune the build through the
LIBRARY_OPTIMIZATION_FLAGS, TEST_OPTIMIZATION_FLAGS, and COVERAGE_COMPILER_FLAGS,
COVERAGE_LINKER_FLAGS options. The gcov information is dumped after each test
case in a base64 encoded gcfn and gcda data stream. It looks like this:
*** BEGIN OF GCOV INFO BASE64 ***
bmZjZyAxMkJSAAAAL3RtcC9zaC9iLXJ0ZW1zL2FybS94aWxpbnhfenlucV9hOV9xZW11L2NwdWtp
dC9saWJjc3VwcG9ydC9zcmMvX19nZXR0b2QuYy42NS5nY2RhAGFkY2cgMTJCPoT6qo6mcBUAAAAB
DAAAAOOrF1pxp0aIPrK7wAAAoQHw////AAAAAQwAAADTfDdNQYCYwJ9ZRL0AAKEBIAAAAAQAAAAA
...
srvAAAChAfD///8AAAABDAAAAMXOxS0Rhzqx6Old2wAAoQH4////AAAAAQwAAACYh8U9/rgJ5hMc
ig8AAKEB2P///wAAAAEMAAAAN3+9YAwMW8gTHIoPAAChAdj///8AAAABDAAAADAwMx4TuamFPrK7
wAAAoQHw////AAAAAQwAAACvassJzDNWd/lKs3wAAKEB8P///wAAAAA=
*** END OF GCOV INFO BASE64 ***
On the host you can decode the block and pipe it through the gcov-tool to
produce the *.gcda files. Example Python code:
block = some regex stuff to get the block between the BEGIN/END OF ...
stream = base64.b64decode(block)
subprocess.run(["arm-rtems6-gcov-tool", "merge-stream"], input=stream)
Sebastian Huber (12):
build: Add more flags to BuildItemContext
build: Move BSP_INCLUDES split
build: Fix identifier pattern
build: Improve value substitution
build: Add cppflags, cflags, cxxflags to groups
build: Allow separate optimization flags
gcov: Add fork(), etc. gcov wrappers
gcov: Add functions to dump the gcov information
gcov: Add wrapper to dump the gcov info
build: Add RTEMS_COVERAGE option
samples/minimum: Prevent a stack overflow
libtests/crypt01: Avoid stack overflows
cpukit/include/rtems/score/io.h | 4 +
cpukit/include/rtems/test-info.h | 6 +
cpukit/libcsupport/src/gcovfork.c | 94 ++++++++++++++
cpukit/libtest/testgcovbspreset.c | 54 ++++++++
cpukit/libtest/testgcovcpufatalhalt.c | 54 ++++++++
cpukit/libtest/testgcovdumpinfo.c | 66 ++++++++++
cpukit/score/src/iogcovdumpinfo.c | 101 +++++++++++++++
cpukit/score/src/iogcovdumpinfobase64.c | 111 ++++++++++++++++
spec/build/bsps/aarch64/a53/grp.yml | 3 +
spec/build/bsps/aarch64/a72/grp.yml | 3 +
spec/build/bsps/aarch64/grp.yml | 3 +
spec/build/bsps/aarch64/xilinx-versal/grp.yml | 3 +
.../bsps/aarch64/xilinx-versal/grp_qemu.yml | 3 +
.../bsps/aarch64/xilinx-versal/grp_vck190.yml | 3 +
spec/build/bsps/aarch64/xilinx-zynqmp/grp.yml | 3 +
.../bsps/aarch64/xilinx-zynqmp/grp_zu3eg.yml | 5 +-
spec/build/bsps/arm/beagle/grp.yml | 3 +
spec/build/bsps/arm/csb337/grp.yml | 3 +
spec/build/bsps/arm/fvp/grp.yml | 3 +
spec/build/bsps/arm/grp.yml | 3 +
spec/build/bsps/arm/lm3s69xx/grp.yml | 3 +
spec/build/bsps/arm/lpc176x/grp.yml | 3 +
spec/build/bsps/arm/lpc24xx/grp.yml | 3 +
spec/build/bsps/arm/lpc32xx/grp.yml | 3 +
spec/build/bsps/arm/raspberrypi/grp.yml | 3 +
spec/build/bsps/arm/rtl22xx/grp.yml | 3 +
spec/build/bsps/arm/stm32f4/grp.yml | 3 +
spec/build/bsps/arm/stm32h7/grp.yml | 3 +
spec/build/bsps/arm/tms570/grp.yml | 3 +
spec/build/bsps/arm/xilinx-zynq/grp.yml | 3 +
spec/build/bsps/bfin/grp.yml | 3 +
spec/build/bsps/bspopts.yml | 6 +
spec/build/bsps/grpmake.yml | 3 +
spec/build/bsps/i386/grp.yml | 3 +
spec/build/bsps/i386/pc386/grp.yml | 3 +
spec/build/bsps/lm32/grp.yml | 3 +
spec/build/bsps/lm32/lm32_evr/grp.yml | 3 +
spec/build/bsps/m68k/gen68360/grp.yml | 3 +
spec/build/bsps/m68k/genmcf548x/grp.yml | 3 +
spec/build/bsps/m68k/grp.yml | 3 +
spec/build/bsps/m68k/mvme162/grp.yml | 3 +
spec/build/bsps/microblaze/grp.yml | 3 +
.../bsps/microblaze/microblaze_fpga/grp.yml | 3 +
spec/build/bsps/mips/grp.yml | 3 +
spec/build/bsps/optcflags.yml | 17 +++
spec/build/bsps/optincludes.yml | 1 +
spec/build/bsps/optliboptflags.yml | 18 +++
spec/build/bsps/opto0.yml | 4 +-
spec/build/bsps/opto1.yml | 4 +-
spec/build/bsps/opto2.yml | 4 +-
spec/build/bsps/optog.yml | 4 +-
spec/build/bsps/optos.yml | 4 +-
spec/build/bsps/opttestoptflags.yml | 18 +++
spec/build/bsps/or1k/grp.yml | 3 +
spec/build/bsps/powerpc/gen5200/grp.yml | 3 +
spec/build/bsps/powerpc/gen83xx/grp.yml | 3 +
spec/build/bsps/powerpc/grp.yml | 3 +
.../bsps/powerpc/motorola_powerpc/grp.yml | 3 +
spec/build/bsps/powerpc/mpc55xxevb/grp.yml | 3 +
spec/build/bsps/powerpc/qoriq/grp.yml | 3 +
spec/build/bsps/powerpc/tqm8xx/grp.yml | 3 +
spec/build/bsps/riscv/griscv/grp.yml | 3 +
spec/build/bsps/riscv/grp.yml | 3 +
spec/build/bsps/riscv/riscv/grp.yml | 3 +
spec/build/bsps/sh/shsim/grp.yml | 3 +
spec/build/bsps/sparc/grp.yml | 3 +
spec/build/bsps/sparc/leon2/grp.yml | 3 +
spec/build/bsps/sparc/leon3/grp.yml | 3 +
spec/build/bsps/sparc64/grp.yml | 3 +
spec/build/bsps/v850/gdbv850sim/grp.yml | 3 +
spec/build/bsps/x86_64/grp.yml | 3 +
spec/build/cpukit/cpuopts.yml | 10 ++
spec/build/cpukit/grp.yml | 7 +
spec/build/cpukit/librtemscpu.yml | 3 +
spec/build/cpukit/librtemstest.yml | 3 +
spec/build/cpukit/optcoverage.yml | 16 +++
spec/build/cpukit/optcoveragecflags.yml | 20 +++
spec/build/cpukit/optcoverageldflags.yml | 25 ++++
spec/build/cpukit/optnocoveragecflags.yml | 18 +++
spec/build/cpukit/optnocoverageldflags.yml | 18 +++
spec/build/grp.yml | 3 +
spec/build/testsuites/ada/grp.yml | 3 +
spec/build/testsuites/benchmarks/grp.yml | 3 +
spec/build/testsuites/fstests/grp.yml | 3 +
spec/build/testsuites/grp.yml | 8 +-
spec/build/testsuites/libtests/grp.yml | 3 +
spec/build/testsuites/mptests/grp.yml | 3 +
spec/build/testsuites/psxtests/grp.yml | 3 +
spec/build/testsuites/psxtmtests/grp.yml | 3 +
spec/build/testsuites/rhealstone/grp.yml | 3 +
spec/build/testsuites/samples/grp.yml | 3 +
spec/build/testsuites/smptests/grp.yml | 3 +
spec/build/testsuites/sptests/grp.yml | 3 +
spec/build/testsuites/tmtests/grp.yml | 3 +
spec/build/testsuites/unit/grp.yml | 3 +
spec/build/testsuites/validation/grp.yml | 3 +
testsuites/libtests/crypt01/init.c | 6 +-
testsuites/samples/minimum/init.c | 5 +
testsuites/validation/tc-terminate.c | 3 +-
wscript | 120 +++++++++++++-----
100 files changed, 986 insertions(+), 52 deletions(-)
create mode 100644 cpukit/libcsupport/src/gcovfork.c
create mode 100644 cpukit/libtest/testgcovbspreset.c
create mode 100644 cpukit/libtest/testgcovcpufatalhalt.c
create mode 100644 cpukit/libtest/testgcovdumpinfo.c
create mode 100644 cpukit/score/src/iogcovdumpinfo.c
create mode 100644 cpukit/score/src/iogcovdumpinfobase64.c
create mode 100644 spec/build/bsps/optcflags.yml
create mode 100644 spec/build/bsps/optliboptflags.yml
create mode 100644 spec/build/bsps/opttestoptflags.yml
create mode 100644 spec/build/cpukit/optcoverage.yml
create mode 100644 spec/build/cpukit/optcoveragecflags.yml
create mode 100644 spec/build/cpukit/optcoverageldflags.yml
create mode 100644 spec/build/cpukit/optnocoveragecflags.yml
create mode 100644 spec/build/cpukit/optnocoverageldflags.yml
--
2.35.3
More information about the devel
mailing list