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
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
# 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, '..'))
|
|
|
|
sys.path.insert(2, os.path.join(our_path, '../patman'))
|
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
|
2013-04-03 11:07:16 +00:00
|
|
|
import patchstream
|
2020-04-18 00:09:02 +00:00
|
|
|
import gitutil
|
2013-04-03 11:07:16 +00:00
|
|
|
import terminal
|
|
|
|
|
2017-11-13 04:52:14 +00:00
|
|
|
def RunTests(skip_net_tests):
|
2014-09-06 01:00:13 +00:00
|
|
|
import func_test
|
2013-04-03 11:07:16 +00:00
|
|
|
import test
|
2013-09-23 23:35:17 +00:00
|
|
|
import doctest
|
|
|
|
|
|
|
|
result = unittest.TestResult()
|
2014-09-06 01:00:13 +00:00
|
|
|
for module in ['toolchain', 'gitutil']:
|
2013-09-23 23:35:17 +00:00
|
|
|
suite = doctest.DocTestSuite(module)
|
|
|
|
suite.run(result)
|
|
|
|
|
2013-04-03 11:07:16 +00:00
|
|
|
sys.argv = [sys.argv[0]]
|
2017-11-13 04:52:14 +00:00
|
|
|
if skip_net_tests:
|
|
|
|
test.use_network = False
|
2014-09-06 01:00:13 +00:00
|
|
|
for module in (test.TestBuild, func_test.TestFunctional):
|
|
|
|
suite = unittest.TestLoader().loadTestsFromTestCase(module)
|
|
|
|
suite.run(result)
|
2013-04-03 11:07:16 +00:00
|
|
|
|
2019-10-31 13:42:53 +00:00
|
|
|
print(result)
|
2013-04-03 11:07:16 +00:00
|
|
|
for test, err in result.errors:
|
2019-10-31 13:42:53 +00:00
|
|
|
print(err)
|
2013-04-03 11:07:16 +00:00
|
|
|
for test, err in result.failures:
|
2019-10-31 13:42:53 +00:00
|
|
|
print(err)
|
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
|
|
|
|
|
|
|
# Run our meagre tests
|
|
|
|
if options.test:
|
2017-11-13 04:52:14 +00:00
|
|
|
RunTests(options.skip_net_tests)
|
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)
|