diff options
author | Simon Glass <sjg@chromium.org> | 2023-02-24 04:18:18 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2023-03-08 22:40:49 +0300 |
commit | 952a61adb4537843855e2c35a57646c25abc6128 (patch) | |
tree | 1e8e6d6561433af8cc2ea64fb3b37a14dfaa0b48 | |
parent | 77b3ccb89ae373d054533f5f4a4192a4ba020405 (diff) | |
download | u-boot-952a61adb4537843855e2c35a57646c25abc6128.tar.xz |
binman: Move the main code into a function
Put this code into a function so it is easy for it be run when packaged.
Signed-off-by: Simon Glass <sjg@chromium.org>
-rwxr-xr-x | tools/binman/main.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/binman/main.py b/tools/binman/main.py index eef17b7b55..92d2431aea 100755 --- a/tools/binman/main.py +++ b/tools/binman/main.py @@ -85,7 +85,7 @@ def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath): return (0 if result.wasSuccessful() else 1) -def RunTestCoverage(toolpath): +def RunTestCoverage(toolpath, build_dir): """Run the tests and check that we get 100% coverage""" glob_list = control.GetEntryModules(False) all_set = set([os.path.splitext(os.path.basename(item))[0] @@ -97,7 +97,7 @@ def RunTestCoverage(toolpath): test_util.run_test_coverage('tools/binman/binman', None, ['*test*', '*main.py', 'tools/patman/*', 'tools/dtoc/*', 'tools/u_boot_pylib/*'], - args.build_dir, all_set, extra_args or None) + build_dir, all_set, extra_args or None) def RunBinman(args): """Main entry point to binman once arguments are parsed @@ -117,7 +117,7 @@ def RunBinman(args): if args.cmd == 'test': if args.test_coverage: - RunTestCoverage(args.toolpath) + RunTestCoverage(args.toolpath, args.build_dir) else: ret_code = RunTests(args.debug, args.verbosity, args.processes, args.test_preserve_dirs, args.tests, @@ -141,8 +141,12 @@ def RunBinman(args): return ret_code -if __name__ == "__main__": +def start_binman(): args = cmdline.ParseArgs(sys.argv[1:]) ret_code = RunBinman(args) sys.exit(ret_code) + + +if __name__ == "__main__": + start_binman() |