summaryrefslogtreecommitdiffstats
path: root/dovetail/utils/dovetail_utils.py
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2017-04-10 08:15:03 +0000
committerxudan <xudan16@huawei.com>2017-04-10 08:15:03 +0000
commitac766b065a8032e4aa90dafef2130292364a2483 (patch)
tree2fb14e17ab9122327a81c3da75ce23ac54da607a /dovetail/utils/dovetail_utils.py
parent002d7cb256e4f0753f4b738d7f3d2a7872704314 (diff)
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 <xudan16@huawei.com>
Diffstat (limited to 'dovetail/utils/dovetail_utils.py')
-rw-r--r--dovetail/utils/dovetail_utils.py7
1 files changed, 6 insertions, 1 deletions
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()