Re: [PATCH v2 00/13] Support gcov instrumentation
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 *** > bmZjZyAxMkJSL3RtcC9zaC9iLXJ0ZW1zL2FybS94aWxpbnhfenlucV9hOV9xZW11L2NwdWtp > dC9saWJjc3VwcG9ydC9zcmMvX19nZXR0b2QuYy42NS5nY2RhAGFkY2cgMTJCPoT6qo6mcBUB > DOOrF1pxp0aIPrK7wAAAoQHwAQwAAADTfDdNQYCYwJ9ZRL0AAKEBIAQA > ... > srvAAAChAfD///8BDMXOxS0Rhzqx6Old2wAAoQH4AQwAAACYh8U9/rgJ5hMc > ig8AAKEB2P///wEMN3+9YAwMW8gTHIoPAAChAdj///8BDDAwMx4TuamFPrK7 > wAAAoQHwAQwAAACvassJzDNWd/lKs3wAAKEB8P///wA= > *** 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 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 +- >
[PATCH v2 00/13] Support gcov instrumentation
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 *** bmZjZyAxMkJSL3RtcC9zaC9iLXJ0ZW1zL2FybS94aWxpbnhfenlucV9hOV9xZW11L2NwdWtp dC9saWJjc3VwcG9ydC9zcmMvX19nZXR0b2QuYy42NS5nY2RhAGFkY2cgMTJCPoT6qo6mcBUB DOOrF1pxp0aIPrK7wAAAoQHwAQwAAADTfDdNQYCYwJ9ZRL0AAKEBIAQA ... srvAAAChAfD///8BDMXOxS0Rhzqx6Old2wAAoQH4AQwAAACYh8U9/rgJ5hMc ig8AAKEB2P///wEMN3+9YAwMW8gTHIoPAAChAdj///8BDDAwMx4TuamFPrK7 wAAAoQHwAQwAAACvassJzDNWd/lKs3wAAKEB8P///wA= *** 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 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 +-