mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-05-05 20:56:12 +02:00
tools: Plumb in capture control
Add control of capturing output into u_boot_pylib and the tools which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
9dee86cf53
commit
a61635d2af
@ -274,7 +274,7 @@ class TestFunctional(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setup_test_args(cls, preserve_indir=False, preserve_outdirs=False,
|
||||
toolpath=None, verbosity=None):
|
||||
toolpath=None, verbosity=None, no_capture=False):
|
||||
"""Accept arguments controlling test execution
|
||||
|
||||
Args:
|
||||
@ -289,6 +289,7 @@ class TestFunctional(unittest.TestCase):
|
||||
cls.preserve_outdirs = preserve_outdirs
|
||||
cls.toolpath = toolpath
|
||||
cls.verbosity = verbosity
|
||||
cls.no_capture = no_capture
|
||||
|
||||
def _CheckBintool(self, bintool):
|
||||
if not bintool.is_present():
|
||||
|
||||
@ -77,8 +77,8 @@ def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath):
|
||||
# Run the entry tests first ,since these need to be the first to import the
|
||||
# 'entry' module.
|
||||
result = test_util.run_test_suites(
|
||||
'binman', debug, verbosity, test_preserve_dirs, processes, test_name,
|
||||
toolpath,
|
||||
'binman', debug, verbosity, False, 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])
|
||||
|
||||
@ -49,7 +49,7 @@ def run_tests(skip_net_tests, debug, verbose, args):
|
||||
# Run the entry tests first ,since these need to be the first to import the
|
||||
# 'entry' module.
|
||||
result = test_util.run_test_suites(
|
||||
'buildman', debug, verbose, False, args.threads, test_name, [],
|
||||
'buildman', debug, verbose, False, False, args.threads, test_name, [],
|
||||
[test.TestBuild, func_test.TestFunctional, 'buildman.toolchain'])
|
||||
|
||||
return (0 if result.wasSuccessful() else 1)
|
||||
|
||||
@ -58,8 +58,9 @@ def run_tests(processes, args):
|
||||
test_dtoc.setup()
|
||||
|
||||
result = test_util.run_test_suites(
|
||||
toolname='dtoc', debug=True, verbosity=1, test_preserve_dirs=False,
|
||||
processes=processes, test_name=test_name, toolpath=[],
|
||||
toolname='dtoc', debug=True, verbosity=1, no_capture=False,
|
||||
test_preserve_dirs=False, processes=processes, test_name=test_name,
|
||||
toolpath=[],
|
||||
class_and_module_list=[test_dtoc.TestDtoc,test_src_scan.TestSrcScan])
|
||||
|
||||
return (0 if result.wasSuccessful() else 1)
|
||||
|
||||
@ -969,7 +969,7 @@ def run_tests(names, processes):
|
||||
"""
|
||||
test_name = names[0] if names else None
|
||||
result = test_util.run_test_suites(
|
||||
'test_fdt', False, False, False, processes, test_name, None,
|
||||
'test_fdt', False, False, False, False, processes, test_name, None,
|
||||
[TestFdt, TestNode, TestProp, TestFdtUtil])
|
||||
|
||||
return (0 if result.wasSuccessful() else 1)
|
||||
|
||||
@ -38,7 +38,7 @@ def run_patman():
|
||||
from patman import test_checkpatch
|
||||
|
||||
result = test_util.run_test_suites(
|
||||
'patman', False, False, False, None, None, None,
|
||||
'patman', False, False, False, False, None, None, None,
|
||||
[test_checkpatch.TestPatch, func_test.TestFunctional,
|
||||
'settings'])
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ if __name__ == "__main__":
|
||||
from u_boot_pylib import test_util
|
||||
|
||||
result = test_util.run_test_suites(
|
||||
'u_boot_pylib', False, False, False, None, None, None,
|
||||
'u_boot_pylib', False, False, False, False, None, None, None,
|
||||
['terminal'])
|
||||
|
||||
sys.exit(0 if result.wasSuccessful() else 1)
|
||||
|
||||
@ -12,6 +12,7 @@ import sys
|
||||
import unittest
|
||||
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import terminal
|
||||
|
||||
use_concurrent = True
|
||||
try:
|
||||
@ -155,8 +156,8 @@ class FullTextTestResult(unittest.TextTestResult):
|
||||
super().addSkip(test, reason)
|
||||
|
||||
|
||||
def run_test_suites(toolname, debug, verbosity, test_preserve_dirs, processes,
|
||||
test_name, toolpath, class_and_module_list):
|
||||
def run_test_suites(toolname, debug, verbosity, no_capture, test_preserve_dirs,
|
||||
processes, test_name, toolpath, class_and_module_list):
|
||||
"""Run a series of test suites and collect the results
|
||||
|
||||
Args:
|
||||
@ -179,6 +180,9 @@ def run_test_suites(toolname, debug, verbosity, test_preserve_dirs, processes,
|
||||
sys.argv.append('-D')
|
||||
if verbosity:
|
||||
sys.argv.append('-v%d' % verbosity)
|
||||
if no_capture:
|
||||
sys.argv.append('-N')
|
||||
terminal.USE_CAPTURE = False
|
||||
if toolpath:
|
||||
for path in toolpath:
|
||||
sys.argv += ['--toolpath', path]
|
||||
@ -207,7 +211,7 @@ def run_test_suites(toolname, debug, verbosity, test_preserve_dirs, processes,
|
||||
setup_test_args = getattr(module, 'setup_test_args')
|
||||
setup_test_args(preserve_indir=test_preserve_dirs,
|
||||
preserve_outdirs=test_preserve_dirs and test_name is not None,
|
||||
toolpath=toolpath, verbosity=verbosity)
|
||||
toolpath=toolpath, verbosity=verbosity, no_capture=no_capture)
|
||||
if test_name:
|
||||
# Since Python v3.5 If an ImportError or AttributeError occurs
|
||||
# while traversing a name then a synthetic test that raises that
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user