]>
Commit | Line | Data |
---|---|---|
c05aa036 | 1 | #!/usr/bin/env python3 |
83d290c5 | 2 | # SPDX-License-Identifier: GPL-2.0+ |
fc3fe1c2 SG |
3 | # |
4 | # Copyright (c) 2012 The Chromium OS Authors. | |
5 | # | |
fc3fe1c2 SG |
6 | |
7 | """See README for more information""" | |
8 | ||
0ede00fd | 9 | import doctest |
fc3fe1c2 | 10 | import multiprocessing |
fc3fe1c2 SG |
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__)) | |
0ede00fd | 18 | sys.path.insert(1, os.path.join(our_path, '..')) |
fc3fe1c2 SG |
19 | |
20 | # Our modules | |
0ede00fd SG |
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 | |
bf776679 SG |
27 | from patman import patchstream |
28 | from patman import gitutil | |
29 | from patman import terminal | |
fc3fe1c2 | 30 | |
cb39a109 | 31 | def RunTests(skip_net_tests): |
d4144e45 | 32 | import func_test |
fc3fe1c2 | 33 | import test |
4281ad8e SG |
34 | import doctest |
35 | ||
36 | result = unittest.TestResult() | |
b4fa9495 | 37 | for module in ['buildman.toolchain', 'patman.gitutil']: |
4281ad8e SG |
38 | suite = doctest.DocTestSuite(module) |
39 | suite.run(result) | |
40 | ||
fc3fe1c2 | 41 | sys.argv = [sys.argv[0]] |
cb39a109 SG |
42 | if skip_net_tests: |
43 | test.use_network = False | |
d4144e45 SG |
44 | for module in (test.TestBuild, func_test.TestFunctional): |
45 | suite = unittest.TestLoader().loadTestsFromTestCase(module) | |
46 | suite.run(result) | |
fc3fe1c2 | 47 | |
c05aa036 | 48 | print(result) |
fc3fe1c2 | 49 | for test, err in result.errors: |
c05aa036 | 50 | print(err) |
fc3fe1c2 | 51 | for test, err in result.failures: |
c05aa036 | 52 | print(err) |
fc3fe1c2 SG |
53 | |
54 | ||
d3d5c123 | 55 | options, args = cmdline.ParseArgs() |
fc3fe1c2 SG |
56 | |
57 | # Run our meagre tests | |
58 | if options.test: | |
cb39a109 | 59 | RunTests(options.skip_net_tests) |
fc3fe1c2 SG |
60 | |
61 | # Build selected commits for selected boards | |
62 | else: | |
fd03d63f | 63 | bsettings.Setup(options.config_file) |
2c3deb97 SG |
64 | ret_code = control.DoBuildman(options, args) |
65 | sys.exit(ret_code) |