unittests: Avoid infinite cycle somewhere because of init failure

This commit is contained in:
ZyX 2017-11-19 21:46:54 +03:00
parent ebb33eddd9
commit 7c20f60b88

View File

@ -644,13 +644,15 @@ local function itp_child(wr, func)
s = s:sub(1, hook_msglen - 2) s = s:sub(1, hook_msglen - 2)
sc.write(wr, '>' .. s .. (' '):rep(hook_msglen - 2 - #s) .. '\n') sc.write(wr, '>' .. s .. (' '):rep(hook_msglen - 2 - #s) .. '\n')
end end
init() local err, emsg = pcall(init)
collectgarbage('stop') if err then
child_sethook(wr) collectgarbage('stop')
local err, emsg = pcall(func) child_sethook(wr)
collectgarbage('restart') err, emsg = pcall(func)
collectgarbage() collectgarbage('restart')
debug.sethook() collectgarbage()
debug.sethook()
end
emsg = tostring(emsg) emsg = tostring(emsg)
sc.write(wr, trace_end_msg) sc.write(wr, trace_end_msg)
if not err then if not err then