diff options
author | Linda Wang <wangwulin@huawei.com> | 2017-03-22 01:35:42 +0000 |
---|---|---|
committer | Jose Lausuch <jose.lausuch@ericsson.com> | 2017-03-24 07:49:48 +0000 |
commit | 07ef218c954a7825f2dff999f897f6c966b62458 (patch) | |
tree | 85c4ad950b7ceaaec3aa3eed130e1d04d61deb25 | |
parent | 07e2518f65291e16d2d37947c130e67ce9424a18 (diff) |
Clean redundant error logs of refstack_defcore in the console
1. Remove the file "refstack-error.log", and all the stderr and stdout
will be stored in refstack.log
2. Clean redundant error logs in the console and all the detailed error
logs will be found in refstack.log.
Change-Id: I7e71567c98dc89c529421eccbf1b497962b07405
Signed-off-by: Linda Wang <wangwulin@huawei.com>
(cherry picked from commit 0a07e0f686d9aaaa12b6445e99a67e0a7f7dbbd0)
-rwxr-xr-x | functest/opnfv_tests/openstack/refstack_client/refstack_client.py | 29 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/tempest.py | 2 |
2 files changed, 16 insertions, 15 deletions
diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py index 7d4c568a9..4312b7f9e 100755 --- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py +++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py @@ -69,8 +69,8 @@ class RefstackClient(testcase_base.TestcaseBase): self.defcorelist)) logger.info("Starting Refstack_defcore test case: '%s'." % cmd) - header = ("Tempest environment:\n" - " Installer: %s\n Scenario: %s\n Node: %s\n Date: %s\n" % + header = ("Refstack environment:\n" + " SUT: %s\n Scenario: %s\n Node: %s\n Date: %s\n" % (CONST.INSTALLER_TYPE, CONST.DEPLOY_SCENARIO, CONST.NODE_NAME, @@ -79,26 +79,23 @@ class RefstackClient(testcase_base.TestcaseBase): f_stdout = open( os.path.join(conf_utils.REFSTACK_RESULTS_DIR, "refstack.log"), 'w+') - f_stderr = open( - os.path.join(conf_utils.REFSTACK_RESULTS_DIR, - "refstack-error.log"), 'w+') f_env = open(os.path.join(conf_utils.REFSTACK_RESULTS_DIR, "environment.log"), 'w+') f_env.write(header) p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, - stderr=f_stderr, bufsize=1) + stderr=subprocess.STDOUT, bufsize=1) with p.stdout: for line in iter(p.stdout.readline, b''): if 'Tests' in line: break - logger.info(line.replace('\n', '')) + 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() def parse_refstack_result(self): @@ -110,12 +107,16 @@ class RefstackClient(testcase_base.TestcaseBase): for match in re.findall("Ran: (\d+) tests in (\d+\.\d{4}) sec.", output): num_tests = match[0] - for match in re.findall("- Passed: (\d+)", output): - num_success = match - for match in re.findall("- Skipped: (\d+)", output): - num_skipped = match - for match in re.findall("- Failed: (\d+)", output): - num_failures = match + logger.info("Ran: %s tests in %s sec." % (num_tests, match[1])) + for match in re.findall("(- Passed: )(\d+)", output): + num_success = match[1] + logger.info("".join(match)) + for match in re.findall("(- Skipped: )(\d+)", output): + num_skipped = match[1] + logger.info("".join(match)) + for match in re.findall("(- Failed: )(\d+)", output): + num_failures = match[1] + logger.info("".join(match)) success_testcases = "" for match in re.findall(r"\{0\}(.*?)[. ]*ok", output): success_testcases += match + ", " diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index d3b159264..54556a32f 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -116,7 +116,7 @@ class TempestCommon(testcase_base.TestcaseBase): logger.info("Starting Tempest test suite: '%s'." % cmd_line) header = ("Tempest environment:\n" - " Installer: %s\n Scenario: %s\n Node: %s\n Date: %s\n" % + " SUT: %s\n Scenario: %s\n Node: %s\n Date: %s\n" % (CONST.INSTALLER_TYPE, CONST.DEPLOY_SCENARIO, CONST.NODE_NAME, |