patman: Convert camel case in test_util.py
[platform/kernel/u-boot.git] / tools / buildman / main.py
1 #!/usr/bin/env python3
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 doctest
10 import multiprocessing
11 import os
12 import re
13 import sys
14 import unittest
15
16 # Bring in the patman libraries
17 our_path = os.path.dirname(os.path.realpath(__file__))
18 sys.path.insert(1, os.path.join(our_path, '..'))
19
20 # Our modules
21 from buildman import board
22 from buildman import bsettings
23 from buildman import builder
24 from buildman import cmdline
25 from buildman import control
26 from buildman import toolchain
27 from patman import patchstream
28 from patman import gitutil
29 from patman import terminal
30 from patman import test_util
31
32 def RunTests(skip_net_tests, verboose, args):
33     import func_test
34     import test
35     import doctest
36
37     result = unittest.TestResult()
38     test_name = args and args[0] or None
39     if skip_net_tests:
40         test.use_network = False
41
42     # Run the entry tests first ,since these need to be the first to import the
43     # 'entry' module.
44     test_util.run_test_suites(
45         result, False, verboose, False, None, test_name, [],
46         [test.TestBuild, func_test.TestFunctional,
47          'buildman.toolchain', 'patman.gitutil'])
48
49     return test_util.report_result('buildman', test_name, result)
50
51 options, args = cmdline.ParseArgs()
52
53 if not options.debug:
54     sys.tracebacklimit = 0
55
56 # Run our meagre tests
57 if options.test:
58     RunTests(options.skip_net_tests, options.verbose, args)
59
60 # Build selected commits for selected boards
61 else:
62     bsettings.Setup(options.config_file)
63     ret_code = control.DoBuildman(options, args)
64     sys.exit(ret_code)