Thu, 18 Feb 2016 19:00:01 +0000
main.lua: Add per-action timeout
main.lua | file | annotate | diff | comparison | revisions |
--- a/main.lua Sat Feb 06 14:38:40 2016 +0000 +++ b/main.lua Thu Feb 18 19:00:01 2016 +0000 @@ -9,6 +9,7 @@ local test_metadata = {}; local server_log_wait_time = 0.2; local skip_server_startup_log = false; +local action_timeout = 1; local property_rules = {}; @@ -137,7 +138,7 @@ local async = require "scansion.async"; local runner = async.runner(function (d) - for _, action in pairs(script.actions) do + for i, action in ipairs(script.actions) do local object = script.objects[action.object_name]; local handler = object.handler; assert(handler[action.action], "Objects of type '"..object.type.."' do not support action '"..action.action.."'"); @@ -156,6 +157,14 @@ print(action.annotation); end print(object.name, action.action.."..."); + if action_timeout and action_timeout > 0 then + local action_number = i; + verse.add_task(action_timeout, function () + if i == action_number then + error("Timeout waiting for response from server"); + end + end); + end local ok, err = pcall(handler[action.action], object, action.extra); if server_log_reader then log_data("server", { lines = server_log_reader() });