diff options
author | 2018-08-09 16:22:12 +0200 | |
---|---|---|
committer | 2018-08-23 23:50:11 +0200 | |
commit | 39851c876847f821a4ad197a4eba28b971a2eccb (patch) | |
tree | cb762de4fa73411635612d60ca4df227a80b2bf6 | |
parent | 073cd974a4612aa2aa9b749019097f7f279fb669 (diff) |
Redirect stderr to stdout when running tempest
JIRA: FUNCTEST-999
Change-Id: I64bfa31b01aa2ce5444b6e0f0ac46f8cde8dbaa3
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
(cherry picked from commit c4b3f91c6bb79c50adc1c5a4397666ebcd1f7375)
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/tempest.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index 4965244e3..aaa2d3d3e 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -79,10 +79,10 @@ class TempestCommon(singlevm.VmReady1): stdout=subprocess.PIPE, stderr=subprocess.STDOUT) for line in proc.stdout: + LOGGER.info(line.rstrip()) new_line = line.replace(' ', '').split('|') if 'Tests' in new_line: break - LOGGER.info(line) if 'Testscount' in new_line: result['num_tests'] = int(new_line[2]) elif 'Success' in new_line: @@ -171,20 +171,17 @@ class TempestCommon(singlevm.VmReady1): f_stdout = open( os.path.join(self.res_dir, "tempest.log"), 'w+') - f_stderr = open( - os.path.join(self.res_dir, - "tempest-error.log"), 'w+') proc = subprocess.Popen( cmd, stdout=subprocess.PIPE, - stderr=f_stderr, + stderr=subprocess.STDOUT, bufsize=1) with proc.stdout: for line in iter(proc.stdout.readline, b''): if re.search(r"\} tempest\.", line): - LOGGER.info(line.replace('\n', '')) + LOGGER.info(line.rstrip()) elif re.search('Starting verification', line): LOGGER.info(line.replace('\n', '')) first_pos = line.index("UUID=") + len("UUID=") @@ -193,12 +190,11 @@ class TempestCommon(singlevm.VmReady1): LOGGER.debug('Verification UUID: %s', self.verification_id) f_stdout.write(line) proc.wait() - f_stdout.close() - f_stderr.close() if self.verification_id is None: raise Exception('Verification UUID not found') + LOGGER.info('Verification UUID: %s', self.verification_id) shutil.copy( "{}/tempest.log".format(self.deployment_dir), |