commit 3ade39661b183b32b180ae485fed2dcc3dfadc5f
parent 7171cdfc1338c78b067775acc9e9f6936fb7a252
Author: Richard Ipsum <richardipsum@fastmail.co.uk>
Date: Tue, 4 Jun 2019 22:53:06 +0100
Fix execution of "FINALLY" steps
Diffstat:
M | tyarn.in | | | 32 | +++++++++++++++++++++----------- |
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/tyarn.in b/tyarn.in
@@ -375,6 +375,7 @@ function run_scenario(scenarios, implementations, scenario_key, shell_lib_path)
os.exit(1)
end
+ scenario_passed = true
for n, step in ipairs(scenario) do
if parsed_args['verbose'] > 0 then
print('Running step', step)
@@ -383,16 +384,7 @@ function run_scenario(scenarios, implementations, scenario_key, shell_lib_path)
scenario_key, step, shell_prelude)
if not success then
- -- run FINALLY steps, if any
- for _, step in pairs(scenario["FINALLY"]) do
- success, _ = run_step(scenario_dir, datadir, implementations,
- scenario_key, step, shell_prelude)
- end
-
- if parsed_args["exit_early"] then
- os.exit(1)
- end
-
+ scenario_passed = false
break
end
@@ -402,9 +394,22 @@ function run_scenario(scenarios, implementations, scenario_key, shell_lib_path)
end
end
+ for _, step in pairs(scenario["FINALLY"]) do
+ success, _ = run_step(scenario_dir, datadir, implementations,
+ scenario_key, step, shell_prelude)
+
+ if not success then
+ scenario_passed = false
+ break
+ end
+ end
+
if not parsed_args["no_cleanup"] then
tyarn.rmutil(datadir)
end
+
+
+ return scenario_passed
end
parsed_args, parsed_env = tyarn.parse_args(arg)
@@ -445,7 +450,12 @@ end
implementations = parse_implementations(parsed_args[2])
for _, scenario_name in ipairs(scenario_list) do
- run_scenario(scenarios, implementations, scenario_name, parsed_args['shell_lib'])
+ passed = run_scenario(scenarios, implementations, scenario_name, parsed_args['shell_lib'])
+
+ if not passed and parsed_args["exit_early"] then
+ os.exit(1)
+ end
+
seen_scenario = true
end