[PATCH 10/12] build: Add RTEMS_COVERAGE option

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Jun 29 06:30:46 UTC 2022


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 ++-
 9 files changed, 112 insertions(+), 2 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 8035640ae3..7d63c95d41 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: |
-    ${LIBRARY_OPTIMIZATION_FLAGS}
+    ${LIBRARY_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 9958b0bd66..58b9757f54 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:
 - ${LIBRARY_OPTIMIZATION_FLAGS}
+- ${COVERAGE_COMPILER_FLAGS}
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
 cppflags: []
 cxxflags:
 - ${LIBRARY_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..f0bdfa4ca4
--- /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_COVERAGE
+type: build
diff --git a/spec/build/cpukit/optcoveragecflags.yml b/spec/build/cpukit/optcoveragecflags.yml
new file mode 100644
index 0000000000..512eeffe56
--- /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_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..f13322cbee
--- /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_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..561a99b0d4
--- /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_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..9a32d32780
--- /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_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
-- 
2.35.3



More information about the devel mailing list