tests/_runner.lua: Use less waiting

Before this, the test runner used a timer which fired every 0.1 seconds
to "do its thing". Many of these waits seem unnecessary.

This commit makes the test runner wait 0 seconds for the first call of a
step function. Only following calls will have a timeout of 0.1 seconds
applied.

A full run of the test suite (tests/run.sh without further arguments)
took about 100 seconds before this change. After this change, we are
down to 60 seconds. This is almost factor two faster! (Well, five thirds
is the exact number, so factor 1.66)

(The numbers are best out of three runs. The "before" number is rounded
down while the "after" number is rounded up.)

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2017-01-01 14:46:29 +01:00
parent edff48f133
commit 6534208f62
1 changed files with 3 additions and 1 deletions

View File

@ -32,7 +32,7 @@ end)
runner.run_steps = function(steps) runner.run_steps = function(steps)
-- Setup timer/timeout to limit waiting for signal and quitting awesome. -- Setup timer/timeout to limit waiting for signal and quitting awesome.
-- This would be common for all tests. -- This would be common for all tests.
local t = timer({timeout=0.1}) local t = timer({timeout=0})
local wait=20 local wait=20
local step=1 local step=1
local step_count=0 local step_count=0
@ -64,6 +64,7 @@ runner.run_steps = function(steps)
step = step+1 step = step+1
step_count = 0 step_count = 0
wait = 5 wait = 5
t.timeout = 0
t:again() t:again()
return return
end end
@ -78,6 +79,7 @@ runner.run_steps = function(steps)
else else
wait = wait-1 wait = wait-1
if wait > 0 then if wait > 0 then
t.timeout = 0.1
t:again() t:again()
else else
io.stderr:write("Error: timeout waiting for signal in step " io.stderr:write("Error: timeout waiting for signal in step "