mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-14 00:47:26 +00:00
test.py: Make search for autoconf.mk more permissive
Buildman doesn't store this file in the same directory as a normal build. Update the conftest code to handle both cases. Change-Id: I1fd0e56054d7dc77394a7589336aa0991bd0133d Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
4251fbc6fb
commit
cb10579484
1 changed files with 27 additions and 12 deletions
|
@ -83,6 +83,26 @@ def pytest_configure(config):
|
||||||
Returns:
|
Returns:
|
||||||
Nothing.
|
Nothing.
|
||||||
"""
|
"""
|
||||||
|
def parse_config(conf_file):
|
||||||
|
"""Parse a config file, loading it into the ubconfig container
|
||||||
|
|
||||||
|
Args:
|
||||||
|
conf_file: Filename to load (within build_dir)
|
||||||
|
|
||||||
|
Raises
|
||||||
|
Exception if the file does not exist
|
||||||
|
"""
|
||||||
|
dot_config = build_dir + '/' + conf_file
|
||||||
|
if not os.path.exists(dot_config):
|
||||||
|
raise Exception(conf_file + ' does not exist; ' +
|
||||||
|
'try passing --build option?')
|
||||||
|
|
||||||
|
with open(dot_config, 'rt') as f:
|
||||||
|
ini_str = '[root]\n' + f.read()
|
||||||
|
ini_sio = io.StringIO(ini_str)
|
||||||
|
parser = configparser.RawConfigParser()
|
||||||
|
parser.read_file(ini_sio)
|
||||||
|
ubconfig.buildconfig.update(parser.items('root'))
|
||||||
|
|
||||||
global log
|
global log
|
||||||
global console
|
global console
|
||||||
|
@ -157,18 +177,13 @@ def pytest_configure(config):
|
||||||
|
|
||||||
ubconfig.buildconfig = dict()
|
ubconfig.buildconfig = dict()
|
||||||
|
|
||||||
for conf_file in ('.config', 'include/autoconf.mk'):
|
# buildman -k puts autoconf.mk in the rootdir, so handle this as well
|
||||||
dot_config = build_dir + '/' + conf_file
|
# as the standard U-Boot build which leaves it in include/autoconf.mk
|
||||||
if not os.path.exists(dot_config):
|
parse_config('.config')
|
||||||
raise Exception(conf_file + ' does not exist; ' +
|
if os.path.exists(build_dir + '/' + 'autoconf.mk'):
|
||||||
'try passing --build option?')
|
parse_config('autoconf.mk')
|
||||||
|
else:
|
||||||
with open(dot_config, 'rt') as f:
|
parse_config('include/autoconf.mk')
|
||||||
ini_str = '[root]\n' + f.read()
|
|
||||||
ini_sio = io.StringIO(ini_str)
|
|
||||||
parser = configparser.RawConfigParser()
|
|
||||||
parser.read_file(ini_sio)
|
|
||||||
ubconfig.buildconfig.update(parser.items('root'))
|
|
||||||
|
|
||||||
ubconfig.test_py_dir = test_py_dir
|
ubconfig.test_py_dir = test_py_dir
|
||||||
ubconfig.source_dir = source_dir
|
ubconfig.source_dir = source_dir
|
||||||
|
|
Loading…
Reference in a new issue