make coverage target for code coverage for the unit test

so that we can easily find which module needs unit test

In order to run 'make coverage' `luacov` need to be installed
with 'sudo luarocks install luacov'.
This commit is contained in:
chrox
2014-10-06 21:31:04 +08:00
parent 330e5a2789
commit f1f8d8dc4f
6 changed files with 82 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
require "defaults"
package.path = "?.lua;common/?.lua;frontend/?.lua"
package.cpath = "?.so;common/?.so;/usr/lib/lua/?.so"
package.path = "?.lua;common/?.lua;frontend/?.lua;" .. package.path
package.cpath = "?.so;common/?.so;/usr/lib/lua/?.so;" .. package.cpath
require "libs/libkoreader-lfs"
-- global einkfb for Screen
@@ -26,22 +26,23 @@ describe("Cache module", function()
it("should clear cache", function()
Cache:clear()
end)
local max_page = 1
it("should serialize blitbuffer", function()
for pageno = 1, math.min(10, doc.info.number_of_pages) do
for pageno = 1, math.min(max_page, doc.info.number_of_pages) do
doc:renderPage(pageno, nil, 1, 0, 1.0, 0)
Cache:serialize()
end
Cache:clear()
end)
it("should deserialize blitbuffer", function()
for pageno = 1, math.min(10, doc.info.number_of_pages) do
for pageno = 1, math.min(max_page, doc.info.number_of_pages) do
doc:hintPage(pageno, 1, 0, 1.0, 0)
end
Cache:clear()
end)
it("should serialize koptcontext", function()
doc.configurable.text_wrap = 1
for pageno = 1, math.min(10, doc.info.number_of_pages) do
for pageno = 1, math.min(max_page, doc.info.number_of_pages) do
doc:renderPage(pageno, nil, 1, 0, 1.0, 0)
doc:getPageDimensions(pageno)
Cache:serialize()
@@ -49,7 +50,7 @@ describe("Cache module", function()
Cache:clear()
end)
it("should deserialize koptcontext", function()
for pageno = 1, math.min(10, doc.info.number_of_pages) do
for pageno = 1, math.min(max_page, doc.info.number_of_pages) do
doc:renderPage(pageno, nil, 1, 0, 1.0, 0)
end
Cache:clear()