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 <psychon@znc.in>
This commit is contained in:
parent
9e05ff63ce
commit
432908dd26
|
@ -46,6 +46,7 @@ collectgarbage("stop")
|
||||||
-- The first iteration starts xterm, the second keeps a weak reference to it and
|
-- 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.
|
-- closes it and the last one checks that the client object is GC'able.
|
||||||
local objs = nil
|
local objs = nil
|
||||||
|
local second_call = false
|
||||||
local steps = {
|
local steps = {
|
||||||
function(count)
|
function(count)
|
||||||
if count == 1 then
|
if count == 1 then
|
||||||
|
@ -56,6 +57,10 @@ local steps = {
|
||||||
objs = setmetatable({ c }, { __mode = "v" })
|
objs = setmetatable({ c }, { __mode = "v" })
|
||||||
c:kill()
|
c:kill()
|
||||||
end
|
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
|
else
|
||||||
assert(#objs == 1)
|
assert(#objs == 1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue