From 662efbb518793a268fb7e82057ccd9b8c197b386 Mon Sep 17 00:00:00 2001 From: Hans Feldt Date: Wed, 3 Jun 2015 18:04:31 +0200 Subject: fix exit status at SLA assertion tested by changing SLA action to assert and lower rtt, yardstick command should exit non zero Change-Id: I2dd091941fb4359add849f218cacc04f364142cd JIRA: YARDSTICK-25 Signed-off-by: Hans Feldt --- yardstick/main.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'yardstick/main.py') diff --git a/yardstick/main.py b/yardstick/main.py index f270bf9ee..050a56436 100755 --- a/yardstick/main.py +++ b/yardstick/main.py @@ -54,6 +54,8 @@ class TaskParser(object): def atexit_handler(): '''handler for process termination''' + base_runner.Runner.terminate_all() + if HeatStack.stacks_exist(): print "Deleting all stacks" HeatStack.delete_all() @@ -87,6 +89,14 @@ def run_one_scenario(scenario_cfg, context, output_file): return runner +def runner_join(runner): + '''join (wait for) a runner, exit process at runner failure''' + status = runner.join() + base_runner.Runner.release(runner) + if status != 0: + sys.exit("Runner failed") + + def main(): '''yardstick main''' @@ -110,16 +120,14 @@ def main(): # Wait for runners to finish for runner in runners: - runner.join() + runner_join(runner) print "Runner ended, output in", prog_args.output_file - base_runner.Runner.release(runner) else: # run serially for scenario in scenarios: runner = run_one_scenario(scenario, context, prog_args.output_file) - runner.join() + runner_join(runner) print "Runner ended, output in", prog_args.output_file - base_runner.Runner.release(runner) if prog_args.keep_deploy: # keep deployment, forget about stack (hide it for exit handler) -- cgit 1.2.3-korg