@@ -371,19 +371,19 @@ class KconfigCheck(ComplianceTest):
371371 doc = "See https://docs.zephyrproject.org/latest/build/kconfig/tips.html for more details."
372372 path_hint = "<zephyr-base>"
373373
374- def run ( self , full = True , no_modules = False , filename = "Kconfig" , hwm = None ):
375- self . no_modules = no_modules
374+ # Top-level Kconfig file. The path can be relative to srctree (ZEPHYR_BASE).
375+ FILENAME = "Kconfig"
376376
377- kconf = self .parse_kconfig (filename = filename , hwm = hwm )
377+ def run (self ):
378+ kconf = self .parse_kconfig ()
378379
379380 self .check_top_menu_not_too_long (kconf )
380381 self .check_no_pointless_menuconfigs (kconf )
381382 self .check_no_undef_within_kconfig (kconf )
382383 self .check_no_redefined_in_defconfig (kconf )
383384 self .check_no_enable_in_boolean_prompt (kconf )
384385 self .check_soc_name_sync (kconf )
385- if full :
386- self .check_no_undef_outside_kconfig (kconf )
386+ self .check_no_undef_outside_kconfig (kconf )
387387
388388 def get_modules (self , modules_file , settings_file ):
389389 """
@@ -393,11 +393,6 @@ def get_modules(self, modules_file, settings_file):
393393 This is needed to complete Kconfig sanity tests.
394394
395395 """
396- if self .no_modules :
397- with open (modules_file , 'w' ) as fp_module_file :
398- fp_module_file .write ("# Empty\n " )
399- return
400-
401396 # Invoke the script directly using the Python executable since this is
402397 # not a module nor a pip-installed Python utility
403398 zephyr_module_path = os .path .join (ZEPHYR_BASE , "scripts" ,
@@ -594,7 +589,7 @@ def get_v2_model(self, kconfig_dir, settings_file):
594589 for arch in v2_archs ['archs' ]:
595590 fp .write ('source "' + (Path (arch ['path' ]) / 'Kconfig' ).as_posix () + '"\n ' )
596591
597- def parse_kconfig (self , filename = "Kconfig" , hwm = None ):
592+ def parse_kconfig (self ):
598593 """
599594 Returns a kconfiglib.Kconfig object for the Kconfig files. We reuse
600595 this object for all tests to avoid having to reparse for each test.
@@ -654,7 +649,7 @@ def parse_kconfig(self, filename="Kconfig", hwm=None):
654649 # them: so some warnings might get printed
655650 # twice. "warn_to_stderr=False" could unfortunately cause
656651 # some (other) warnings to never be printed.
657- return kconfiglib .Kconfig (filename = filename )
652+ return kconfiglib .Kconfig (filename = self . FILENAME )
658653 except kconfiglib .KconfigError as e :
659654 self .failure (str (e ))
660655 raise EndTest
@@ -1069,40 +1064,36 @@ class KconfigBasicCheck(KconfigCheck):
10691064 references inside the Kconfig tree.
10701065 """
10711066 name = "KconfigBasic"
1072- doc = "See https://docs.zephyrproject.org/latest/build/kconfig/tips.html for more details."
1073- path_hint = "<zephyr-base>"
10741067
1075- def run (self ):
1076- super ().run (full = False )
1068+ def check_no_undef_outside_kconfig (self , kconf ):
1069+ pass
1070+
10771071
1078- class KconfigBasicNoModulesCheck (KconfigCheck ):
1072+ class KconfigBasicNoModulesCheck (KconfigBasicCheck ):
10791073 """
10801074 Checks if we are introducing any new warnings/errors with Kconfig when no
10811075 modules are available. Catches symbols used in the main repository but
10821076 defined only in a module.
10831077 """
10841078 name = "KconfigBasicNoModules"
1085- doc = "See https://docs.zephyrproject.org/latest/build/kconfig/tips.html for more details."
1086- path_hint = "<zephyr-base>"
1087- def run ( self ) :
1088- super (). run ( full = False , no_modules = True )
1079+
1080+ def get_modules ( self , modules_file , settings_file ):
1081+ with open ( modules_file , 'w' ) as fp_module_file :
1082+ fp_module_file . write ( "# Empty \n " )
10891083
10901084
1091- class KconfigHWMv2Check (KconfigCheck , ComplianceTest ):
1085+ class KconfigHWMv2Check (KconfigBasicCheck ):
10921086 """
10931087 This runs the Kconfig test for board and SoC v2 scheme.
10941088 This check ensures that all symbols inside the v2 scheme is also defined
10951089 within the same tree.
10961090 This ensures the board and SoC trees are fully self-contained and reusable.
10971091 """
10981092 name = "KconfigHWMv2"
1099- doc = "See https://docs.zephyrproject.org/latest/guides/kconfig/index.html for more details."
11001093
1101- def run (self ):
1102- # Use dedicated Kconfig board / soc v2 scheme file.
1103- # This file sources only v2 scheme tree.
1104- kconfig_file = os .path .join (os .path .dirname (__file__ ), "Kconfig.board.v2" )
1105- super ().run (full = False , hwm = "v2" , filename = kconfig_file )
1094+ # Use dedicated Kconfig board / soc v2 scheme file.
1095+ # This file sources only v2 scheme tree.
1096+ FILENAME = os .path .join (os .path .dirname (__file__ ), "Kconfig.board.v2" )
11061097
11071098
11081099class Nits (ComplianceTest ):
0 commit comments