]>
git.ipfire.org Git - people/ms/u-boot.git/blob - tools/buildman/buildman.py
3 # Copyright (c) 2012 The Chromium OS Authors.
5 # SPDX-License-Identifier: GPL-2.0+
8 """See README for more information"""
10 import multiprocessing
11 from optparse
import OptionParser
17 # Bring in the patman libraries
18 our_path
= os
.path
.dirname(os
.path
.realpath(__file__
))
19 sys
.path
.append(os
.path
.join(our_path
, '../patman'))
37 result
= unittest
.TestResult()
38 for module
in ['toolchain']:
39 suite
= doctest
.DocTestSuite(module
)
42 # TODO: Surely we can just 'print' result?
44 for test
, err
in result
.errors
:
46 for test
, err
in result
.failures
:
49 sys
.argv
= [sys
.argv
[0]]
50 suite
= unittest
.TestLoader().loadTestsFromTestCase(test
.TestBuild
)
51 result
= unittest
.TestResult()
54 # TODO: Surely we can just 'print' result?
56 for test
, err
in result
.errors
:
58 for test
, err
in result
.failures
:
62 parser
= OptionParser()
63 parser
.add_option('-b', '--branch', type='string',
64 help='Branch name to build')
65 parser
.add_option('-B', '--bloat', dest
='show_bloat',
66 action
='store_true', default
=False,
67 help='Show changes in function code size for each board')
68 parser
.add_option('-c', '--count', dest
='count', type='int',
69 default
=-1, help='Run build on the top n commits')
70 parser
.add_option('-e', '--show_errors', action
='store_true',
71 default
=False, help='Show errors and warnings')
72 parser
.add_option('-f', '--force-build', dest
='force_build',
73 action
='store_true', default
=False,
74 help='Force build of boards even if already built')
75 parser
.add_option('-d', '--detail', dest
='show_detail',
76 action
='store_true', default
=False,
77 help='Show detailed information for each board in summary')
78 parser
.add_option('-g', '--git', type='string',
79 help='Git repo containing branch to build', default
='.')
80 parser
.add_option('-H', '--full-help', action
='store_true', dest
='full_help',
81 default
=False, help='Display the README file')
82 parser
.add_option('-j', '--jobs', dest
='jobs', type='int',
83 default
=None, help='Number of jobs to run at once (passed to make)')
84 parser
.add_option('-k', '--keep-outputs', action
='store_true',
85 default
=False, help='Keep all build output files (e.g. binaries)')
86 parser
.add_option('--list-tool-chains', action
='store_true', default
=False,
87 help='List available tool chains')
88 parser
.add_option('-n', '--dry-run', action
='store_true', dest
='dry_run',
89 default
=False, help="Do a try run (describe actions, but no nothing)")
90 parser
.add_option('-Q', '--quick', action
='store_true',
91 default
=False, help='Do a rough build, with limited warning resolution')
92 parser
.add_option('-s', '--summary', action
='store_true',
93 default
=False, help='Show a build summary')
94 parser
.add_option('-S', '--show-sizes', action
='store_true',
95 default
=False, help='Show image size variation in summary')
96 parser
.add_option('--step', type='int',
97 default
=1, help='Only build every n commits (0=just first and last)')
98 parser
.add_option('-t', '--test', action
='store_true', dest
='test',
99 default
=False, help='run tests')
100 parser
.add_option('-T', '--threads', type='int',
101 default
=None, help='Number of builder threads to use')
102 parser
.add_option('-u', '--show_unknown', action
='store_true',
103 default
=False, help='Show boards with unknown build result')
105 parser
.usage
= """buildman -b <branch> [options]
107 Build U-Boot for all commits in a branch. Use -n to do a dry run"""
109 (options
, args
) = parser
.parse_args()
111 # Run our meagre tests
114 elif options
.full_help
:
115 pager
= os
.getenv('PAGER')
118 fname
= os
.path
.join(os
.path
.dirname(sys
.argv
[0]), 'README')
119 command
.Run(pager
, fname
)
121 # Build selected commits for selected boards
123 control
.DoBuildman(options
, args
)