2
# Copyright (c) 2012 The Chromium OS Authors.
4
# SPDX-License-Identifier: GPL-2.0+
14
# Bring in the patman libraries
15
our_path = os.path.dirname(os.path.realpath(__file__))
16
sys.path.append(os.path.join(our_path, '../patman'))
27
'''main.c: In function 'main_loop':
28
main.c:260:6: warning: unused variable 'joe' [-Wunused-variable]
30
'''main.c: In function 'main_loop':
31
main.c:295:2: error: 'fred' undeclared (first use in this function)
32
main.c:295:2: note: each undeclared identifier is reported only once for each function it appears in
33
make[1]: *** [main.o] Error 1
34
make: *** [common/libcommon.o] Error 2
37
'''main.c: In function 'main_loop':
38
main.c:280:6: warning: unused variable 'mary' [-Wunused-variable]
40
'''powerpc-linux-ld: warning: dot moved backwards before `.bss'
41
powerpc-linux-ld: warning: dot moved backwards before `.bss'
42
powerpc-linux-ld: u-boot: section .text lma 0xfffc0000 overlaps previous sections
43
powerpc-linux-ld: u-boot: section .rodata lma 0xfffef3ec overlaps previous sections
44
powerpc-linux-ld: u-boot: section .reloc lma 0xffffa400 overlaps previous sections
45
powerpc-linux-ld: u-boot: section .data lma 0xffffcd38 overlaps previous sections
46
powerpc-linux-ld: u-boot: section .u_boot_cmd lma 0xffffeb40 overlaps previous sections
47
powerpc-linux-ld: u-boot: section .bootpg lma 0xfffff198 overlaps previous sections
52
# hash, subject, return code, list of errors/warnings
54
['1234', 'upstream/master, ok', 0, []],
55
['5678', 'Second commit, a warning', 0, errors[0:1]],
56
['9012', 'Third commit, error', 1, errors[0:2]],
57
['3456', 'Fourth commit, warning', 0, [errors[0], errors[2]]],
58
['7890', 'Fifth commit, link errors', 1, [errors[0], errors[3]]],
59
['abcd', 'Sixth commit, fixes all errors', 0, []]
63
['Active', 'arm', 'armv7', '', 'Tester', 'ARM Board 1', 'board0', ''],
64
['Active', 'arm', 'armv7', '', 'Tester', 'ARM Board 2', 'board1', ''],
65
['Active', 'powerpc', 'powerpc', '', 'Tester', 'PowerPC board 1', 'board2', ''],
66
['Active', 'powerpc', 'mpc5xx', '', 'Tester', 'PowerPC board 2', 'board3', ''],
67
['Active', 'sandbox', 'sandbox', '', 'Tester', 'Sandbox board', 'board4', ''],
71
"""Class that holds build options"""
74
class TestBuild(unittest.TestCase):
77
TODO: Write tests for the rest of the functionality
80
# Set up commits to build
83
for commit_info in commits:
84
comm = commit.Commit(commit_info[0])
85
comm.subject = commit_info[1]
86
comm.return_code = commit_info[2]
87
comm.error_list = commit_info[3]
88
comm.sequence = sequence
90
self.commits.append(comm)
92
# Set up boards to build
93
self.boards = board.Boards()
95
self.boards.AddBoard(board.Board(*brd))
96
self.boards.SelectBoards([])
98
# Set up the toolchains
100
self.toolchains = toolchain.Toolchains()
101
self.toolchains.Add('arm-linux-gcc', test=False)
102
self.toolchains.Add('sparc-linux-gcc', test=False)
103
self.toolchains.Add('powerpc-linux-gcc', test=False)
104
self.toolchains.Add('gcc', test=False)
106
def Make(self, commit, brd, stage, *args, **kwargs):
107
result = command.CommandResult()
108
boardnum = int(brd.target[-1])
109
result.return_code = 0
111
result.stdout = ('This is the test output for board %s, commit %s' %
112
(brd.target, commit.hash))
113
if boardnum >= 1 and boardnum >= commit.sequence:
114
result.return_code = commit.return_code
115
result.stderr = ''.join(commit.error_list)
119
if arg.startswith('O='):
122
if not os.path.isdir(target_dir):
124
#time.sleep(.2 + boardnum * .2)
126
result.combined = result.stdout + result.stderr
130
"""Test basic builder operation"""
131
output_dir = tempfile.mkdtemp()
132
if not os.path.isdir(output_dir):
134
build = builder.Builder(self.toolchains, output_dir, None, 1, 2,
135
checkout=False, show_unknown=False)
136
build.do_make = self.Make
137
board_selected = self.boards.GetSelectedDict()
139
#build.BuildCommits(self.commits, board_selected, False)
140
build.BuildBoards(self.commits, board_selected, False, False)
141
build.ShowSummary(self.commits, board_selected, True, False,
145
"""Test basic builder operation by building a branch"""
146
base_dir = tempfile.mkdtemp()
147
if not os.path.isdir(base_dir):
150
options.git = os.getcwd()
151
options.summary = False
153
options.dry_run = False
154
#options.git = os.path.join(base_dir, 'repo')
155
options.branch = 'test-buildman'
156
options.force_build = False
157
options.list_tool_chains = False
159
options.git_dir = None
160
options.threads = None
161
options.show_unknown = False
162
options.quick = False
163
options.show_errors = False
164
options.keep_outputs = False
166
control.DoBuildman(options, args)
168
if __name__ == "__main__":