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(): |
| 33 | import test |
Simon Glass | 4281ad8 | 2013-09-23 17:35:17 -0600 | [diff] [blame] | 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 |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 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 | |
Simon Glass | d3d5c12 | 2014-09-05 19:00:10 -0600 | [diff] [blame^] | 61 | options, args = cmdline.ParseArgs() |
Simon Glass | fc3fe1c | 2013-04-03 11:07:16 +0000 | [diff] [blame] | 62 | |
| 63 | # Run our meagre tests |
| 64 | if options.test: |
| 65 | RunTests() |
| 66 | elif 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 |
| 74 | else: |
Simon Glass | 2c3deb9 | 2014-08-28 09:43:39 -0600 | [diff] [blame] | 75 | ret_code = control.DoBuildman(options, args) |
| 76 | sys.exit(ret_code) |