test: allow multiple config options in buildconfigspec

In some cases we have alternative configuration options that supply the
same functionality, e.g CONFIG_NET and CONFIG_NET_LWIP.

Allow to specify all of them as arguments for buildconfigspec() and execute
the text if any of these is fulfilled, e.g.

    @pytest.mark.buildconfigspec('net', 'net_lwip')

Update the documentation.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Heinrich Schuchardt
2025-05-03 15:31:54 +02:00
parent 4fde49c317
commit 2bac578c5a
2 changed files with 31 additions and 3 deletions

View File

@@ -711,9 +711,13 @@ def setup_buildconfigspec(item):
"""
for options in item.iter_markers('buildconfigspec'):
option = options.args[0]
if not ubconfig.buildconfig.get('config_' + option.lower(), None):
pytest.skip('.config feature "%s" not enabled' % option.lower())
nomatch = True
for arg in options.args:
if ubconfig.buildconfig.get('config_' + arg.lower(), None):
nomatch = False
if nomatch:
argsString = ', '.join(options.args)
pytest.skip(f'.config features "{argsString}" not enabled')
for options in item.iter_markers('notbuildconfigspec'):
option = options.args[0]
if ubconfig.buildconfig.get('config_' + option.lower(), None):