blob: 6771c862d34806e61eb907732459d1bfc66f7896 [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():
Simon Glassd4144e42014-09-05 19:00:13 -060033 import func_test
Simon Glassfc3fe1c2013-04-03 11:07:16 +000034 import test
Simon Glass4281ad82013-09-23 17:35:17 -060035 import doctest
36
37 result = unittest.TestResult()
Simon Glassd4144e42014-09-05 19:00:13 -060038 for module in ['toolchain', 'gitutil']:
Simon Glass4281ad82013-09-23 17:35:17 -060039 suite = doctest.DocTestSuite(module)
40 suite.run(result)
41
Simon Glassfc3fe1c2013-04-03 11:07:16 +000042 sys.argv = [sys.argv[0]]
Simon Glassd4144e42014-09-05 19:00:13 -060043 for module in (test.TestBuild, func_test.TestFunctional):
44 suite = unittest.TestLoader().loadTestsFromTestCase(module)
45 suite.run(result)
Simon Glassfc3fe1c2013-04-03 11:07:16 +000046
Simon Glassfc3fe1c2013-04-03 11:07:16 +000047 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 Glassd3d5c122014-09-05 19:00:10 -060054options, args = cmdline.ParseArgs()
Simon Glassfc3fe1c2013-04-03 11:07:16 +000055
56# Run our meagre tests
57if options.test:
58 RunTests()
Simon Glassfc3fe1c2013-04-03 11:07:16 +000059
60# Build selected commits for selected boards
61else:
Simon Glass2c3deb92014-08-28 09:43:39 -060062 ret_code = control.DoBuildman(options, args)
63 sys.exit(ret_code)