2013-09-28 17:38:14 +00:00
|
|
|
#!/usr/bin/env python
|
2013-04-03 11:07:16 +00:00
|
|
|
#
|
|
|
|
# Copyright (c) 2012 The Chromium OS Authors.
|
|
|
|
#
|
2013-07-08 07:37:19 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
2013-04-03 11:07:16 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
"""See README for more information"""
|
|
|
|
|
|
|
|
import multiprocessing
|
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import sys
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
# Bring in the patman libraries
|
|
|
|
our_path = os.path.dirname(os.path.realpath(__file__))
|
2016-09-18 22:48:34 +00:00
|
|
|
sys.path.insert(1, os.path.join(our_path, '../patman'))
|
2013-04-03 11:07:16 +00:00
|
|
|
|
|
|
|
# Our modules
|
|
|
|
import board
|
2014-09-06 01:00:14 +00:00
|
|
|
import bsettings
|
2013-04-03 11:07:16 +00:00
|
|
|
import builder
|
|
|
|
import checkpatch
|
2014-09-06 01:00:10 +00:00
|
|
|
import cmdline
|
2013-04-03 11:07:16 +00:00
|
|
|
import control
|
|
|
|
import doctest
|
|
|
|
import gitutil
|
|
|
|
import patchstream
|
|
|
|
import terminal
|
|
|
|
import toolchain
|
|
|
|
|
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
|
|
|
|
|
|
|
print result
|
|
|
|
for test, err in result.errors:
|
|
|
|
print err
|
|
|
|
for test, err in result.failures:
|
|
|
|
print err
|
|
|
|
|
|
|
|
|
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)
|