diff options
author | jose.lausuch <jose.lausuch@ericsson.com> | 2016-07-19 15:38:38 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-07-19 15:38:38 +0000 |
commit | e146706253b32bb5513e498c5703b32d8969ca17 (patch) | |
tree | eeef421cb047f00cf706d839fa0a2639d790ca1c | |
parent | 40bbe6cd80940e3ed320dca8b8ac7917353b5fcd (diff) | |
parent | 6e46af35376e25ee58069f651e2ec5ff765d3a09 (diff) |
Merge "Show real time tempest test execution"
-rwxr-xr-x | testcases/OpenStack/tempest/run_tempest.py | 25 | ||||
-rw-r--r-- | utils/functest_utils.py | 3 |
2 files changed, 23 insertions, 5 deletions
diff --git a/testcases/OpenStack/tempest/run_tempest.py b/testcases/OpenStack/tempest/run_tempest.py index c773091bb..452e1fdd8 100755 --- a/testcases/OpenStack/tempest/run_tempest.py +++ b/testcases/OpenStack/tempest/run_tempest.py @@ -312,18 +312,35 @@ def run_tempest(OPTION): f_env = open(TEMPEST_RESULTS_DIR + "/environment.log", 'w+') f_env.write(header) - subprocess.call(cmd_line, shell=True, stdout=f_stdout, stderr=f_stderr) + # subprocess.call(cmd_line, shell=True, stdout=f_stdout, stderr=f_stderr) + p = subprocess.Popen( + cmd_line, shell=True, + stdout=subprocess.PIPE, + stderr=f_stderr, + bufsize=1) + + with p.stdout: + for line in iter(p.stdout.readline, b''): + if re.search("\} tempest\.", line): + logger.info(line.replace('\n', '')) + f_stdout.write(line) + p.wait() f_stdout.close() f_stderr.close() f_env.close() cmd_line = "rally verify show" - ft_utils.execute_command(cmd_line, logger, - exit_on_error=True, info=True) + output = "" + p = subprocess.Popen( + cmd_line, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + for line in p.stdout: + if re.search("Tests\:", line): + break + output += line + logger.info(output) cmd_line = "rally verify list" - logger.debug('Executing command : {}'.format(cmd_line)) cmd = os.popen(cmd_line) output = (((cmd.read()).splitlines()[-2]).replace(" ", "")).split("|") # Format: diff --git a/utils/functest_utils.py b/utils/functest_utils.py index 9a19eb4ca..b51a1c868 100644 --- a/utils/functest_utils.py +++ b/utils/functest_utils.py @@ -244,7 +244,8 @@ def execute_command(cmd, logger=None, print(msg_exec) p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) while True: - line = p.stdout.readline().replace('\n', '') + output = p.stdout.readline() + line = output.replace('\n', '') if not line: break if logger: |