Avoid duplicating logs in run_tests.py
authorCédric Ollivier <cedric.ollivier@orange.com>
Tue, 23 Aug 2016 11:25:02 +0000 (13:25 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Tue, 23 Aug 2016 11:41:17 +0000 (13:41 +0200)
When run_tests.py sets logger as execute_command arg, logs are
duplicated in functest.log and not shown in console (as every DEBUG
message). As logger is mainly managed by the python scripts in charge
of testing, it can be safely removed here.
stderr is also redirected to stdout in execute_command to print
possible relevant data.

JIRA: FUNCTEST-431

Change-Id: Ie77544b4679e12e0a0ac7f5e5989d86862fe106b
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
ci/run_tests.py
utils/functest_utils.py

index 758a87c..9825672 100755 (executable)
@@ -102,7 +102,7 @@ def run_test(test, tier_name):
 
     cmd = ("%s%s" % (EXEC_SCRIPT, flags))
     logger.debug("Executing command '%s'" % cmd)
-    result = ft_utils.execute_command(cmd, logger, exit_on_error=False)
+    result = ft_utils.execute_command(cmd, exit_on_error=False)
 
     if CLEAN_FLAG:
         cleanup()
index 4d5004c..b916ab1 100644 (file)
@@ -309,7 +309,8 @@ def execute_command(cmd, logger=None,
                 logger.debug(msg_exec)
         else:
             print(msg_exec)
-    p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
+    p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
+                         stderr=subprocess.STDOUT)
     for line in iter(p.stdout.readline, b''):
         line = line.replace('\n', '')
         if logger: