xref: /rk3399_rockchip-uboot/tools/buildman/buildman.py (revision d4144e45b4245c60f50d456293cad2f53373efcd)
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 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
54options, args = cmdline.ParseArgs()
55
56# Run our meagre tests
57if options.test:
58    RunTests()
59
60# Build selected commits for selected boards
61else:
62    ret_code = control.DoBuildman(options, args)
63    sys.exit(ret_code)
64