From 6534208f62b084fc7fa0c2973d74a212c1d4ae40 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 1 Jan 2017 14:46:29 +0100 Subject: [PATCH] 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 --- tests/_runner.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/_runner.lua b/tests/_runner.lua index c446c04b..5d5b4810 100644 --- a/tests/_runner.lua +++ b/tests/_runner.lua @@ -32,7 +32,7 @@ end) runner.run_steps = function(steps) -- Setup timer/timeout to limit waiting for signal and quitting awesome. -- This would be common for all tests. - local t = timer({timeout=0.1}) + local t = timer({timeout=0}) local wait=20 local step=1 local step_count=0 @@ -64,6 +64,7 @@ runner.run_steps = function(steps) step = step+1 step_count = 0 wait = 5 + t.timeout = 0 t:again() return end @@ -78,6 +79,7 @@ runner.run_steps = function(steps) else wait = wait-1 if wait > 0 then + t.timeout = 0.1 t:again() else io.stderr:write("Error: timeout waiting for signal in step "