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 9import multiprocessing 10import os 11import re 12import sys 13import unittest 14 15# Bring in the patman libraries 16our_path = os.path.dirname(os.path.realpath(__file__)) 17sys.path.insert(1, os.path.join(our_path, '../patman')) 18 19# Our modules 20import board 21import bsettings 22import builder 23import checkpatch 24import cmdline 25import control 26import doctest 27import gitutil 28import patchstream 29import terminal 30import toolchain 31 32def 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 56options, args = cmdline.ParseArgs() 57 58# Run our meagre tests 59if options.test: 60 RunTests(options.skip_net_tests) 61 62# Build selected commits for selected boards 63else: 64 bsettings.Setup(options.config_file) 65 ret_code = control.DoBuildman(options, args) 66 sys.exit(ret_code) 67