2019-10-31 13:42:53 +00:00
|
|
|
#!/usr/bin/env python3
|
2018-05-06 21:58:06 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
2013-04-03 11:07:16 +00:00
|
|
|
#
|
|
|
|
# Copyright (c) 2012 The Chromium OS Authors.
|
|
|
|
#
|
|
|
|
|
|
|
|
"""See README for more information"""
|
|
|
|
|
2020-04-18 00:09:02 +00:00
|
|
|
import doctest
|
2013-04-03 11:07:16 +00:00
|
|
|
import multiprocessing
|
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import sys
|
|
|
|
|
|
|
|
# Bring in the patman libraries
|
|
|
|
our_path = os.path.dirname(os.path.realpath(__file__))
|
2020-04-18 00:09:02 +00:00
|
|
|
sys.path.insert(1, os.path.join(our_path, '..'))
|
2013-04-03 11:07:16 +00:00
|
|
|
|
|
|
|
# Our modules
|
2020-04-18 00:09:02 +00:00
|
|
|
from buildman import board
|
|
|
|
from buildman import bsettings
|
|
|
|
from buildman import builder
|
|
|
|
from buildman import cmdline
|
|
|
|
from buildman import control
|
|
|
|
from buildman import toolchain
|
2020-04-18 00:09:04 +00:00
|
|
|
from patman import patchstream
|
|
|
|
from patman import gitutil
|
|
|
|
from patman import terminal
|
2022-01-22 12:07:30 +00:00
|
|
|
from patman import test_util
|
2013-04-03 11:07:16 +00:00
|
|
|
|
2022-01-22 12:07:30 +00:00
|
|
|
def RunTests(skip_net_tests, verboose, args):
|
2022-02-11 20:23:19 +00:00
|
|
|
from buildman import func_test
|
|
|
|
from buildman import test
|
2013-09-23 23:35:17 +00:00
|
|
|
import doctest
|
|
|
|
|
2022-01-22 12:07:30 +00:00
|
|
|
test_name = args and args[0] or None
|
2017-11-13 04:52:14 +00:00
|
|
|
if skip_net_tests:
|
|
|
|
test.use_network = False
|
2013-04-03 11:07:16 +00:00
|
|
|
|
2022-01-22 12:07:30 +00:00
|
|
|
# Run the entry tests first ,since these need to be the first to import the
|
|
|
|
# 'entry' module.
|
2022-04-02 17:06:06 +00:00
|
|
|
result = test_util.run_test_suites(
|
|
|
|
'buildman', False, verboose, False, None, test_name, [],
|
2022-01-22 12:07:30 +00:00
|
|
|
[test.TestBuild, func_test.TestFunctional,
|
|
|
|
'buildman.toolchain', 'patman.gitutil'])
|
2013-04-03 11:07:16 +00:00
|
|
|
|
2022-04-02 17:06:06 +00:00
|
|
|
return (0 if result.wasSuccessful() else 1)
|
2013-04-03 11:07:16 +00:00
|
|
|
|
2014-09-06 01:00:10 +00:00
|
|
|
options, args = cmdline.ParseArgs()
|
2013-04-03 11:07:16 +00:00
|
|
|
|
2022-01-22 12:07:29 +00:00
|
|
|
if not options.debug:
|
|
|
|
sys.tracebacklimit = 0
|
|
|
|
|
2013-04-03 11:07:16 +00:00
|
|
|
# Run our meagre tests
|
|
|
|
if options.test:
|
2022-01-22 12:07:30 +00:00
|
|
|
RunTests(options.skip_net_tests, options.verbose, args)
|
2013-04-03 11:07:16 +00:00
|
|
|
|
|
|
|
# Build selected commits for selected boards
|
|
|
|
else:
|
2014-09-06 01:00:14 +00:00
|
|
|
bsettings.Setup(options.config_file)
|
2014-08-28 15:43:39 +00:00
|
|
|
ret_code = control.DoBuildman(options, args)
|
|
|
|
sys.exit(ret_code)
|