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 |
| 22 | import builder |
| 23 | import checkpatch |
Simon Glass | d3d5c12 | 2014-09-05 19:00:10 -0600 | [diff] [blame] | 24 | import cmdline |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 25 | import control |
| 26 | import doctest |
| 27 | import gitutil |
| 28 | import patchstream |
| 29 | import terminal |
| 30 | import toolchain |
| 31 | |
| 32 | def RunTests(): |
Simon Glass | d4144e4 | 2014-09-05 19:00:13 -0600 | [diff] [blame^] | 33 | import func_test |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 34 | import test |
Simon Glass | 4281ad8 | 2013-09-23 17:35:17 -0600 | [diff] [blame] | 35 | import doctest |
| 36 | |
| 37 | result = unittest.TestResult() |
Simon Glass | d4144e4 | 2014-09-05 19:00:13 -0600 | [diff] [blame^] | 38 | for module in ['toolchain', 'gitutil']: |
Simon Glass | 4281ad8 | 2013-09-23 17:35:17 -0600 | [diff] [blame] | 39 | suite = doctest.DocTestSuite(module) |
| 40 | suite.run(result) |
| 41 | |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 42 | sys.argv = [sys.argv[0]] |
Simon Glass | d4144e4 | 2014-09-05 19:00:13 -0600 | [diff] [blame^] | 43 | for module in (test.TestBuild, func_test.TestFunctional): |
| 44 | suite = unittest.TestLoader().loadTestsFromTestCase(module) |
| 45 | suite.run(result) |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 46 | |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 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 | |
Simon Glass | d3d5c12 | 2014-09-05 19:00:10 -0600 | [diff] [blame] | 54 | options, args = cmdline.ParseArgs() |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 55 | |
| 56 | # Run our meagre tests |
| 57 | if options.test: |
| 58 | RunTests() |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 59 | |
| 60 | # Build selected commits for selected boards |
| 61 | else: |
Simon Glass | 2c3deb9 | 2014-08-28 09:43:39 -0600 | [diff] [blame] | 62 | ret_code = control.DoBuildman(options, args) |
| 63 | sys.exit(ret_code) |