@@ -229,8 +229,8 @@ class KconfigCheck(ComplianceTest):
229229 doc = "See https://docs.zephyrproject.org/latest/guides/kconfig/index.html for more details."
230230 path_hint = ZEPHYR_BASE
231231
232- def run (self , full = True ):
233- kconf = self .parse_kconfig ()
232+ def run (self , full = True , board_scheme = "v*" , filename = "Kconfig" ):
233+ kconf = self .parse_kconfig (board_scheme = board_scheme , filename = filename )
234234
235235 self .check_top_menu_not_too_long (kconf )
236236 self .check_no_pointless_menuconfigs (kconf )
@@ -294,7 +294,7 @@ def get_kconfig_dts(self, kconfig_dts_file):
294294 self .error (ex .output )
295295
296296
297- def parse_kconfig (self ):
297+ def parse_kconfig (self , board_scheme = "v*" , filename = "Kconfig" ):
298298 """
299299 Returns a kconfiglib.Kconfig object for the Kconfig files. We reuse
300300 this object for all tests to avoid having to reparse for each test.
@@ -321,6 +321,8 @@ def parse_kconfig(self):
321321 os .environ ["SOC_DIR" ] = "soc/"
322322 os .environ ["ARCH_DIR" ] = "arch/"
323323 os .environ ["BOARD_DIR" ] = "boards/*/*"
324+ os .environ ["BOARD_SCHEME" ] = board_scheme
325+ os .environ ["BOARD" ] = "*"
324326 os .environ ["ARCH" ] = "*"
325327 os .environ ["KCONFIG_BINARY_DIR" ] = tempfile .gettempdir ()
326328 os .environ ['DEVICETREE_CONF' ] = "dummy"
@@ -345,7 +347,7 @@ def parse_kconfig(self):
345347 # them: so some warnings might get printed
346348 # twice. "warn_to_stderr=False" could unfortunately cause
347349 # some (other) warnings to never be printed.
348- return kconfiglib .Kconfig ()
350+ return kconfiglib .Kconfig (filename = filename )
349351 except kconfiglib .KconfigError as e :
350352 self .add_failure (str (e ))
351353 raise EndTest
@@ -632,6 +634,24 @@ def run(self):
632634 super ().run (full = False )
633635
634636
637+ class KconfigBoardV2Check (KconfigCheck , ComplianceTest ):
638+ """
639+ This runs the Kconfig test for board and SoC v2 scheme.
640+ This check ensures that all symbols inside the v2 scheme is also defined
641+ within the same tree.
642+ This ensures the board and SoC trees are fully self-contained and reusable.
643+ """
644+ name = "KconfigBoardV2"
645+ doc = "See https://docs.zephyrproject.org/latest/guides/kconfig/index.html for more details."
646+ path_hint = ZEPHYR_BASE
647+
648+ def run (self ):
649+ # Use dedicated Kconfig board / soc v2 scheme file.
650+ # This file sources only v2 scheme tree.
651+ kconfig_file = os .path .join (os .path .dirname (__file__ ), "Kconfig.board.v2" )
652+ super ().run (full = False , board_scheme = "v2" , filename = kconfig_file )
653+
654+
635655class Codeowners (ComplianceTest ):
636656 """
637657 Check if added files have an owner.
0 commit comments