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 and args[0] or None test_util.RunTestSuites( result, debug=True, verbosity=1, test_preserve_dirs=False, processes=processes, test_name=test_name, toolpath=[], test_class_list=[test_dtoc.TestDtoc, test_src_scan.TestSrcScan]) return test_util.ReportResult('binman', 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.RunTestSuites(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.ReportResult('binman', test_name, result)