Add control to redirect rally stderr 97/7597/1
authorJuha Kosonen <juha.kosonen@nokia.com>
Thu, 21 Jan 2016 08:26:47 +0000 (08:26 +0000)
committerMorgan Richomme <morgan.richomme@orange.com>
Thu, 21 Jan 2016 12:37:25 +0000 (12:37 +0000)
By default rally stderr output is suppressed. Option --verbose enables
the output by redirecting it to stdout.

Change-Id: I2fd372b2a5cd70095969ef926bc9675dde4f98f6
Signed-off-by: Juha Kosonen <juha.kosonen@nokia.com>
(cherry picked from commit c2fcca7373e4b65d4eec221e020bc49c9e443a70)

testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
testcases/VIM/OpenStack/CI/libraries/run_rally.py [changed mode: 0644->0755]

index 17a6596..1c27b02 100755 (executable)
@@ -49,12 +49,19 @@ parser.add_argument("-r", "--report",
 parser.add_argument("-s", "--smoke",
                     help="Smoke test mode",
                     action="store_true")
+parser.add_argument("-v", "--verbose",
+                    help="Print verbose info about the progress",
+                    action="store_true")
 
 args = parser.parse_args()
 
 client_dict = {}
 
-FNULL = open(os.devnull, 'w')
+if args.verbose:
+    RALLY_STDERR = subprocess.STDOUT
+else:
+    RALLY_STDERR = open(os.devnull, 'w')
+
 """ logging configuration """
 logger = logging.getLogger("run_rally")
 logger.setLevel(logging.DEBUG)
@@ -211,7 +218,7 @@ def run_task(test_name):
                "--task-args \"{}\" ".format(build_task_args(test_name))
     logger.debug('running command line : {}'.format(cmd_line))
 
-    p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=FNULL, shell=True)
+    p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=RALLY_STDERR, shell=True)
     result = ""
     while p.poll() is None:
         l = p.stdout.readline()
old mode 100644 (file)
new mode 100755 (executable)
index a7f1db1..d108801
@@ -44,11 +44,17 @@ parser.add_argument("-d", "--debug", help="Debug mode",  action="store_true")
 parser.add_argument("-r", "--report",
                     help="Create json result file",
                     action="store_true")
+parser.add_argument("-v", "--verbose",
+                    help="Print verbose info about the progress",
+                    action="store_true")
 
 args = parser.parse_args()
 
+if args.verbose:
+    RALLY_STDERR = subprocess.STDOUT
+else:
+    RALLY_STDERR = open(os.devnull, 'w')
 
-FNULL = open(os.devnull, 'w')
 """ logging configuration """
 logger = logging.getLogger("run_rally")
 logger.setLevel(logging.DEBUG)
@@ -164,7 +170,7 @@ def run_task(test_name):
         logger.debug('Scenario fetched from : {}'.format(test_file_name))
         cmd_line = "rally task start --abort-on-sla-failure {}".format(test_file_name)
         logger.debug('running command line : {}'.format(cmd_line))
-        p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=FNULL, shell=True)
+        p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=RALLY_STDERR, shell=True)
         result = ""
         while p.poll() is None:
             l = p.stdout.readline()