]>
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 | ||
9 | import multiprocessing | |
fc3fe1c2 SG |
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__)) | |
a556eeeb | 17 | sys.path.insert(1, os.path.join(our_path, '../patman')) |
fc3fe1c2 SG |
18 | |
19 | # Our modules | |
20 | import board | |
fd03d63f | 21 | import bsettings |
fc3fe1c2 SG |
22 | import builder |
23 | import checkpatch | |
d3d5c123 | 24 | import cmdline |
fc3fe1c2 SG |
25 | import control |
26 | import doctest | |
27 | import gitutil | |
28 | import patchstream | |
29 | import terminal | |
30 | import toolchain | |
31 | ||
cb39a109 | 32 | def RunTests(skip_net_tests): |
d4144e45 | 33 | import func_test |
fc3fe1c2 | 34 | import test |
4281ad8e SG |
35 | import doctest |
36 | ||
37 | result = unittest.TestResult() | |
d4144e45 | 38 | for module in ['toolchain', 'gitutil']: |
4281ad8e SG |
39 | suite = doctest.DocTestSuite(module) |
40 | suite.run(result) | |
41 | ||
fc3fe1c2 | 42 | sys.argv = [sys.argv[0]] |
cb39a109 SG |
43 | if skip_net_tests: |
44 | test.use_network = False | |
d4144e45 SG |
45 | for module in (test.TestBuild, func_test.TestFunctional): |
46 | suite = unittest.TestLoader().loadTestsFromTestCase(module) | |
47 | suite.run(result) | |
fc3fe1c2 | 48 | |
c05aa036 | 49 | print(result) |
fc3fe1c2 | 50 | for test, err in result.errors: |
c05aa036 | 51 | print(err) |
fc3fe1c2 | 52 | for test, err in result.failures: |
c05aa036 | 53 | print(err) |
fc3fe1c2 SG |
54 | |
55 | ||
d3d5c123 | 56 | options, args = cmdline.ParseArgs() |
fc3fe1c2 SG |
57 | |
58 | # Run our meagre tests | |
59 | if options.test: | |
cb39a109 | 60 | RunTests(options.skip_net_tests) |
fc3fe1c2 SG |
61 | |
62 | # Build selected commits for selected boards | |
63 | else: | |
fd03d63f | 64 | bsettings.Setup(options.config_file) |
2c3deb97 SG |
65 | ret_code = control.DoBuildman(options, args) |
66 | sys.exit(ret_code) |