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

so that Travis CI job won't fail because of timeout.
pull/1328/head
chrox 10 years ago
parent 0a94696213
commit 4f35834b2e

@ -2,6 +2,10 @@
-- project folder as '.luacov' for project specific configuration
-- @class module
-- @name luacov.defaults
-- global flag to indicate coverage test
LUACOV = true
return {
-- default filename to load for config options if not provided

@ -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

Loading…
Cancel
Save