X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tools%2Fbinman%2Fmain.py;h=8c1e478d54cea8342a829808c14d70f393c50dba;hb=7a1a01c6029039e4fa6aa185cdbbf9a357eecba7;hp=8736938d119f9dc4ee1449e8ea17f304d733b5a3;hpb=16287933a852bab2ac4985a770e08c9aa69d21b1;p=platform%2Fkernel%2Fu-boot.git diff --git a/tools/binman/main.py b/tools/binman/main.py index 8736938..8c1e478 100755 --- a/tools/binman/main.py +++ b/tools/binman/main.py @@ -10,7 +10,6 @@ """See README for more information""" from distutils.sysconfig import get_python_lib -import glob import os import site import sys @@ -20,11 +19,13 @@ import unittest # Bring in the patman and dtoc libraries (but don't override the first path # in PYTHONPATH) our_path = os.path.dirname(os.path.realpath(__file__)) -for dirname in ['../patman', '../dtoc', '../concurrencytest', '..']: - sys.path.insert(2, os.path.realpath(os.path.join(our_path, dirname))) +sys.path.insert(2, os.path.join(our_path, '..')) + +from patman import test_util # Bring in the libfdt module sys.path.insert(2, 'scripts/dtc/pylibfdt') +sys.path.insert(2, os.path.join(our_path, '../../scripts/dtc/pylibfdt')) sys.path.insert(2, os.path.join(our_path, '../../build-sandbox_spl/scripts/dtc/pylibfdt')) @@ -36,7 +37,7 @@ sys.path.append(get_python_lib()) from binman import cmdline from binman import control -import test_util +from patman import test_util def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath): """Run the functional tests and any embedded doctests @@ -60,7 +61,6 @@ def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath): from binman import fdt_test from binman import ftest from binman import image_test - from binman import test import doctest result = unittest.TestResult() @@ -76,25 +76,18 @@ def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath): return test_util.ReportResult('binman', test_name, result) -def GetEntryModules(include_testing=True): - """Get a set of entry class implementations - - Returns: - Set of paths to entry class filenames - """ - glob_list = glob.glob(os.path.join(our_path, 'etype/*.py')) - return set([os.path.splitext(os.path.basename(item))[0] - for item in glob_list - if include_testing or '_testing' not in item]) - -def RunTestCoverage(): +def RunTestCoverage(toolpath): """Run the tests and check that we get 100% coverage""" - glob_list = GetEntryModules(False) + glob_list = control.GetEntryModules(False) all_set = set([os.path.splitext(os.path.basename(item))[0] for item in glob_list if '_testing' not in item]) + extra_args = '' + if toolpath: + for path in toolpath: + extra_args += ' --toolpath %s' % path test_util.RunTestCoverage('tools/binman/binman', None, ['*test*', '*main.py', 'tools/patman/*', 'tools/dtoc/*'], - args.build_dir, all_set) + args.build_dir, all_set, extra_args or None) def RunBinman(args): """Main entry point to binman once arguments are parsed @@ -107,22 +100,27 @@ def RunBinman(args): if not args.debug: sys.tracebacklimit = 0 + # Provide a default toolpath in the hope of finding a mkimage built from + # current source + if not args.toolpath: + args.toolpath = ['./tools', 'build-sandbox/tools'] + if args.cmd == 'test': if args.test_coverage: - RunTestCoverage() + RunTestCoverage(args.toolpath) else: ret_code = RunTests(args.debug, args.verbosity, args.processes, args.test_preserve_dirs, args.tests, args.toolpath) elif args.cmd == 'entry-docs': - control.WriteEntryDocs(GetEntryModules()) + control.WriteEntryDocs(control.GetEntryModules()) else: try: ret_code = control.Binman(args) except Exception as e: - print('binman: %s' % e) + print('binman: %s' % e, file=sys.stderr) if args.debug: print() traceback.print_exc()