Skip to content

Commit c44895b

Browse files
dlatypovshuahkh
authored andcommitted
kunit: tool: revamp message for invalid kunitconfig
The current error message is precise, but not very clear if you don't already know what it's talking about, e.g. > $ make ARCH=um olddefconfig O=.kunit > ERROR:root:Provided Kconfig is not contained in validated .config. Following fields found in kunitconfig, but not in .config: CONFIG_DRM=y Try to reword the error message so that it's * your missing options usually have unsatisified dependencies * if you're on UML, that might be the cause (it is, in this example) Signed-off-by: Daniel Latypov <[email protected]> Reviewed-by: David Gow <[email protected]> Reviewed-by: Brendan Higgins <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 9f57cc7 commit c44895b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

tools/testing/kunit/kunit_kernel.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,17 @@ def clean(self) -> bool:
266266
def validate_config(self, build_dir) -> bool:
267267
kconfig_path = get_kconfig_path(build_dir)
268268
validated_kconfig = kunit_config.parse_file(kconfig_path)
269-
if not self._kconfig.is_subset_of(validated_kconfig):
270-
invalid = self._kconfig.entries() - validated_kconfig.entries()
271-
message = 'Provided Kconfig is not contained in validated .config. Following fields found in kunitconfig, ' \
272-
'but not in .config: %s' % (
273-
', '.join([str(e) for e in invalid])
274-
)
275-
logging.error(message)
276-
return False
277-
return True
269+
if self._kconfig.is_subset_of(validated_kconfig):
270+
return True
271+
invalid = self._kconfig.entries() - validated_kconfig.entries()
272+
message = 'Not all Kconfig options selected in kunitconfig were in the generated .config.\n' \
273+
'This is probably due to unsatisfied dependencies.\n' \
274+
'Missing: ' + ', '.join([str(e) for e in invalid])
275+
if self._arch == 'um':
276+
message += '\nNote: many Kconfig options aren\'t available on UML. You can try running ' \
277+
'on a different architecture with something like "--arch=x86_64".'
278+
logging.error(message)
279+
return False
278280

279281
def build_config(self, build_dir, make_options) -> bool:
280282
kconfig_path = get_kconfig_path(build_dir)

0 commit comments

Comments
 (0)