Jagannadha Sutradharudu Teki | a707b3d | 2013-09-28 23:08:14 +0530 | [diff] [blame] | 1 | #!/usr/bin/env python |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 2 | # |
| 3 | # Copyright (c) 2012 The Chromium OS Authors. |
| 4 | # |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | # SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 6 | # |
| 7 | |
| 8 | """See README for more information""" |
| 9 | |
| 10 | import multiprocessing |
Simon Glass | fc3fe1c | 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__)) |
| 18 | sys.path.append(os.path.join(our_path, '../patman')) |
| 19 | |
| 20 | # Our modules |
| 21 | import board |
Simon Glass | fd03d63 | 2014-09-05 19:00:14 -0600 | [diff] [blame] | 22 | import bsettings |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 23 | import builder |
| 24 | import checkpatch |
Simon Glass | d3d5c12 | 2014-09-05 19:00:10 -0600 | [diff] [blame] | 25 | import cmdline |
Simon Glass | fc3fe1c | 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 | d4144e4 | 2014-09-05 19:00:13 -0600 | [diff] [blame] | 34 | import func_test |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 35 | import test |
Simon Glass | 4281ad8 | 2013-09-23 17:35:17 -0600 | [diff] [blame] | 36 | import doctest |
| 37 | |
| 38 | result = unittest.TestResult() |
Simon Glass | d4144e4 | 2014-09-05 19:00:13 -0600 | [diff] [blame] | 39 | for module in ['toolchain', 'gitutil']: |
Simon Glass | 4281ad8 | 2013-09-23 17:35:17 -0600 | [diff] [blame] | 40 | suite = doctest.DocTestSuite(module) |
| 41 | suite.run(result) |
| 42 | |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 43 | sys.argv = [sys.argv[0]] |
Simon Glass | d4144e4 | 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 | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 47 | |
Simon Glass | fc3fe1c | 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 | d3d5c12 | 2014-09-05 19:00:10 -0600 | [diff] [blame] | 55 | options, args = cmdline.ParseArgs() |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 56 | |
| 57 | # Run our meagre tests |
| 58 | if options.test: |
| 59 | RunTests() |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 60 | |
| 61 | # Build selected commits for selected boards |
| 62 | else: |
Simon Glass | fd03d63 | 2014-09-05 19:00:14 -0600 | [diff] [blame] | 63 | bsettings.Setup(options.config_file) |
Simon Glass | 2c3deb9 | 2014-08-28 09:43:39 -0600 | [diff] [blame] | 64 | ret_code = control.DoBuildman(options, args) |
| 65 | sys.exit(ret_code) |