build: Add RTEMS_GCOV_COVERAGE option

Update #4670.
This commit is contained in:
Sebastian Huber
2022-06-27 17:29:25 +02:00
parent 7452f67dd9
commit 5c13a96f36
11 changed files with 114 additions and 4 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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: []

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -11,7 +11,8 @@ enabled-by: true
includes:
- ${BSP_INCLUDES}
install: []
ldflags: []
ldflags:
- ${COVERAGE_LINKER_FLAGS}
links:
- role: build-dependency
uid: optada

View File

@@ -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 );

View File

@@ -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 )