From ac766b065a8032e4aa90dafef2130292364a2483 Mon Sep 17 00:00:00 2001 From: xudan Date: Mon, 10 Apr 2017 08:15:03 +0000 Subject: dovetail tool: show progress during executing test cases JIRA: DOVETAIL-159 1. It takes long time to execute test cases that most of users think it hangs there, so a progress is needed to show the test is running. 2. add dynamic progress during execution 3. it' s a fake progress only showing the test is alive, not to show the percentage of completion. Change-Id: I0294659f79e8e09d1bcdd36d8f391d933e35b635 Signed-off-by: xudan --- dovetail/utils/dovetail_utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'dovetail/utils/dovetail_utils.py') diff --git a/dovetail/utils/dovetail_utils.py b/dovetail/utils/dovetail_utils.py index e72a37ca..766bb646 100644 --- a/dovetail/utils/dovetail_utils.py +++ b/dovetail/utils/dovetail_utils.py @@ -48,9 +48,14 @@ def exec_cmd(cmd, logger=None, exit_on_error=False, info=False, p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdout = '' + count = 1 + DEBUG = os.getenv('DEBUG') for line in iter(p.stdout.readline, b''): exec_log(verbose, logger, line.strip(), level, True) stdout += line + if DEBUG is None or DEBUG.lower() != "true": + show_progress_bar(count) + count += 1 stdout = stdout.strip() returncode = p.wait() p.stdout.close() @@ -144,5 +149,5 @@ def show_progress_bar(length): length %= max_len sys.stdout.write('Running ' + ' ' * max_len + '\r') sys.stdout.flush() - sys.stdout.write('Running ' + '=' * length + '>' + '\r') + sys.stdout.write('Running ' + '.' * length + '\r') sys.stdout.flush() -- cgit 1.2.3-korg