summaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-01-27 17:36:56 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-01-27 17:36:56 +0000
commite713d4232c8d7921e99c3801d0632fa5e5fdd73e (patch)
treebd40ce92c3ae043b2708a3e2b490af314995f253 /testcases
parentb3b50bef3d0ee76decca7810fbccdbac13ab892c (diff)
parent9be6519eca39111295b89e9b3b0d853f95126a72 (diff)
Merge "Option to redirect stderr output to a file for Tempest test"
Diffstat (limited to 'testcases')
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/run_tempest.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
index ee0a4bea8..0097a567b 100644
--- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
@@ -73,6 +73,8 @@ USER_NAME = functest_yaml.get("tempest").get("identity").get("user_name")
USER_PASSWORD = functest_yaml.get("tempest").get("identity").get("user_password")
DEPLOYMENT_MAME = functest_yaml.get("rally").get("deployment_name")
RALLY_INSTALLATION_DIR = functest_yaml.get("general").get("directories").get("dir_rally_inst")
+RESULTS_DIR = functest_yaml.get("general").get("directories").get("dir_results")
+TEMPEST_RESULTS_DIR = RESULTS_DIR + '/tempest'
def get_info(file_result):
@@ -211,7 +213,23 @@ def run_tempest(OPTION):
logger.info("Starting Tempest test suite: '%s'." % OPTION)
cmd_line = "rally verify start "+OPTION
logger.debug('Executing command : {}'.format(cmd_line))
- subprocess.call(cmd_line, shell=True, stderr=subprocess.STDOUT)
+
+ CI_DEBUG = os.environ.get("CI_DEBUG")
+ if CI_DEBUG == "true" or CI_DEBUG == "True":
+ subprocess.call(cmd_line, shell=True, stderr=subprocess.STDOUT)
+ else:
+ if not os.path.exists(TEMPEST_RESULTS_DIR):
+ os.makedirs(TEMPEST_RESULTS_DIR)
+
+ f = open(TEMPEST_RESULTS_DIR+"/tempest.log", 'w+')
+ FNULL = open(os.devnull, 'w')
+
+ subprocess.call(cmd_line, shell=True, stdout=FNULL, stderr=f)
+ f.close()
+ FNULL.close()
+
+ cmd_line = "rally verify show"
+ subprocess.call(cmd_line, shell=True)
cmd_line = "rally verify list"
logger.debug('Executing command : {}'.format(cmd_line))