diff options
| author | Tom Rini <[email protected]> | 2022-02-10 09:02:06 -0500 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2022-02-10 09:19:44 -0500 |
| commit | 2ccd2bc8c3580e00c51094c5cc2b3e2ead8d35c3 (patch) | |
| tree | 4e7349b8831fee4b342a971025273d3cd042a2f9 /tools/buildman | |
| parent | 6662e5e406fdee26ba981dd4af3308f51f254f0a (diff) | |
| parent | f3078d4ea707931c2307a623ecf6e4d215b413d5 (diff) | |
Merge tag 'dm-pull-8feb22-take3' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
patman snake-case conversion
binman fit improvements
ACPI fixes and making MCFG available to ARM
[trini: Update scripts/pylint.base]
Signed-off-by: Tom Rini <[email protected]>
Diffstat (limited to 'tools/buildman')
| -rw-r--r-- | tools/buildman/builder.py | 108 | ||||
| -rw-r--r-- | tools/buildman/builderthread.py | 12 | ||||
| -rw-r--r-- | tools/buildman/control.py | 46 | ||||
| -rw-r--r-- | tools/buildman/func_test.py | 20 | ||||
| -rwxr-xr-x | tools/buildman/main.py | 4 | ||||
| -rw-r--r-- | tools/buildman/test.py | 30 | ||||
| -rw-r--r-- | tools/buildman/toolchain.py | 26 |
7 files changed, 123 insertions, 123 deletions
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 720bbb2cf4d..754642d4a68 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -22,7 +22,7 @@ from buildman import toolchain from patman import command from patman import gitutil from patman import terminal -from patman.terminal import Print +from patman.terminal import tprint # This indicates an new int or hex Kconfig property with no default # It hangs the build since the 'conf' tool cannot proceed without valid input. @@ -442,7 +442,7 @@ class Builder: """ self.commit = commit if checkout and self.checkout: - gitutil.Checkout(commit.hash) + gitutil.checkout(commit.hash) def Make(self, commit, brd, stage, cwd, *args, **kwargs): """Run make @@ -453,7 +453,7 @@ class Builder: stage: Stage that we are at (mrproper, config, build) cwd: Directory where make should be run args: Arguments to pass to make - kwargs: Arguments to pass to command.RunPipe() + kwargs: Arguments to pass to command.run_pipe() """ def check_output(stream, data): @@ -476,7 +476,7 @@ class Builder: self._restarting_config = False self._terminated = False cmd = [self.gnu_make] + list(args) - result = command.RunPipe([cmd], capture=True, capture_stderr=True, + result = command.run_pipe([cmd], capture=True, capture_stderr=True, cwd=cwd, raise_on_error=False, infile='/dev/null', output_func=check_output, **kwargs) @@ -508,7 +508,7 @@ class Builder: if result.already_done: self.already_done += 1 if self._verbose: - terminal.PrintClear() + terminal.print_clear() boards_selected = {target : result.brd} self.ResetResultSummary(boards_selected) self.ProduceResultSummary(result.commit_upto, self.commits, @@ -518,14 +518,14 @@ class Builder: # Display separate counts for ok, warned and fail ok = self.upto - self.warned - self.fail - line = '\r' + self.col.Color(self.col.GREEN, '%5d' % ok) - line += self.col.Color(self.col.YELLOW, '%5d' % self.warned) - line += self.col.Color(self.col.RED, '%5d' % self.fail) + line = '\r' + self.col.build(self.col.GREEN, '%5d' % ok) + line += self.col.build(self.col.YELLOW, '%5d' % self.warned) + line += self.col.build(self.col.RED, '%5d' % self.fail) line += ' /%-5d ' % self.count remaining = self.count - self.upto if remaining: - line += self.col.Color(self.col.MAGENTA, ' -%-5d ' % remaining) + line += self.col.build(self.col.MAGENTA, ' -%-5d ' % remaining) else: line += ' ' * 8 @@ -535,8 +535,8 @@ class Builder: line += '%s : ' % self._complete_delay line += target - terminal.PrintClear() - Print(line, newline=False, limit_to_line=True) + terminal.print_clear() + tprint(line, newline=False, limit_to_line=True) def _GetOutputDir(self, commit_upto): """Get the name of the output directory for a commit number @@ -666,7 +666,7 @@ class Builder: if line.strip(): size, type, name = line[:-1].split() except: - Print("Invalid line in file '%s': '%s'" % (fname, line[:-1])) + tprint("Invalid line in file '%s': '%s'" % (fname, line[:-1])) continue if type in 'tTdDbB': # function names begin with '.' on 64-bit powerpc @@ -933,9 +933,9 @@ class Builder: arch = board_dict[target].arch else: arch = 'unknown' - str = self.col.Color(color, ' ' + target) + str = self.col.build(color, ' ' + target) if not arch in done_arch: - str = ' %s %s' % (self.col.Color(color, char), str) + str = ' %s %s' % (self.col.build(color, char), str) done_arch[arch] = True if not arch in arch_list: arch_list[arch] = str @@ -947,7 +947,7 @@ class Builder: color = self.col.RED if num > 0 else self.col.GREEN if num == 0: return '0' - return self.col.Color(color, str(num)) + return self.col.build(color, str(num)) def ResetResultSummary(self, board_selected): """Reset the results summary ready for use. @@ -1009,16 +1009,16 @@ class Builder: return args = [self.ColourNum(x) for x in args] indent = ' ' * 15 - Print('%s%s: add: %s/%s, grow: %s/%s bytes: %s/%s (%s)' % - tuple([indent, self.col.Color(self.col.YELLOW, fname)] + args)) - Print('%s %-38s %7s %7s %+7s' % (indent, 'function', 'old', 'new', + tprint('%s%s: add: %s/%s, grow: %s/%s bytes: %s/%s (%s)' % + tuple([indent, self.col.build(self.col.YELLOW, fname)] + args)) + tprint('%s %-38s %7s %7s %+7s' % (indent, 'function', 'old', 'new', 'delta')) for diff, name in delta: if diff: color = self.col.RED if diff > 0 else self.col.GREEN msg = '%s %-38s %7s %7s %+7d' % (indent, name, old.get(name, '-'), new.get(name,'-'), diff) - Print(msg, colour=color) + tprint(msg, colour=color) def PrintSizeDetail(self, target_list, show_bloat): @@ -1043,12 +1043,12 @@ class Builder: color = self.col.RED if diff > 0 else self.col.GREEN msg = ' %s %+d' % (name, diff) if not printed_target: - Print('%10s %-15s:' % ('', result['_target']), + tprint('%10s %-15s:' % ('', result['_target']), newline=False) printed_target = True - Print(msg, colour=color, newline=False) + tprint(msg, colour=color, newline=False) if printed_target: - Print() + tprint() if show_bloat: target = result['_target'] outcome = result['_outcome'] @@ -1153,13 +1153,13 @@ class Builder: color = self.col.RED if avg_diff > 0 else self.col.GREEN msg = ' %s %+1.1f' % (name, avg_diff) if not printed_arch: - Print('%10s: (for %d/%d boards)' % (arch, count, + tprint('%10s: (for %d/%d boards)' % (arch, count, arch_count[arch]), newline=False) printed_arch = True - Print(msg, colour=color, newline=False) + tprint(msg, colour=color, newline=False) if printed_arch: - Print() + tprint() if show_detail: self.PrintSizeDetail(target_list, show_bloat) @@ -1304,7 +1304,7 @@ class Builder: col = self.col.RED elif line[0] == 'c': col = self.col.YELLOW - Print(' ' + line, newline=True, colour=col) + tprint(' ' + line, newline=True, colour=col) def _OutputErrLines(err_lines, colour): """Output the line of error/warning lines, if not empty @@ -1324,14 +1324,14 @@ class Builder: names = [board.target for board in line.boards] board_str = ' '.join(names) if names else '' if board_str: - out = self.col.Color(colour, line.char + '(') - out += self.col.Color(self.col.MAGENTA, board_str, + out = self.col.build(colour, line.char + '(') + out += self.col.build(self.col.MAGENTA, board_str, bright=False) - out += self.col.Color(colour, ') %s' % line.errline) + out += self.col.build(colour, ') %s' % line.errline) else: - out = self.col.Color(colour, line.char + line.errline) + out = self.col.build(colour, line.char + line.errline) out_list.append(out) - Print('\n'.join(out_list)) + tprint('\n'.join(out_list)) self._error_lines += 1 @@ -1385,7 +1385,7 @@ class Builder: self.AddOutcome(board_selected, arch_list, unknown_boards, '?', self.col.MAGENTA) for arch, target_list in arch_list.items(): - Print('%10s: %s' % (arch, target_list)) + tprint('%10s: %s' % (arch, target_list)) self._error_lines += 1 _OutputErrLines(better_err, colour=self.col.GREEN) _OutputErrLines(worse_err, colour=self.col.RED) @@ -1515,13 +1515,13 @@ class Builder: _AddConfig(lines, 'all', all_plus, all_minus, all_change) #arch_summary[target] = '\n'.join(lines) if lines: - Print('%s:' % arch) + tprint('%s:' % arch) _OutputConfigInfo(lines) for lines, targets in lines_by_target.items(): if not lines: continue - Print('%s :' % ' '.join(sorted(targets))) + tprint('%s :' % ' '.join(sorted(targets))) _OutputConfigInfo(lines.split('\n')) @@ -1540,7 +1540,7 @@ class Builder: if not board in board_dict: not_built.append(board) if not_built: - Print("Boards not built (%d): %s" % (len(not_built), + tprint("Boards not built (%d): %s" % (len(not_built), ', '.join(not_built))) def ProduceResultSummary(self, commit_upto, commits, board_selected): @@ -1553,7 +1553,7 @@ class Builder: if commits: msg = '%02d: %s' % (commit_upto + 1, commits[commit_upto].subject) - Print(msg, colour=self.col.BLUE) + tprint(msg, colour=self.col.BLUE) self.PrintResultSummary(board_selected, board_dict, err_lines if self._show_errors else [], err_line_boards, warn_lines if self._show_errors else [], warn_line_boards, @@ -1578,7 +1578,7 @@ class Builder: for commit_upto in range(0, self.commit_count, self._step): self.ProduceResultSummary(commit_upto, commits, board_selected) if not self._error_lines: - Print('(no errors to report)', colour=self.col.GREEN) + tprint('(no errors to report)', colour=self.col.GREEN) def SetupBuild(self, board_selected, commits): @@ -1629,10 +1629,10 @@ class Builder: if os.path.isdir(git_dir): # This is a clone of the src_dir repo, we can keep using # it but need to fetch from src_dir. - Print('\rFetching repo for thread %d' % thread_num, + tprint('\rFetching repo for thread %d' % thread_num, newline=False) - gitutil.Fetch(git_dir, thread_dir) - terminal.PrintClear() + gitutil.fetch(git_dir, thread_dir) + terminal.print_clear() elif os.path.isfile(git_dir): # This is a worktree of the src_dir repo, we don't need to # create it again or update it in any way. @@ -1643,15 +1643,15 @@ class Builder: raise ValueError('Git dir %s exists, but is not a file ' 'or a directory.' % git_dir) elif setup_git == 'worktree': - Print('\rChecking out worktree for thread %d' % thread_num, + tprint('\rChecking out worktree for thread %d' % thread_num, newline=False) - gitutil.AddWorktree(src_dir, thread_dir) - terminal.PrintClear() + gitutil.add_worktree(src_dir, thread_dir) + terminal.print_clear() elif setup_git == 'clone' or setup_git == True: - Print('\rCloning repo for thread %d' % thread_num, + tprint('\rCloning repo for thread %d' % thread_num, newline=False) - gitutil.Clone(src_dir, thread_dir) - terminal.PrintClear() + gitutil.clone(src_dir, thread_dir) + terminal.print_clear() else: raise ValueError("Can't setup git repo with %s." % setup_git) @@ -1670,12 +1670,12 @@ class Builder: builderthread.Mkdir(self._working_dir) if setup_git and self.git_dir: src_dir = os.path.abspath(self.git_dir) - if gitutil.CheckWorktreeIsAvailable(src_dir): + if gitutil.check_worktree_is_available(src_dir): setup_git = 'worktree' # If we previously added a worktree but the directory for it # got deleted, we need to prune its files from the repo so # that we can check out another in its place. - gitutil.PruneWorktrees(src_dir) + gitutil.prune_worktrees(src_dir) else: setup_git = 'clone' @@ -1717,11 +1717,11 @@ class Builder: """ to_remove = self._GetOutputSpaceRemovals() if to_remove: - Print('Removing %d old build directories...' % len(to_remove), + tprint('Removing %d old build directories...' % len(to_remove), newline=False) for dirname in to_remove: shutil.rmtree(dirname) - terminal.PrintClear() + terminal.print_clear() def BuildBoards(self, commits, board_selected, keep_outputs, verbose): """Build all commits for a list of boards @@ -1747,7 +1747,7 @@ class Builder: self._PrepareWorkingSpace(min(self.num_threads, len(board_selected)), commits is not None) self._PrepareOutputSpace() - Print('\rStarting build...', newline=False) + tprint('\rStarting build...', newline=False) self.SetupBuild(board_selected, commits) self.ProcessResult(None) self.thread_exceptions = [] @@ -1774,7 +1774,7 @@ class Builder: # Wait until we have processed all output self.out_queue.join() - Print() + tprint() msg = 'Completed: %d total built' % self.count if self.already_done: @@ -1789,9 +1789,9 @@ class Builder: duration = duration - timedelta(microseconds=duration.microseconds) rate = float(self.count) / duration.total_seconds() msg += ', duration %s, rate %1.2f' % (duration, rate) - Print(msg) + tprint(msg) if self.thread_exceptions: - Print('Failed: %d thread exceptions' % len(self.thread_exceptions), + tprint('Failed: %d thread exceptions' % len(self.thread_exceptions), colour=self.col.RED) return (self.fail, self.warned, self.thread_exceptions) diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index ecb285c0bfa..7522ff62de6 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -122,7 +122,7 @@ class BuilderThread(threading.Thread): config - called to configure for a board build - the main make invocation - it does the build args: A list of arguments to pass to 'make' - kwargs: A list of keyword arguments to pass to command.RunPipe() + kwargs: A list of keyword arguments to pass to command.run_pipe() Returns: CommandResult object @@ -219,7 +219,7 @@ class BuilderThread(threading.Thread): commit = self.builder.commits[commit_upto] if self.builder.checkout: git_dir = os.path.join(work_dir, '.git') - gitutil.Checkout(commit.hash, git_dir, work_dir, + gitutil.checkout(commit.hash, git_dir, work_dir, force=True) else: commit = 'current' @@ -375,7 +375,7 @@ class BuilderThread(threading.Thread): lines = [] for fname in BASE_ELF_FILENAMES: cmd = ['%snm' % self.toolchain.cross, '--size-sort', fname] - nm_result = command.RunPipe([cmd], capture=True, + nm_result = command.run_pipe([cmd], capture=True, capture_stderr=True, cwd=result.out_dir, raise_on_error=False, env=env) if nm_result.stdout: @@ -385,7 +385,7 @@ class BuilderThread(threading.Thread): print(nm_result.stdout, end=' ', file=fd) cmd = ['%sobjdump' % self.toolchain.cross, '-h', fname] - dump_result = command.RunPipe([cmd], capture=True, + dump_result = command.run_pipe([cmd], capture=True, capture_stderr=True, cwd=result.out_dir, raise_on_error=False, env=env) rodata_size = '' @@ -400,7 +400,7 @@ class BuilderThread(threading.Thread): rodata_size = fields[2] cmd = ['%ssize' % self.toolchain.cross, fname] - size_result = command.RunPipe([cmd], capture=True, + size_result = command.run_pipe([cmd], capture=True, capture_stderr=True, cwd=result.out_dir, raise_on_error=False, env=env) if size_result.stdout: @@ -411,7 +411,7 @@ class BuilderThread(threading.Thread): cmd = ['%sobjcopy' % self.toolchain.cross, '-O', 'binary', '-j', '.rodata.default_environment', 'env/built-in.o', 'uboot.env'] - command.RunPipe([cmd], capture=True, + command.run_pipe([cmd], capture=True, capture_stderr=True, cwd=result.out_dir, raise_on_error=False, env=env) ubootenv = os.path.join(result.out_dir, 'uboot.env') diff --git a/tools/buildman/control.py b/tools/buildman/control.py index eee81130663..8f4810bc3ef 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -18,7 +18,7 @@ from patman import gitutil from patman import patchstream from patman import terminal from patman import tools -from patman.terminal import Print +from patman.terminal import tprint def GetPlural(count): """Returns a plural 's' if count is not 1""" @@ -73,7 +73,7 @@ def ShowActions(series, why_selected, boards_selected, builder, options, if commits: for upto in range(0, len(series.commits), options.step): commit = series.commits[upto] - print(' ', col.Color(col.YELLOW, commit.hash[:8], bright=False), end=' ') + print(' ', col.build(col.YELLOW, commit.hash[:8], bright=False), end=' ') print(commit.subject) print() for arg in why_selected: @@ -85,7 +85,7 @@ def ShowActions(series, why_selected, boards_selected, builder, options, len(why_selected['all']))) if board_warnings: for warning in board_warnings: - print(col.Color(col.YELLOW, warning)) + print(col.build(col.YELLOW, warning)) def ShowToolchainPrefix(boards, toolchains): """Show information about a the tool chain used by one or more boards @@ -135,12 +135,12 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, global builder if options.full_help: - tools.PrintFullHelp( + tools.print_full_help( os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), 'README') ) return 0 - gitutil.Setup() + gitutil.setup() col = terminal.Color() options.git_dir = os.path.join(options.git, '.git') @@ -152,14 +152,14 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, if options.fetch_arch: if options.fetch_arch == 'list': sorted_list = toolchains.ListArchs() - print(col.Color(col.BLUE, 'Available architectures: %s\n' % + print(col.build(col.BLUE, 'Available architectures: %s\n' % ' '.join(sorted_list))) return 0 else: fetch_arch = options.fetch_arch if fetch_arch == 'all': fetch_arch = ','.join(toolchains.ListArchs()) - print(col.Color(col.CYAN, '\nDownloading toolchains: %s' % + print(col.build(col.CYAN, '\nDownloading toolchains: %s' % fetch_arch)) for arch in fetch_arch.split(','): print() @@ -177,11 +177,11 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, return 0 if options.incremental: - print(col.Color(col.RED, + print(col.build(col.RED, 'Warning: -I has been removed. See documentation')) if not options.output_dir: if options.work_in_output: - sys.exit(col.Color(col.RED, '-w requires that you specify -o')) + sys.exit(col.build(col.RED, '-w requires that you specify -o')) options.output_dir = '..' # Work out what subset of the boards we are building @@ -218,12 +218,12 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, requested_boards) selected = boards.GetSelected() if not len(selected): - sys.exit(col.Color(col.RED, 'No matching boards found')) + sys.exit(col.build(col.RED, 'No matching boards found')) if options.print_prefix: err = ShowToolchainPrefix(boards, toolchains) if err: - sys.exit(col.Color(col.RED, err)) + sys.exit(col.build(col.RED, err)) return 0 # Work out how many commits to build. We want to build everything on the @@ -236,30 +236,30 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, count = 1 else: if has_range: - count, msg = gitutil.CountCommitsInRange(options.git_dir, + count, msg = gitutil.count_commits_in_range(options.git_dir, options.branch) else: - count, msg = gitutil.CountCommitsInBranch(options.git_dir, + count, msg = gitutil.count_commits_in_branch(options.git_dir, options.branch) if count is None: - sys.exit(col.Color(col.RED, msg)) + sys.exit(col.build(col.RED, msg)) elif count == 0: - sys.exit(col.Color(col.RED, "Range '%s' has no commits" % + sys.exit(col.build(col.RED, "Range '%s' has no commits" % options.branch)) if msg: - print(col.Color(col.YELLOW, msg)) + print(col.build(col.YELLOW, msg)) count += 1 # Build upstream commit also if not count: str = ("No commits found to process in branch '%s': " "set branch's upstream or use -c flag" % options.branch) - sys.exit(col.Color(col.RED, str)) + sys.exit(col.build(col.RED, str)) if options.work_in_output: if len(selected) != 1: - sys.exit(col.Color(col.RED, + sys.exit(col.build(col.RED, '-w can only be used with a single board')) if count != 1: - sys.exit(col.Color(col.RED, + sys.exit(col.build(col.RED, '-w can only be used with a single commit')) # Read the metadata from the commits. First look at the upstream commit, @@ -276,9 +276,9 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, if has_range: range_expr = options.branch else: - range_expr = gitutil.GetRangeInBranch(options.git_dir, + range_expr = gitutil.get_range_in_branch(options.git_dir, options.branch) - upstream_commit = gitutil.GetUpstream(options.git_dir, + upstream_commit = gitutil.get_upstream(options.git_dir, options.branch) series = patchstream.get_metadata_for_list(upstream_commit, options.git_dir, 1, series=None, allow_overwrite=True) @@ -307,7 +307,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, if not options.step: options.step = len(series.commits) - 1 - gnu_make = command.Output(os.path.join(options.git, + gnu_make = command.output(os.path.join(options.git, 'scripts/show-gnu-make'), raise_on_error=False).rstrip() if not gnu_make: sys.exit('GNU Make not found') @@ -362,7 +362,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, else: commits = None - Print(GetActionSummary(options.summary, commits, board_selected, + tprint(GetActionSummary(options.summary, commits, board_selected, options)) # We can't show function sizes without board details at present diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index c2e0b0b5c62..6fcceb0ea56 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -205,8 +205,8 @@ class TestFunctional(unittest.TestCase): self._test_branch = TEST_BRANCH # Avoid sending any output and clear all terminal output - terminal.SetPrintTestMode() - terminal.GetPrintTestLines() + terminal.set_print_test_mode() + terminal.get_print_test_lines() def tearDown(self): shutil.rmtree(self._base_dir) @@ -217,7 +217,7 @@ class TestFunctional(unittest.TestCase): self._toolchains.Add('gcc', test=False) def _RunBuildman(self, *args): - return command.RunPipe([[self._buildman_pathname] + list(args)], + return command.run_pipe([[self._buildman_pathname] + list(args)], capture=True, capture_stderr=True) def _RunControl(self, *args, boards=None, clean_dir=False, @@ -267,11 +267,11 @@ class TestFunctional(unittest.TestCase): def testGitSetup(self): """Test gitutils.Setup(), from outside the module itself""" command.test_result = command.CommandResult(return_code=1) - gitutil.Setup() + gitutil.setup() self.assertEqual(gitutil.use_no_decorate, False) command.test_result = command.CommandResult(return_code=0) - gitutil.Setup() + gitutil.setup() self.assertEqual(gitutil.use_no_decorate, True) def _HandleCommandGitLog(self, args): @@ -407,7 +407,7 @@ class TestFunctional(unittest.TestCase): stage: Stage that we are at (mrproper, config, build) cwd: Directory where make should be run args: Arguments to pass to make - kwargs: Arguments to pass to command.RunPipe() + kwargs: Arguments to pass to command.run_pipe() """ self._make_calls += 1 if stage == 'mrproper': @@ -422,7 +422,7 @@ class TestFunctional(unittest.TestCase): if arg.startswith('O='): out_dir = arg[2:] fname = os.path.join(cwd or '', out_dir, 'u-boot') - tools.WriteFile(fname, b'U-Boot') + tools.write_file(fname, b'U-Boot') if type(commit) is not str: stderr = self._error.get((brd.target, commit.sequence)) if stderr: @@ -438,7 +438,7 @@ class TestFunctional(unittest.TestCase): print(len(lines)) for line in lines: print(line) - #self.print_lines(terminal.GetPrintTestLines()) + #self.print_lines(terminal.get_print_test_lines()) def testNoBoards(self): """Test that buildman aborts when there are no boards""" @@ -450,7 +450,7 @@ class TestFunctional(unittest.TestCase): """Very simple test to invoke buildman on the current source""" self.setupToolchains(); self._RunControl('-o', self._output_dir) - lines = terminal.GetPrintTestLines() + lines = terminal.get_print_test_lines() self.assertIn('Building current source for %d boards' % len(boards), lines[0].text) @@ -463,7 +463,7 @@ class TestFunctional(unittest.TestCase): """Test that missing toolchains are detected""" self.setupToolchains(); ret_code = self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir) - lines = terminal.GetPrintTestLines() + lines = terminal.get_print_test_lines() # Buildman always builds the upstream commit as well self.assertIn('Building %d commits for %d boards' % diff --git a/tools/buildman/main.py b/tools/buildman/main.py index c6af311a69b..01271061e6c 100755 --- a/tools/buildman/main.py +++ b/tools/buildman/main.py @@ -41,12 +41,12 @@ def RunTests(skip_net_tests, verboose, args): # Run the entry tests first ,since these need to be the first to import the # 'entry' module. - test_util.RunTestSuites( + test_util.run_test_suites( result, False, verboose, False, None, test_name, [], [test.TestBuild, func_test.TestFunctional, 'buildman.toolchain', 'patman.gitutil']) - return test_util.ReportResult('buildman', test_name, result) + return test_util.report_result('buildman', test_name, result) options, args = cmdline.ParseArgs() diff --git a/tools/buildman/test.py b/tools/buildman/test.py index 2751377e879..714bb3e4f91 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -148,7 +148,7 @@ class TestBuild(unittest.TestCase): self.toolchains.Add('gcc', test=False) # Avoid sending any output - terminal.SetPrintTestMode() + terminal.set_print_test_mode() self._col = terminal.Color() self.base_dir = tempfile.mkdtemp() @@ -182,10 +182,10 @@ class TestBuild(unittest.TestCase): col.YELLOW if outcome == OUTCOME_WARN else col.RED) expect = '%10s: ' % arch # TODO([email protected]): If plus is '', we shouldn't need this - expect += ' ' + col.Color(expected_colour, plus) + expect += ' ' + col.build(expected_colour, plus) expect += ' ' for board in boards: - expect += col.Color(expected_colour, ' %s' % board) + expect += col.build(expected_colour, ' %s' % board) self.assertEqual(text, expect) def _SetupTest(self, echo_lines=False, threads=1, **kwdisplay_args): @@ -209,7 +209,7 @@ class TestBuild(unittest.TestCase): # associated with each. This calls our Make() to inject the fake output. build.BuildBoards(self.commits, board_selected, keep_outputs=False, verbose=False) - lines = terminal.GetPrintTestLines() + lines = terminal.get_print_test_lines() count = 0 for line in lines: if line.text.strip(): @@ -221,8 +221,8 @@ class TestBuild(unittest.TestCase): build.SetDisplayOptions(**kwdisplay_args); build.ShowSummary(self.commits, board_selected) if echo_lines: - terminal.EchoPrintTestLines() - return iter(terminal.GetPrintTestLines()) + terminal.echo_print_test_lines() + return iter(terminal.get_print_test_lines()) def _CheckOutput(self, lines, list_error_boards=False, filter_dtb_warnings=False, @@ -254,12 +254,12 @@ class TestBuild(unittest.TestCase): new_lines = [] for line in lines: if boards: - expect = self._col.Color(colour, prefix + '(') - expect += self._col.Color(self._col.MAGENTA, boards, + expect = self._col.build(colour, prefix + '(') + expect += self._col.build(self._col.MAGENTA, boards, bright=False) - expect += self._col.Color(colour, ') %s' % line) + expect += self._col.build(colour, ') %s' % line) else: - expect = self._col.Color(colour, prefix + line) + expect = self._col.build(colour, prefix + line) new_lines.append(expect) return '\n'.join(new_lines) @@ -317,12 +317,12 @@ class TestBuild(unittest.TestCase): self.assertEqual(next(lines).text, '04: %s' % commits[3][1]) if filter_migration_warnings: expect = '%10s: ' % 'powerpc' - expect += ' ' + col.Color(col.GREEN, '') + expect += ' ' + col.build(col.GREEN, '') expect += ' ' - expect += col.Color(col.GREEN, ' %s' % 'board2') - expect += ' ' + col.Color(col.YELLOW, 'w+') + expect += col.build(col.GREEN, ' %s' % 'board2') + expect += ' ' + col.build(col.YELLOW, 'w+') expect += ' ' - expect += col.Color(col.YELLOW, ' %s' % 'board3') + expect += col.build(col.YELLOW, ' %s' % 'board3') self.assertEqual(next(lines).text, expect) else: self.assertSummary(next(lines).text, 'powerpc', 'w+', @@ -607,7 +607,7 @@ class TestBuild(unittest.TestCase): def testPrepareOutputSpace(self): def _Touch(fname): - tools.WriteFile(os.path.join(base_dir, fname), b'') + tools.write_file(os.path.join(base_dir, fname), b'') base_dir = tempfile.mkdtemp() diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index adc75a7a0b7..46a4e5ed409 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -99,7 +99,7 @@ class Toolchain: else: self.priority = priority if test: - result = command.RunPipe([cmd], capture=True, env=env, + result = command.run_pipe([cmd], capture=True, env=env, raise_on_error=False) self.ok = result.return_code == 0 if verbose: @@ -201,11 +201,11 @@ class Toolchain: # We'll use MakeArgs() to provide this pass elif full_path: - env[b'CROSS_COMPILE'] = tools.ToBytes( + env[b'CROSS_COMPILE'] = tools.to_bytes( wrapper + os.path.join(self.path, self.cross)) else: - env[b'CROSS_COMPILE'] = tools.ToBytes(wrapper + self.cross) - env[b'PATH'] = tools.ToBytes(self.path) + b':' + env[b'PATH'] + env[b'CROSS_COMPILE'] = tools.to_bytes(wrapper + self.cross) + env[b'PATH'] = tools.to_bytes(self.path) + b':' + env[b'PATH'] env[b'LC_ALL'] = b'C' @@ -381,7 +381,7 @@ class Toolchains: def List(self): """List out the selected toolchains for each architecture""" col = terminal.Color() - print(col.Color(col.BLUE, 'List of available toolchains (%d):' % + print(col.build(col.BLUE, 'List of available toolchains (%d):' % len(self.toolchains))) if len(self.toolchains): for key, value in sorted(self.toolchains.items()): @@ -494,7 +494,7 @@ class Toolchains: else URL containing this toolchain, if avaialble, else None """ - arch = command.OutputOneLine('uname', '-m') + arch = command.output_one_line('uname', '-m') if arch == 'aarch64': arch = 'arm64' base = 'https://www.kernel.org/pub/tools/crosstool/files/bin' @@ -504,7 +504,7 @@ class Toolchains: url = '%s/%s/%s/' % (base, arch, version) print('Checking: %s' % url) response = urllib.request.urlopen(url) - html = tools.ToString(response.read()) + html = tools.to_string(response.read()) parser = MyHTMLParser(fetch_arch) parser.feed(html) if fetch_arch == 'list': @@ -525,7 +525,7 @@ class Toolchains: Directory name of the first entry in the archive, without the trailing / """ - stdout = command.Output('tar', 'xvfJ', fname, '-C', dest) + stdout = command.output('tar', 'xvfJ', fname, '-C', dest) dirs = stdout.splitlines()[1].split('/')[:2] return '/'.join(dirs) @@ -559,7 +559,7 @@ class Toolchains: """ # Fist get the URL for this architecture col = terminal.Color() - print(col.Color(col.BLUE, "Downloading toolchain for arch '%s'" % arch)) + print(col.build(col.BLUE, "Downloading toolchain for arch '%s'" % arch)) url = self.LocateArchUrl(arch) if not url: print(("Cannot find toolchain for arch '%s' - use 'list' to list" % @@ -571,10 +571,10 @@ class Toolchains: os.mkdir(dest) # Download the tar file for this toolchain and unpack it - tarfile, tmpdir = tools.Download(url, '.buildman') + tarfile, tmpdir = tools.download(url, '.buildman') if not tarfile: return 1 - print(col.Color(col.GREEN, 'Unpacking to: %s' % dest), end=' ') + print(col.build(col.GREEN, 'Unpacking to: %s' % dest), end=' ') sys.stdout.flush() path = self.Unpack(tarfile, dest) os.remove(tarfile) @@ -582,14 +582,14 @@ class Toolchains: print() # Check that the toolchain works - print(col.Color(col.GREEN, 'Testing')) + print(col.build(col.GREEN, 'Testing')) dirpath = os.path.join(dest, path) compiler_fname_list = self.ScanPath(dirpath, True) if not compiler_fname_list: print('Could not locate C compiler - fetch failed.') return 1 if len(compiler_fname_list) != 1: - print(col.Color(col.RED, 'Warning, ambiguous toolchains: %s' % + print(col.build(col.RED, 'Warning, ambiguous toolchains: %s' % ', '.join(compiler_fname_list))) toolchain = Toolchain(compiler_fname_list[0], True, True) |
