blob: d0afeda6c07734a7d7505757a437818a3ed25df7 [file] [log] [blame]
Googler40bc9d02023-12-15 16:42:49 +08001#!/usr/bin/env python
Googlere00b8eb2019-07-08 16:37:07 -07002#
3# Copyright (c) 2012 The Chromium OS Authors.
4#
Googler40bc9d02023-12-15 16:42:49 +08005# SPDX-License-Identifier: GPL-2.0+
6#
Googlere00b8eb2019-07-08 16:37:07 -07007
8"""See README for more information"""
9
10import multiprocessing
11import os
12import re
13import sys
14import unittest
15
16# Bring in the patman libraries
17our_path = os.path.dirname(os.path.realpath(__file__))
Googler40bc9d02023-12-15 16:42:49 +080018sys.path.append(os.path.join(our_path, '../patman'))
Googlere00b8eb2019-07-08 16:37:07 -070019
20# Our modules
21import board
22import bsettings
23import builder
24import checkpatch
25import cmdline
26import control
27import doctest
28import gitutil
29import patchstream
30import terminal
31import toolchain
32
Googler40bc9d02023-12-15 16:42:49 +080033def RunTests():
Googlere00b8eb2019-07-08 16:37:07 -070034 import func_test
35 import test
36 import doctest
37
38 result = unittest.TestResult()
39 for module in ['toolchain', 'gitutil']:
40 suite = doctest.DocTestSuite(module)
41 suite.run(result)
42
43 sys.argv = [sys.argv[0]]
Googlere00b8eb2019-07-08 16:37:07 -070044 for module in (test.TestBuild, func_test.TestFunctional):
45 suite = unittest.TestLoader().loadTestsFromTestCase(module)
46 suite.run(result)
47
48 print result
49 for test, err in result.errors:
50 print err
51 for test, err in result.failures:
52 print err
53
54
55options, args = cmdline.ParseArgs()
56
57# Run our meagre tests
58if options.test:
Googler40bc9d02023-12-15 16:42:49 +080059 RunTests()
Googlere00b8eb2019-07-08 16:37:07 -070060
61# Build selected commits for selected boards
62else:
63 bsettings.Setup(options.config_file)
64 ret_code = control.DoBuildman(options, args)
65 sys.exit(ret_code)