blob: d0afeda6c07734a7d7505757a437818a3ed25df7 [file] [log] [blame]
Jagannadha Sutradharudu Teki5a8911e2013-09-28 23:08:14 +05301#!/usr/bin/env python
Simon Glassc05694f2013-04-03 11:07:16 +00002#
3# Copyright (c) 2012 The Chromium OS Authors.
4#
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005# SPDX-License-Identifier: GPL-2.0+
Simon Glassc05694f2013-04-03 11:07:16 +00006#
7
8"""See README for more information"""
9
10import multiprocessing
Simon Glassc05694f2013-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
Simon Glassc88c8952014-09-05 19:00:14 -060022import bsettings
Simon Glassc05694f2013-04-03 11:07:16 +000023import builder
24import checkpatch
Simon Glass04bac6b2014-09-05 19:00:10 -060025import cmdline
Simon Glassc05694f2013-04-03 11:07:16 +000026import control
27import doctest
28import gitutil
29import patchstream
30import terminal
31import toolchain
32
33def RunTests():
Simon Glassed098bb2014-09-05 19:00:13 -060034 import func_test
Simon Glassc05694f2013-04-03 11:07:16 +000035 import test
Simon Glasscc246fb2013-09-23 17:35:17 -060036 import doctest
37
38 result = unittest.TestResult()
Simon Glassed098bb2014-09-05 19:00:13 -060039 for module in ['toolchain', 'gitutil']:
Simon Glasscc246fb2013-09-23 17:35:17 -060040 suite = doctest.DocTestSuite(module)
41 suite.run(result)
42
Simon Glassc05694f2013-04-03 11:07:16 +000043 sys.argv = [sys.argv[0]]
Simon Glassed098bb2014-09-05 19:00:13 -060044 for module in (test.TestBuild, func_test.TestFunctional):
45 suite = unittest.TestLoader().loadTestsFromTestCase(module)
46 suite.run(result)
Simon Glassc05694f2013-04-03 11:07:16 +000047
Simon Glassc05694f2013-04-03 11:07:16 +000048 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 Glass04bac6b2014-09-05 19:00:10 -060055options, args = cmdline.ParseArgs()
Simon Glassc05694f2013-04-03 11:07:16 +000056
57# Run our meagre tests
58if options.test:
59 RunTests()
Simon Glassc05694f2013-04-03 11:07:16 +000060
61# Build selected commits for selected boards
62else:
Simon Glassc88c8952014-09-05 19:00:14 -060063 bsettings.Setup(options.config_file)
Simon Glassc2f91072014-08-28 09:43:39 -060064 ret_code = control.DoBuildman(options, args)
65 sys.exit(ret_code)