blob: c4de857d996f643a91dfbe469720493beaf09020 [file] [log] [blame]
Jagannadha Sutradharudu Tekia707b3d2013-09-28 23:08:14 +05301#!/usr/bin/env python
Simon Glassfc3fe1c2013-04-03 11:07:16 +00002#
3# Copyright (c) 2012 The Chromium OS Authors.
4#
Wolfgang Denk1a459662013-07-08 09:37:19 +02005# SPDX-License-Identifier: GPL-2.0+
Simon Glassfc3fe1c2013-04-03 11:07:16 +00006#
7
8"""See README for more information"""
9
10import multiprocessing
Simon Glassfc3fe1c2013-04-03 11:07:16 +000011import 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
Simon Glassd3d5c122014-09-05 19:00:10 -060024import cmdline
Simon Glassfc3fe1c2013-04-03 11:07:16 +000025import control
26import doctest
27import gitutil
28import patchstream
29import terminal
30import toolchain
31
32def RunTests():
33 import test
Simon Glass4281ad82013-09-23 17:35:17 -060034 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 Glassfc3fe1c2013-04-03 11:07:16 +000047
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 Glassd3d5c122014-09-05 19:00:10 -060061options, args = cmdline.ParseArgs()
Simon Glassfc3fe1c2013-04-03 11:07:16 +000062
63# Run our meagre tests
64if options.test:
65 RunTests()
66elif 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
74else:
Simon Glass2c3deb92014-08-28 09:43:39 -060075 ret_code = control.DoBuildman(options, args)
76 sys.exit(ret_code)