wrap computation intensive functions in hook free env when makeing coverage test

so that Travis CI job won't fail because of timeout.
This commit is contained in:
chrox committed 2014-12-03 11:01:12 +08:00
1 parent 0a94696213
commit 4f35834b2e
2 files changed
+26

No files matched your search

+22
View File
@@ -21,3 +21,25 @@ Input.dummy = true
-- turn on debug
local DEBUG = require("dbg")
--DEBUG:turnOn()
-- remove debug hooks in wrapped function for better luacov performance
if LUACOV then
local function hook_free_call(callback)
local hook, mask, count = debug.gethook()
debug.sethook()
local res = callback()
debug.sethook(hook, mask)
return res
end
local UIManager = require("ui/uimanager")
local uimanager_run = UIManager.run
function UIManager:run()
hook_free_call(function() return uimanager_run(UIManager) end)
end
local screen_shot = Screen.shot
function Screen:shot(filename)
hook_free_call(function() return screen_shot(Screen, filename) end)
end
end