def run_tests(processes, args): """Run all the test we have for dtoc Args: processes: Number of processes to use to run tests (None=same as #CPUs) args: List of positional args provided to dtoc. This can hold a test name to execute (as in 'dtoc -t test_empty_file', for example) """ from dtoc import test_src_scan from dtoc import test_dtoc result = unittest.TestResult() sys.argv = [sys.argv[0]] test_name = args.files and args.files[0] or None test_dtoc.setup() test_util.run_test_suites( result, debug=True, verbosity=1, test_preserve_dirs=False, processes=processes, test_name=test_name, toolpath=[], class_and_module_list=[test_dtoc.TestDtoc, test_src_scan.TestSrcScan]) return test_util.report_result('binman', test_name, result)
def RunTests(skip_net_tests, verboose, args): from buildman import func_test from buildman import test import doctest result = unittest.TestResult() test_name = args and args[0] or None if skip_net_tests: test.use_network = False # Run the entry tests first ,since these need to be the first to import the # 'entry' module. test_util.run_test_suites(result, False, verboose, False, None, test_name, [], [ test.TestBuild, func_test.TestFunctional, 'buildman.toolchain', 'patman.gitutil' ]) return test_util.report_result('buildman', test_name, result)
def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath): """Run the functional tests and any embedded doctests Args: debug: True to enable debugging, which shows a full stack trace on error verbosity: Verbosity level to use test_preserve_dirs: True to preserve the input directory used by tests so that it can be examined afterwards (only useful for debugging tests). If a single test is selected (in args[0]) it also preserves the output directory for this test. Both directories are displayed on the command line. processes: Number of processes to use to run tests (None=same as #CPUs) args: List of positional args provided to binman. This can hold a test name to execute (as in 'binman test testSections', for example) toolpath: List of paths to use for tools """ from binman import bintool_test from binman import cbfs_util_test from binman import elf_test from binman import entry_test from binman import fdt_test from binman import fip_util_test from binman import ftest from binman import image_test import doctest result = unittest.TestResult() test_name = args and args[0] or None # Run the entry tests first ,since these need to be the first to import the # 'entry' module. test_util.run_test_suites( result, debug, verbosity, test_preserve_dirs, processes, test_name, toolpath, [ bintool_test.TestBintool, entry_test.TestEntry, ftest.TestFunctional, fdt_test.TestFdt, elf_test.TestElf, image_test.TestImage, cbfs_util_test.TestCbfs, fip_util_test.TestFip ]) return test_util.report_result('binman', test_name, result)
if not args.debug: sys.tracebacklimit = 0 # Run our meagre tests if args.cmd == 'test': import doctest from patman import func_test result = unittest.TestResult() test_util.run_test_suites(result, False, False, False, None, None, None, [ test_checkpatch.TestPatch, func_test.TestFunctional, 'gitutil', 'settings', 'terminal' ]) sys.exit(test_util.report_result('patman', args.testname, result)) # Process commits, produce patches files, check them, email them elif args.cmd == 'send': # Called from git with a patch filename as argument # Printout a list of additional CC recipients for this patch if args.cc_cmd: fd = open(args.cc_cmd, 'r') re_line = re.compile('(\S*) (.*)') for line in fd.readlines(): match = re_line.match(line) if match and match.group(1) == args.patchfiles[0]: for cc in match.group(2).split('\0'): cc = cc.strip() if cc: print(cc)