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>
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index d3e6e67..ffef213 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -274,7 +274,7 @@
@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 @@
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():
diff --git a/tools/binman/main.py b/tools/binman/main.py
index 326f5c9..fa5ad79 100755
--- a/tools/binman/main.py
+++ b/tools/binman/main.py
@@ -77,8 +77,8 @@
# 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])
diff --git a/tools/buildman/main.py b/tools/buildman/main.py
index 72571b2..77b9beb 100755
--- a/tools/buildman/main.py
+++ b/tools/buildman/main.py
@@ -49,7 +49,7 @@
# 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)
diff --git a/tools/dtoc/main.py b/tools/dtoc/main.py
index 6c91450..59b98b0 100755
--- a/tools/dtoc/main.py
+++ b/tools/dtoc/main.py
@@ -58,8 +58,9 @@
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)
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 0b01518..a0bed4e 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -969,7 +969,7 @@
"""
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)
diff --git a/tools/patman/__main__.py b/tools/patman/__main__.py
index 0d08a53..db78ea6 100755
--- a/tools/patman/__main__.py
+++ b/tools/patman/__main__.py
@@ -38,7 +38,7 @@
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'])
diff --git a/tools/u_boot_pylib/__main__.py b/tools/u_boot_pylib/__main__.py
index c0762bc..d86b9d7 100755
--- a/tools/u_boot_pylib/__main__.py
+++ b/tools/u_boot_pylib/__main__.py
@@ -16,7 +16,7 @@
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)
diff --git a/tools/u_boot_pylib/test_util.py b/tools/u_boot_pylib/test_util.py
index fc441a7..d258a19 100644
--- a/tools/u_boot_pylib/test_util.py
+++ b/tools/u_boot_pylib/test_util.py
@@ -12,6 +12,7 @@
import unittest
from u_boot_pylib import command
+from u_boot_pylib import terminal
use_concurrent = True
try:
@@ -155,8 +156,8 @@
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 @@
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 @@
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