tests/kconfig_features: Add check for common variable values

This verifies that the following variables have the same value in the
Kconfig counterpart:
- BOARD
- CPU
- CPU_MODEL
- CPU_FAM
- CPU_CORE
- CPU_ARCH
This commit is contained in:
Leandro Lanzieri 2020-06-18 15:16:35 +02:00
parent 2bdf9b16ee
commit 03ee4617e2
No known key found for this signature in database
GPG Key ID: 13559905E2EBEAA5
2 changed files with 15 additions and 1 deletions

View File

@ -12,11 +12,22 @@ BOARD_WHITELIST += arduino-duemilanove \
samr21-xpro samr21-xpro
all: kconfig-features all: checks
include $(RIOTBASE)/Makefile.include include $(RIOTBASE)/Makefile.include
# List of variables to compare between Makefile and Kconfig
_VARS_TO_CHECK = BOARD CPU CPU_MODEL CPU_FAM CPU_CORE CPU_ARCH
# Only compare variables that have a value in Makefile
checks: kconfig-features $(foreach v,$(_VARS_TO_CHECK), $(if $($(v)),check-value-$(v)))
kconfig-features: $(KCONFIG_OUT_CONFIG) kconfig-features: $(KCONFIG_OUT_CONFIG)
@bash -c 'diff <($(MAKE) info-features-provided) \ @bash -c 'diff <($(MAKE) info-features-provided) \
<($(MAKE) dependency-debug-features-provided-kconfig) || \ <($(MAKE) dependency-debug-features-provided-kconfig) || \
(echo "ERROR: Kconfig features mismatch" && exit 1)' (echo "ERROR: Kconfig features mismatch" && exit 1)'
check-value-%: $(KCONFIG_OUT_CONFIG)
@bash -c '(diff <($(MAKE) info-debug-variable-$*) \
<($(MAKE) info-debug-variable-CONFIG_$*) && echo "SUCCESS: $* values match") || \
(echo "ERROR: The value for $* in Kconfig does not match the one in the Makefile" && exit 1)'

View File

@ -4,6 +4,9 @@ The objective of this test is to control the synchronization of features
provided by boards via `Makefile.features` and `Kconfig` files during the provided by boards via `Makefile.features` and `Kconfig` files during the
migration process. migration process.
It also checks that multiple common variables (e.g. CPU_MODEL) have the same
value in the Makefiles and in Kconfig.
The test checks during compilation that both lists of features provided by The test checks during compilation that both lists of features provided by
the board match. The `BOARD_WHITELIST` is used to test only the boards that have the board match. The `BOARD_WHITELIST` is used to test only the boards that have
their features modelled in Kconfig. their features modelled in Kconfig.