Jagannadha Sutradharudu Teki | 5a8911e | 2013-09-28 23:08:14 +0530 | [diff] [blame] | 1 | #!/usr/bin/env python |
Simon Glass | c05694f | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 2 | # |
| 3 | # Copyright (c) 2012 The Chromium OS Authors. |
| 4 | # |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | # SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | c05694f | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 6 | # |
| 7 | |
| 8 | """See README for more information""" |
| 9 | |
| 10 | import multiprocessing |
Simon Glass | c05694f | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 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__)) |
Simon Glass | 61a6749 | 2016-09-18 16:48:34 -0600 | [diff] [blame] | 18 | sys.path.insert(1, os.path.join(our_path, '../patman')) |
Simon Glass | c05694f | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 19 | |
| 20 | # Our modules |
| 21 | import board |
Simon Glass | c88c895 | 2014-09-05 19:00:14 -0600 | [diff] [blame] | 22 | import bsettings |
Simon Glass | c05694f | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 23 | import builder |
| 24 | import checkpatch |
Simon Glass | 04bac6b | 2014-09-05 19:00:10 -0600 | [diff] [blame] | 25 | import cmdline |
Simon Glass | c05694f | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 26 | import control |
| 27 | import doctest |
| 28 | import gitutil |
| 29 | import patchstream |
| 30 | import terminal |
| 31 | import toolchain |
| 32 | |
| 33 | def RunTests(): |
Simon Glass | ed098bb | 2014-09-05 19:00:13 -0600 | [diff] [blame] | 34 | import func_test |
Simon Glass | c05694f | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 35 | import test |
Simon Glass | cc246fb | 2013-09-23 17:35:17 -0600 | [diff] [blame] | 36 | import doctest |
| 37 | |
| 38 | result = unittest.TestResult() |
Simon Glass | ed098bb | 2014-09-05 19:00:13 -0600 | [diff] [blame] | 39 | for module in ['toolchain', 'gitutil']: |
Simon Glass | cc246fb | 2013-09-23 17:35:17 -0600 | [diff] [blame] | 40 | suite = doctest.DocTestSuite(module) |
| 41 | suite.run(result) |
| 42 | |
Simon Glass | c05694f | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 43 | sys.argv = [sys.argv[0]] |
Simon Glass | ed098bb | 2014-09-05 19:00:13 -0600 | [diff] [blame] | 44 | for module in (test.TestBuild, func_test.TestFunctional): |
| 45 | suite = unittest.TestLoader().loadTestsFromTestCase(module) |
| 46 | suite.run(result) |
Simon Glass | c05694f | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 47 | |
Simon Glass | c05694f | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 48 | print result |
| 49 | for test, err in result.errors: |
| 50 | print err |
| 51 | for test, err in result.failures: |
| 52 | print err |
| 53 | |
| 54 | |
Simon Glass | 04bac6b | 2014-09-05 19:00:10 -0600 | [diff] [blame] | 55 | options, args = cmdline.ParseArgs() |
Simon Glass | c05694f | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 56 | |
| 57 | # Run our meagre tests |
| 58 | if options.test: |
| 59 | RunTests() |
Simon Glass | c05694f | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 60 | |
| 61 | # Build selected commits for selected boards |
| 62 | else: |
Simon Glass | c88c895 | 2014-09-05 19:00:14 -0600 | [diff] [blame] | 63 | bsettings.Setup(options.config_file) |
Simon Glass | c2f9107 | 2014-08-28 09:43:39 -0600 | [diff] [blame] | 64 | ret_code = control.DoBuildman(options, args) |
| 65 | sys.exit(ret_code) |