1 #!/usr/bin/env python2 2 # SPDX-License-Identifier: GPL-2.0+ 3 # 4 # Copyright (c) 2012 The Chromium OS Authors. 5 # 6 7 """See README for more information""" 8 9 import multiprocessing 10 import os 11 import re 12 import sys 13 import unittest 14 15 # Bring in the patman libraries 16 our_path = os.path.dirname(os.path.realpath(__file__)) 17 sys.path.insert(1, os.path.join(our_path, '../patman')) 18 19 # Our modules 20 import board 21 import bsettings 22 import builder 23 import checkpatch 24 import cmdline 25 import control 26 import doctest 27 import gitutil 28 import patchstream 29 import terminal 30 import toolchain 31 32 def RunTests(skip_net_tests): 33 import func_test 34 import test 35 import doctest 36 37 result = unittest.TestResult() 38 for module in ['toolchain', 'gitutil']: 39 suite = doctest.DocTestSuite(module) 40 suite.run(result) 41 42 sys.argv = [sys.argv[0]] 43 if skip_net_tests: 44 test.use_network = False 45 for module in (test.TestBuild, func_test.TestFunctional): 46 suite = unittest.TestLoader().loadTestsFromTestCase(module) 47 suite.run(result) 48 49 print result 50 for test, err in result.errors: 51 print err 52 for test, err in result.failures: 53 print err 54 55 56 options, args = cmdline.ParseArgs() 57 58 # Run our meagre tests 59 if options.test: 60 RunTests(options.skip_net_tests) 61 62 # Build selected commits for selected boards 63 else: 64 bsettings.Setup(options.config_file) 65 ret_code = control.DoBuildman(options, args) 66 sys.exit(ret_code) 67