All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 15/17] patman: Don't clear progress in tout unless it was used
Date: Mon,  1 Oct 2018 21:12:45 -0600	[thread overview]
Message-ID: <20181002031247.93384-16-sjg@chromium.org> (raw)
In-Reply-To: <20181002031247.93384-1-sjg@chromium.org>

At present calling Uninit() always called ClearProgress() which outputs
a \r character as well as spaces to remove any progress information on the
line. This can mess up the normal output of binman and other tools. Fix
this by outputing this only when progress information has actually been
previous written.

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

Changes in v2: None

 tools/patman/tout.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/patman/tout.py b/tools/patman/tout.py
index 4cd49e1c685..4957c7ae1df 100644
--- a/tools/patman/tout.py
+++ b/tools/patman/tout.py
@@ -15,6 +15,8 @@ NOTICE = 2
 INFO = 3
 DEBUG = 4
 
+in_progress = False
+
 """
 This class handles output of progress and other useful information
 to the user. It provides for simple verbosity level control and can
@@ -48,9 +50,11 @@ def UserIsPresent():
 
 def ClearProgress():
     """Clear any active progress message on the terminal."""
-    if verbose > 0 and stdout_is_tty:
+    global in_progress
+    if verbose > 0 and stdout_is_tty and in_progress:
         _stdout.write('\r%s\r' % (" " * len (_progress)))
         _stdout.flush()
+        in_progress = False
 
 def Progress(msg, warning=False, trailer='...'):
     """Display progress information.
@@ -58,6 +62,7 @@ def Progress(msg, warning=False, trailer='...'):
     Args:
         msg: Message to display.
         warning: True if this is a warning."""
+    global in_progress
     ClearProgress()
     if verbose > 0:
         _progress = msg + trailer
@@ -65,6 +70,7 @@ def Progress(msg, warning=False, trailer='...'):
             col = _color.YELLOW if warning else _color.GREEN
             _stdout.write('\r' + _color.Color(col, _progress))
             _stdout.flush()
+            in_progress = True
         else:
             _stdout.write(_progress + '\n')
 
-- 
2.19.0.605.g01d371f741-goog

  parent reply	other threads:[~2018-10-02  3:12 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02  3:12 [U-Boot] [PATCH v2 00/17] test: Various test refinements and improvements Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 01/17] test/py: ignore console read exceptions after test failure Simon Glass
2018-10-04 16:01   ` Stephen Warren
2018-10-04 16:27     ` Simon Glass
2018-10-10  0:01     ` sjg at google.com
2018-10-02  3:12 ` [U-Boot] [PATCH v2 02/17] sandbox: Unprotect DATA regions in bus tests Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 03/17] patman: Handle unicode in _ProjectConfigParser tests Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 04/17] test/py: Fix unicode handling for log filtering Simon Glass
2018-10-05  8:08   ` Michal Simek
2018-10-10  0:01   ` sjg at google.com
2018-10-02  3:12 ` [U-Boot] [PATCH v2 05/17] buildman: Make the toolchain test more forgiving Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 06/17] Makefile: Add a 'check' target for make Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 07/17] test: Simplify the PATH setup Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 08/17] test: Print the name of each test before running it Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 09/17] test: Tidy up comments and variable name Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 10/17] binman: Add a default path to libfdt.py Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 11/17] binman: Fix up removal of temporary directories Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 12/17] binman: Separate out testSplBssPad() Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 13/17] buildman: dtoc: Suppress unwanted output from test Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 14/17] tools: Set an initial value for indir Simon Glass
2018-10-02  3:12 ` Simon Glass [this message]
2018-10-02  3:12 ` [U-Boot] [PATCH v2 16/17] test: Reduce the number of tests run with sandbox_flattree Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 17/17] binman: Run tests concurrently Simon Glass
2018-10-10  0:01 ` sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 16/17] test: Reduce the number of tests run with sandbox_flattree sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 15/17] patman: Don't clear progress in tout unless it was used sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 14/17] tools: Set an initial value for indir sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 13/17] buildman: dtoc: Suppress unwanted output from test sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 12/17] binman: Separate out testSplBssPad() sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 11/17] binman: Fix up removal of temporary directories sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 10/17] binman: Add a default path to libfdt.py sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 09/17] test: Tidy up comments and variable name sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 08/17] test: Print the name of each test before running it sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 07/17] test: Simplify the PATH setup sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 06/17] Makefile: Add a 'check' target for make sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 05/17] buildman: Make the toolchain test more forgiving sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 03/17] patman: Handle unicode in _ProjectConfigParser tests sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 02/17] sandbox: Unprotect DATA regions in bus tests sjg at google.com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181002031247.93384-16-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.