From 432908dd26cbfcd62c39a756b43038136bba9573 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Fri, 12 Feb 2016 09:23:41 +0100 Subject: [PATCH] Fix test-leak-client.lua under LuaCov Both the test runner and the wibox use gears.timer.delayed_call(). The test runner uses this to call steps and the wibox uses it to trigger redraws. When running under LuaCov, the Lua code becomes slow enough that the wibox didn't redraw yet when the leak check is run. This causes the check to fail, because the client is still referenced by the tasklist and thus cannot be garbage collected. Fix this by waiting one more iteration before running the leak check. Signed-off-by: Uli Schlachter --- tests/test-leak-client.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test-leak-client.lua b/tests/test-leak-client.lua index 205e48248..c70bf3699 100644 --- a/tests/test-leak-client.lua +++ b/tests/test-leak-client.lua @@ -46,6 +46,7 @@ collectgarbage("stop") -- The first iteration starts xterm, the second keeps a weak reference to it and -- closes it and the last one checks that the client object is GC'able. local objs = nil +local second_call = false local steps = { function(count) if count == 1 then @@ -56,6 +57,10 @@ local steps = { objs = setmetatable({ c }, { __mode = "v" }) c:kill() end + elseif not second_call then + -- Wait for one iteration so that gears.timer handles other delayed + -- calls (= the tasklist updates) + second_call = true else assert(#objs == 1)