]> git.sur5r.net Git - u-boot/blob - tools/buildman/buildman.py
buildman: Add a functional test
[u-boot] / tools / buildman / buildman.py
1 #!/usr/bin/env python
2 #
3 # Copyright (c) 2012 The Chromium OS Authors.
4 #
5 # SPDX-License-Identifier:      GPL-2.0+
6 #
7
8 """See README for more information"""
9
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.append(os.path.join(our_path, '../patman'))
19
20 # Our modules
21 import board
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():
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     for module in (test.TestBuild, func_test.TestFunctional):
44         suite = unittest.TestLoader().loadTestsFromTestCase(module)
45         suite.run(result)
46
47     print result
48     for test, err in result.errors:
49         print err
50     for test, err in result.failures:
51         print err
52
53
54 options, args = cmdline.ParseArgs()
55
56 # Run our meagre tests
57 if options.test:
58     RunTests()
59
60 # Build selected commits for selected boards
61 else:
62     ret_code = control.DoBuildman(options, args)
63     sys.exit(ret_code)