diff options
author | Juha Kosonen <juha.kosonen@nokia.com> | 2016-01-21 08:26:47 +0000 |
---|---|---|
committer | Juha Kosonen <juha.kosonen@nokia.com> | 2016-01-21 11:07:31 +0000 |
commit | c2fcca7373e4b65d4eec221e020bc49c9e443a70 (patch) | |
tree | 0e8a64ffeb314e56d7fd3a9ca1e4523299775743 /testcases/VIM/OpenStack/CI/libraries/run_rally.py | |
parent | 2a9268e11cbac21a0952dee6831d28cd06dc70d7 (diff) |
Add control to redirect rally stderr
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>
Diffstat (limited to 'testcases/VIM/OpenStack/CI/libraries/run_rally.py')
-rwxr-xr-x[-rw-r--r--] | testcases/VIM/OpenStack/CI/libraries/run_rally.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally.py b/testcases/VIM/OpenStack/CI/libraries/run_rally.py index a7f1db13..d1088014 100644..100755 --- a/testcases/VIM/OpenStack/CI/libraries/run_rally.py +++ b/testcases/VIM/OpenStack/CI/libraries/run_rally.py @@ -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() |