From cd42c5ba41d08ed6d378aa78ccdabbb51569f739 Mon Sep 17 00:00:00 2001 From: "jose.lausuch" Date: Wed, 4 May 2016 16:57:36 +0200 Subject: Refactor, add logger handler to collect all the logs to a file as well JIRA: FUNCTEST-190 Also: - remove old code that are not used any more - improve execute_command function - fix logger output for run_tempest Change-Id: Ib268738ada1b9de2a418ef01e684a90e6f4e02ed Signed-off-by: jose.lausuch --- ci/run_tests.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'ci/run_tests.py') diff --git a/ci/run_tests.py b/ci/run_tests.py index 5b9309828..9a4ce967c 100644 --- a/ci/run_tests.py +++ b/ci/run_tests.py @@ -10,12 +10,12 @@ import argparse import os -import subprocess import sys import functest.ci.tier_builder as tb import functest.utils.clean_openstack as clean_os import functest.utils.functest_logger as ft_logger +import functest.utils.functest_utils as ft_utils import functest.utils.openstack_utils as os_utils @@ -77,13 +77,9 @@ def run_test(test): cmd = ("%s%s" % (EXEC_SCRIPT, flags)) logger.debug("Executing command '%s'" % cmd) - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) + result = ft_utils.execute_command(cmd, logger, exit_on_error=False) - while p.poll() is None: - line = p.stdout.readline().rstrip() - logger.debug(line) - - if p.returncode != 0: + if result != 0: logger.error("The test case '%s' failed. Cleaning and exiting." % test_name) if CLEAN_FLAG: -- cgit 1.2.3-korg