[PATCH v2 00/13] Support gcov instrumentation

Chris Johns chrisj at rtems.org
Mon Jul 4 01:53:37 UTC 2022


OK

Thanks
Chris

On 1/7/2022 9:49 pm, Sebastian Huber wrote:
> 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
> BSP_OPTIMIZATION_FLAGS, CPUKIT_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)
> 
> v2:
> 
> * Rename RTEMS_COVERAGE in RTEMS_GCOV_COVERAGE
> 
> * Add <rtems/score/gcov.h> and provide gcov_info linker set in separate file.
> 
> * Split LIBRARY_OPTIMIZATION_FLAGS in BSP_OPTIMIZATION_FLAGS and
>   CPUKIT_OPTIMIZATION_FLAGS.
> 
> Sebastian Huber (13):
>   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: Fix optimization flags definition order
>   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_GCOV_COVERAGE option
>   samples/minimum: Prevent a stack overflow
>   libtests/crypt01: Avoid stack overflows
> 
>  cpukit/include/rtems/score/gcov.h             |  66 ++++++++++
>  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/gcovinfoset.c                |  42 ++++++
>  cpukit/score/src/iogcovdumpinfo.c             |  97 ++++++++++++++
>  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/bspboardorig.yml   |   4 +-
>  spec/build/bsps/arm/beagle/bspboardxm.yml     |   4 +-
>  spec/build/bsps/arm/beagle/bspboneblack.yml   |   4 +-
>  spec/build/bsps/arm/beagle/bspbonewhite.yml   |   4 +-
>  spec/build/bsps/arm/beagle/grp.yml            |   3 +
>  spec/build/bsps/arm/csb337/bspcsb337.yml      |   4 +-
>  spec/build/bsps/arm/csb337/bspcsb637.yml      |   4 +-
>  spec/build/bsps/arm/csb337/bspkit637v6.yml    |   4 +-
>  spec/build/bsps/arm/csb337/grp.yml            |   3 +
>  spec/build/bsps/arm/fvp/bspcortexr52.yml      |   4 +-
>  spec/build/bsps/arm/fvp/grp.yml               |   3 +
>  spec/build/bsps/arm/grp.yml                   |   3 +
>  spec/build/bsps/arm/lm3s69xx/bsplm3s3749.yml  |   4 +-
>  spec/build/bsps/arm/lm3s69xx/bsplm3s6965.yml  |   4 +-
>  spec/build/bsps/arm/lm3s69xx/bsplm4f120.yml   |   4 +-
>  spec/build/bsps/arm/lm3s69xx/bspqemu.yml      |   4 +-
>  spec/build/bsps/arm/lm3s69xx/grp.yml          |   3 +
>  .../build/bsps/arm/lpc176x/bsplpc1768mbed.yml |   4 +-
>  .../bsps/arm/lpc176x/bsplpc1768mbedahbram.yml |   4 +-
>  .../arm/lpc176x/bsplpc1768mbedahbrameth.yml   |   4 +-
>  spec/build/bsps/arm/lpc176x/grp.yml           |   3 +
>  .../bsps/arm/lpc24xx/bsplpc17xxearam.yml      |   4 +-
>  .../bsps/arm/lpc24xx/bsplpc17xxearomint.yml   |   4 +-
>  .../bsps/arm/lpc24xx/bsplpc17xxplx800ram.yml  |   4 +-
>  .../arm/lpc24xx/bsplpc17xxplx800romint.yml    |   4 +-
>  spec/build/bsps/arm/lpc24xx/bsplpc2362.yml    |   4 +-
>  .../bsps/arm/lpc24xx/bsplpc23xxtli800.yml     |   4 +-
>  spec/build/bsps/arm/lpc24xx/bsplpc24xxea.yml  |   4 +-
>  .../bsps/arm/lpc24xx/bsplpc40xxearam.yml      |   4 +-
>  .../bsps/arm/lpc24xx/bsplpc40xxearomint.yml   |   4 +-
>  spec/build/bsps/arm/lpc24xx/bspncsram.yml     |   4 +-
>  spec/build/bsps/arm/lpc24xx/bspncsromext.yml  |   4 +-
>  spec/build/bsps/arm/lpc24xx/bspncsromint.yml  |   4 +-
>  spec/build/bsps/arm/lpc24xx/bspplx800ram.yml  |   4 +-
>  .../bsps/arm/lpc24xx/bspplx800romint.yml      |   4 +-
>  spec/build/bsps/arm/lpc24xx/grp.yml           |   3 +
>  spec/build/bsps/arm/lpc32xx/bsplpc32xxmzx.yml |   4 +-
>  spec/build/bsps/arm/lpc32xx/bspmzxstage1.yml  |   4 +-
>  spec/build/bsps/arm/lpc32xx/bspmzxstage2.yml  |   4 +-
>  spec/build/bsps/arm/lpc32xx/bspphycore.yml    |   4 +-
>  spec/build/bsps/arm/lpc32xx/grp.yml           |   3 +
>  .../bsps/arm/raspberrypi/bspraspberrypi.yml   |   4 +-
>  .../bsps/arm/raspberrypi/bspraspberrypi2.yml  |   4 +-
>  spec/build/bsps/arm/raspberrypi/grp.yml       |   3 +
>  spec/build/bsps/arm/rtl22xx/bsprtl22xx.yml    |   4 +-
>  spec/build/bsps/arm/rtl22xx/bsprtl22xxt.yml   |   4 +-
>  spec/build/bsps/arm/rtl22xx/grp.yml           |   3 +
>  .../build/bsps/arm/stm32f4/bspstm32f105rc.yml |   4 +-
>  spec/build/bsps/arm/stm32f4/bspstm32f4.yml    |   4 +-
>  spec/build/bsps/arm/stm32f4/grp.yml           |   3 +
>  spec/build/bsps/arm/stm32h7/grp.yml           |   3 +
>  spec/build/bsps/arm/tms570/bspls3137hdk.yml   |   4 +-
>  .../bsps/arm/tms570/bspls3137hdkintram.yml    |   4 +-
>  .../bsps/arm/tms570/bspls3137hdksdram.yml     |   4 +-
>  .../arm/tms570/bspls3137hdkwithloader.yml     |   4 +-
>  spec/build/bsps/arm/tms570/grp.yml            |   3 +
>  spec/build/bsps/arm/xilinx-zynq/bspqemu.yml   |   4 +-
>  spec/build/bsps/arm/xilinx-zynq/bspzc702.yml  |   4 +-
>  spec/build/bsps/arm/xilinx-zynq/bspzc706.yml  |   4 +-
>  .../bsps/arm/xilinx-zynq/bspzedboard.yml      |   4 +-
>  spec/build/bsps/arm/xilinx-zynq/grp.yml       |   3 +
>  spec/build/bsps/bfin/grp.yml                  |   3 +
>  spec/build/bsps/bspopts.yml                   |   8 ++
>  spec/build/bsps/grpmake.yml                   |   3 +
>  spec/build/bsps/i386/grp.yml                  |   3 +
>  spec/build/bsps/i386/pc386/bsppc386.yml       |   4 +-
>  spec/build/bsps/i386/pc386/bsppc486.yml       |   4 +-
>  spec/build/bsps/i386/pc386/bsppc586.yml       |   4 +-
>  spec/build/bsps/i386/pc386/bsppc586sse.yml    |   4 +-
>  spec/build/bsps/i386/pc386/bsppc686.yml       |   4 +-
>  spec/build/bsps/i386/pc386/bsppcp4.yml        |   4 +-
>  spec/build/bsps/i386/pc386/grp.yml            |   3 +
>  spec/build/bsps/lm32/grp.yml                  |   3 +
>  spec/build/bsps/lm32/lm32_evr/bspgdbsim.yml   |   4 +-
>  spec/build/bsps/lm32/lm32_evr/bsplm32evr.yml  |   4 +-
>  spec/build/bsps/lm32/lm32_evr/grp.yml         |   3 +
>  spec/build/bsps/m68k/gen68360/bspgen68360.yml |   4 +-
>  .../bsps/m68k/gen68360/bspgen68360040.yml     |   4 +-
>  spec/build/bsps/m68k/gen68360/bsppgh360.yml   |   4 +-
>  spec/build/bsps/m68k/gen68360/grp.yml         |   3 +
>  .../bsps/m68k/genmcf548x/bspcobra5475.yml     |   4 +-
>  .../m68k/genmcf548x/bspm5484fireengine.yml    |   4 +-
>  spec/build/bsps/m68k/genmcf548x/grp.yml       |   3 +
>  spec/build/bsps/m68k/grp.yml                  |   3 +
>  spec/build/bsps/m68k/mvme162/bspmvme162.yml   |   4 +-
>  spec/build/bsps/m68k/mvme162/bspmvme162lx.yml |   4 +-
>  spec/build/bsps/m68k/mvme162/grp.yml          |   3 +
>  spec/build/bsps/microblaze/grp.yml            |   3 +
>  .../microblaze/microblaze_fpga/bspkcu105.yml  |   4 +-
>  .../microblaze_fpga/bspkcu105_qemu.yml        |   4 +-
>  .../bsps/microblaze/microblaze_fpga/grp.yml   |   3 +
>  spec/build/bsps/mips/grp.yml                  |   3 +
>  spec/build/bsps/optbspoptflags.yml            |  18 +++
>  spec/build/bsps/optcflags.yml                 |  17 +++
>  spec/build/bsps/optcpukitoptflags.yml         |  18 +++
>  spec/build/bsps/optincludes.yml               |   1 +
>  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             |   4 +
>  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          |   5 +-
>  testsuites/validation/ts-config.h             |   2 +-
>  wscript                                       | 120 +++++++++++++-----
>  168 files changed, 1241 insertions(+), 182 deletions(-)
>  create mode 100644 cpukit/include/rtems/score/gcov.h
>  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/gcovinfoset.c
>  create mode 100644 cpukit/score/src/iogcovdumpinfo.c
>  create mode 100644 cpukit/score/src/iogcovdumpinfobase64.c
>  create mode 100644 spec/build/bsps/optbspoptflags.yml
>  create mode 100644 spec/build/bsps/optcflags.yml
>  create mode 100644 spec/build/bsps/optcpukitoptflags.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
> 


More information about the devel mailing list