|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v3 3/3] xen: debug: gcov: add condition coverage support
Condition coverage, also known as MC/DC (modified condition/decision
coverage) is a coverage metric that tracks separate outcomes in
boolean expressions.
This patch adds CONFIG_CONDITION_COVERAGE option to enable MC/DC for
GCC. Clang is not supported right now.
Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
---
Changes in v3:
- Introduced CC_HAS_MCDC that checks if compiler supports
required feature
Changes in v2:
- Move gcc version check from .c file to Rules.mk (I can't find
an easy way to check GCC version at Kconfig level)
- Check for gcc 14, not gcc 14.1
---
xen/Kconfig | 5 +++++
xen/Kconfig.debug | 9 +++++++++
xen/Rules.mk | 3 +++
3 files changed, 17 insertions(+)
diff --git a/xen/Kconfig b/xen/Kconfig
index 2128f0ccfc..2bdebfc808 100644
--- a/xen/Kconfig
+++ b/xen/Kconfig
@@ -41,6 +41,11 @@ config CC_SPLIT_SECTIONS
config CC_HAS_UBSAN
def_bool $(cc-option,-fsanitize=undefined)
+# Compiler supports -fcondition-coverage aka MC/DC
+config CC_HAS_MCDC
+ def_bool $(cc-option,-fcondition-coverage)
+
+
# Set code alignment.
#
# Allow setting on a boolean basis, and then convert such selection to an
diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index f7cc5ffaab..f89cbd823b 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -44,6 +44,15 @@ config COVERAGE
If unsure, say N here.
+config CONDITION_COVERAGE
+ bool "Condition coverage support"
+ depends on COVERAGE && CC_HAS_MCDC
+ help
+ Enable condition coverage support. Used for collecting MC/DC
+ (Modified Condition/Decision Coverage) metrics.
+
+ If unsure, say N here.
+
config DEBUG_LOCK_PROFILE
bool "Lock Profiling"
select DEBUG_LOCKS
diff --git a/xen/Rules.mk b/xen/Rules.mk
index d759cccee3..0a2933cffa 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -138,6 +138,9 @@ ifeq ($(CONFIG_CC_IS_CLANG),y)
COV_FLAGS := -fprofile-instr-generate -fcoverage-mapping
else
COV_FLAGS := -fprofile-arcs -ftest-coverage
+ifeq ($(CONFIG_CONDITION_COVERAGE),y)
+ COV_FLAGS += -fcondition-coverage
+endif
endif
# Reset COV_FLAGS in cases where an objects has another one as prerequisite
--
2.48.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |