xref: /rk3399_rockchip-uboot/tools/buildman/buildman.py (revision d3d5c1233156215c3c793e77dce72f2fdfe745f1)
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
10import multiprocessing
11import os
12import re
13import sys
14import unittest
15
16# Bring in the patman libraries
17our_path = os.path.dirname(os.path.realpath(__file__))
18sys.path.append(os.path.join(our_path, '../patman'))
19
20# Our modules
21import board
22import builder
23import checkpatch
24import cmdline
25import control
26import doctest
27import gitutil
28import patchstream
29import terminal
30import toolchain
31
32def RunTests():
33    import test
34    import doctest
35
36    result = unittest.TestResult()
37    for module in ['toolchain']:
38        suite = doctest.DocTestSuite(module)
39        suite.run(result)
40
41    # TODO: Surely we can just 'print' result?
42    print result
43    for test, err in result.errors:
44        print err
45    for test, err in result.failures:
46        print err
47
48    sys.argv = [sys.argv[0]]
49    suite = unittest.TestLoader().loadTestsFromTestCase(test.TestBuild)
50    result = unittest.TestResult()
51    suite.run(result)
52
53    # TODO: Surely we can just 'print' result?
54    print result
55    for test, err in result.errors:
56        print err
57    for test, err in result.failures:
58        print err
59
60
61options, args = cmdline.ParseArgs()
62
63# Run our meagre tests
64if options.test:
65    RunTests()
66elif options.full_help:
67    pager = os.getenv('PAGER')
68    if not pager:
69        pager = 'more'
70    fname = os.path.join(os.path.dirname(sys.argv[0]), 'README')
71    command.Run(pager, fname)
72
73# Build selected commits for selected boards
74else:
75    ret_code = control.DoBuildman(options, args)
76    sys.exit(ret_code)
77