From 5c13a96f367564678b2759d8a89744340bb6099d Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 27 Jun 2022 17:29:25 +0200 Subject: build: Add RTEMS_GCOV_COVERAGE option Update #4670. --- spec/build/bsps/optcflags.yml | 2 +- spec/build/cpukit/cpuopts.yml | 10 ++++++++++ spec/build/cpukit/grp.yml | 2 ++ 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/testsuites/grp.yml | 3 ++- testsuites/validation/tc-terminate.c | 2 +- testsuites/validation/ts-config.h | 2 +- 11 files changed, 114 insertions(+), 4 deletions(-) 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 diff --git a/spec/build/bsps/optcflags.yml b/spec/build/bsps/optcflags.yml index ef03940bff..302f1723a6 100644 --- a/spec/build/bsps/optcflags.yml +++ b/spec/build/bsps/optcflags.yml @@ -1,7 +1,7 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause actions: - set-value: | - ${BSP_OPTIMIZATION_FLAGS} + ${BSP_OPTIMIZATION_FLAGS} ${COVERAGE_COMPILER_FLAGS} - substitute: null - split: null - env-assign: null diff --git a/spec/build/cpukit/cpuopts.yml b/spec/build/cpukit/cpuopts.yml index 301d49ccea..86cc7f676a 100644 --- a/spec/build/cpukit/cpuopts.yml +++ b/spec/build/cpukit/cpuopts.yml @@ -67,6 +67,16 @@ links: uid: optszoff - role: build-dependency uid: optsztime +- role: build-dependency + uid: optcoverage +- role: build-dependency + uid: optcoveragecflags +- role: build-dependency + uid: optnocoveragecflags +- role: build-dependency + uid: optcoverageldflags +- role: build-dependency + uid: optnocoverageldflags - role: build-dependency uid: optversion target: cpukit/include/rtems/score/cpuopts.h diff --git a/spec/build/cpukit/grp.yml b/spec/build/cpukit/grp.yml index ec9cab2167..76e57aed96 100644 --- a/spec/build/cpukit/grp.yml +++ b/spec/build/cpukit/grp.yml @@ -2,11 +2,13 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause build-type: group cflags: - ${CPUKIT_OPTIMIZATION_FLAGS} +- ${COVERAGE_COMPILER_FLAGS} copyrights: - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) cppflags: [] cxxflags: - ${CPUKIT_OPTIMIZATION_FLAGS} +- ${COVERAGE_COMPILER_FLAGS} enabled-by: true includes: [] install: [] diff --git a/spec/build/cpukit/optcoverage.yml b/spec/build/cpukit/optcoverage.yml new file mode 100644 index 0000000000..7c7013fe43 --- /dev/null +++ b/spec/build/cpukit/optcoverage.yml @@ -0,0 +1,16 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-boolean: null +- env-enable: null +- define-condition: null +build-type: option +copyrights: +- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) +default: false +default-by-variant: [] +description: | + Enable the code and branch coverage support. +enabled-by: true +links: [] +name: RTEMS_GCOV_COVERAGE +type: build diff --git a/spec/build/cpukit/optcoveragecflags.yml b/spec/build/cpukit/optcoveragecflags.yml new file mode 100644 index 0000000000..08cc79eb6c --- /dev/null +++ b/spec/build/cpukit/optcoveragecflags.yml @@ -0,0 +1,20 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-string: null +- split: null +- env-assign: null +build-type: option +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +default: +- --coverage +- -fprofile-info-section=.rtemsroset.gcov_info.content +- -fprofile-update=atomic +default-by-variant: [] +description: | + Compiler flags recommended for components which should generate coverage + information. +enabled-by: RTEMS_GCOV_COVERAGE +links: [] +name: COVERAGE_COMPILER_FLAGS +type: build diff --git a/spec/build/cpukit/optcoverageldflags.yml b/spec/build/cpukit/optcoverageldflags.yml new file mode 100644 index 0000000000..600c89e770 --- /dev/null +++ b/spec/build/cpukit/optcoverageldflags.yml @@ -0,0 +1,25 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-string: null +- split: null +- env-assign: null +build-type: option +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +default: +- -Wl,--wrap=_CPU_Fatal_halt +- -Wl,--wrap=bsp_reset +- -Wl,--start-group +- -lrtemsbsp +- -lrtemscpu +- -lrtemstest +- -lgcov +- -Wl,--end-group +default-by-variant: [] +description: | + Linker flags recommended for executables which contain modules with coverage + information. +enabled-by: RTEMS_GCOV_COVERAGE +links: [] +name: COVERAGE_LINKER_FLAGS +type: build diff --git a/spec/build/cpukit/optnocoveragecflags.yml b/spec/build/cpukit/optnocoveragecflags.yml new file mode 100644 index 0000000000..4cdb245f3e --- /dev/null +++ b/spec/build/cpukit/optnocoveragecflags.yml @@ -0,0 +1,18 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-string: null +- split: null +- env-assign: null +build-type: option +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +default: [] +default-by-variant: [] +description: | + Compiler flags recommended for components which should generate coverage + information. +enabled-by: + not: RTEMS_GCOV_COVERAGE +links: [] +name: COVERAGE_COMPILER_FLAGS +type: build diff --git a/spec/build/cpukit/optnocoverageldflags.yml b/spec/build/cpukit/optnocoverageldflags.yml new file mode 100644 index 0000000000..247b171d26 --- /dev/null +++ b/spec/build/cpukit/optnocoverageldflags.yml @@ -0,0 +1,18 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-string: null +- split: null +- env-assign: null +build-type: option +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +default: [] +default-by-variant: [] +description: | + Linker flags recommended for executables which contain modules which generate + coverage information. +enabled-by: + not: RTEMS_GCOV_COVERAGE +links: [] +name: COVERAGE_LINKER_FLAGS +type: build diff --git a/spec/build/testsuites/grp.yml b/spec/build/testsuites/grp.yml index 18c8ccd4d8..cb06fd6ae7 100644 --- a/spec/build/testsuites/grp.yml +++ b/spec/build/testsuites/grp.yml @@ -11,7 +11,8 @@ enabled-by: true includes: - ${BSP_INCLUDES} install: [] -ldflags: [] +ldflags: +- ${COVERAGE_LINKER_FLAGS} links: - role: build-dependency uid: optada diff --git a/testsuites/validation/tc-terminate.c b/testsuites/validation/tc-terminate.c index 79060930d7..7eeaa9e3ea 100644 --- a/testsuites/validation/tc-terminate.c +++ b/testsuites/validation/tc-terminate.c @@ -150,7 +150,7 @@ void __wrap__CPU_Fatal_halt( uint32_t source, CPU_Uint32ptr code ) halt_code = code; longjmp( before_terminate, 1 ); } else { -#if defined(RTEMS_COVERAGE) +#if defined(RTEMS_GCOV_COVERAGE) rtems_test_gcov_dump_info(); #endif __real__CPU_Fatal_halt( source, code ); diff --git a/testsuites/validation/ts-config.h b/testsuites/validation/ts-config.h index ecdd3b8f8d..7685fee278 100644 --- a/testsuites/validation/ts-config.h +++ b/testsuites/validation/ts-config.h @@ -65,7 +65,7 @@ extern "C" { #define TEST_SCHEDULER_D_NAME rtems_build_name( 'D', ' ', ' ', ' ' ) -#if defined( __OPTIMIZE__ ) && !defined( RTEMS_COVERAGE ) +#if defined( __OPTIMIZE__ ) && !defined( RTEMS_GCOV_COVERAGE ) #define TEST_BASE_STACK_SIZE RTEMS_MINIMUM_STACK_SIZE #else #define TEST_BASE_STACK_SIZE ( 4 * RTEMS_MINIMUM_STACK_SIZE ) -- cgit v1.2.3