diff mbox series

[v2,03/11] patman: Don't buffer test output with a single test

Message ID 20220813174051.1813081-4-sjg@chromium.org
State Accepted
Commit 10463136fdfed16df52e3f5c24492ef3a269b59f
Delegated to: Simon Glass
Headers show
Series binman: Enhancements to binman mkimage | expand

Commit Message

Simon Glass Aug. 13, 2022, 5:40 p.m. UTC
When a single test is run we don't need to buffer the test output. This
has the unfortunate side effect of suppressing test output, in particular
the binman output directory normally printed with the -X option. This is
a huge problem since it blocks debugging of tests.

We don't actually know how many tests will be run when we set up the
suite, so as a work-around, assume that test_name being specified
indicates that there is likely only one.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 tools/patman/test_util.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Glass Aug. 21, 2022, 12:10 a.m. UTC | #1
When a single test is run we don't need to buffer the test output. This
has the unfortunate side effect of suppressing test output, in particular
the binman output directory normally printed with the -X option. This is
a huge problem since it blocks debugging of tests.

We don't actually know how many tests will be run when we set up the
suite, so as a work-around, assume that test_name being specified
indicates that there is likely only one.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 tools/patman/test_util.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py
index 7df2aec6705..0f6d1aa902d 100644
--- a/tools/patman/test_util.py
+++ b/tools/patman/test_util.py
@@ -208,14 +208,14 @@  def run_test_suites(toolname, debug, verbosity, test_preserve_dirs, processes,
     runner = unittest.TextTestRunner(
         stream=sys.stdout,
         verbosity=(1 if verbosity is None else verbosity),
-        buffer=buffer_outputs,
+        buffer=False if test_name else buffer_outputs,
         resultclass=FullTextTestResult,
     )
 
     if use_concurrent and processes != 1:
         suite = ConcurrentTestSuite(suite,
                 fork_for_tests(processes or multiprocessing.cpu_count(),
-                               buffer=buffer_outputs))
+                               buffer=False if test_name else buffer_outputs))
 
     for module in class_and_module_list:
         if isinstance(module, str) and (not test_name or test_name == module):