aboutsummaryrefslogtreecommitdiff
path: root/test/py/conftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-03-18 09:43:01 -0600
committerTom Rini <trini@konsulko.com>2020-04-10 21:36:36 -0400
commitf5ec7eebf774456f0c24fc5eae6d0421e353bea6 (patch)
tree3d81420841fe8f863afdf46ce41363efba8ffd32 /test/py/conftest.py
parent7ec1255ceacea72e813d5ea9a6a8c940716b147b (diff)
downloadu-boot-f5ec7eebf774456f0c24fc5eae6d0421e353bea6.zip
u-boot-f5ec7eebf774456f0c24fc5eae6d0421e353bea6.tar.gz
u-boot-f5ec7eebf774456f0c24fc5eae6d0421e353bea6.tar.bz2
test/py: Allow using buildman to build U-Boot
It is a pain to have to set the CROSS_COMPILE environment variable when using test.py's --build option. It is possible to get this using the -A option from buildman. But it seems better to just use buildman to do the build when it is available. However using buildman adds a new dependency to the test system which we want to avoid. So leave the default as is and add a flag to make it use buildman. Note that most of these changes relate to test.py and the parts of the travis/gitlab/azure scripts which relate to running test and building a suitable U-Boot to run the tests on. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'test/py/conftest.py')
-rw-r--r--test/py/conftest.py30
1 files changed, 21 insertions, 9 deletions
diff --git a/test/py/conftest.py b/test/py/conftest.py
index 34ac4fb..e3392ff 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -70,6 +70,8 @@ def pytest_addoption(parser):
help='U-Boot board identity/instance')
parser.addoption('--build', default=False, action='store_true',
help='Compile U-Boot before running tests')
+ parser.addoption('--buildman', default=False, action='store_true',
+ help='Use buildman to build U-Boot (assuming --build is given)')
parser.addoption('--gdbserver', default=None,
help='Run sandbox under gdbserver. The argument is the channel '+
'over which gdbserver should communicate, e.g. localhost:1234')
@@ -140,16 +142,26 @@ def pytest_configure(config):
log = multiplexed_log.Logfile(result_dir + '/test-log.html')
if config.getoption('build'):
- if build_dir != source_dir:
- o_opt = 'O=%s' % build_dir
+ if config.getoption('buildman'):
+ if build_dir != source_dir:
+ dest_args = ['-o', build_dir, '-w']
+ else:
+ dest_args = ['-i']
+ cmds = (['buildman', '--board', board_type] + dest_args,)
+ name = 'buildman'
else:
- o_opt = ''
- cmds = (
- ['make', o_opt, '-s', board_type + '_defconfig'],
- ['make', o_opt, '-s', '-j8'],
- )
- with log.section('make'):
- runner = log.get_runner('make', sys.stdout)
+ if build_dir != source_dir:
+ o_opt = 'O=%s' % build_dir
+ else:
+ o_opt = ''
+ cmds = (
+ ['make', o_opt, '-s', board_type + '_defconfig'],
+ ['make', o_opt, '-s', '-j8'],
+ )
+ name = 'make'
+
+ with log.section(name):
+ runner = log.get_runner(name, sys.stdout)
for cmd in cmds:
runner.run(cmd, cwd=source_dir)
runner.close()