From 5fdc34a47de02ee9289dbaddc6e727cf2c053201 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Tue, 16 Sep 2014 14:00:54 +0500 Subject: [PATCH] Add. Use LuaCov --- .travis.yml | 4 +++- test/.luacov | 38 ++++++++++++++++++++++++++++++++++++++ test/test_curl.lua | 2 ++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 test/.luacov diff --git a/.travis.yml b/.travis.yml index f08fa33..3bb8c6b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,7 @@ before_install: - sudo luarocks install dkjson - sudo luarocks install luafilesystem - sudo luarocks install lua-path + - sudo luarocks install luacov-coveralls install: - sudo luarocks make rockspecs/lua-curl-scm-0.rockspec CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="-shared --coverage" @@ -34,7 +35,8 @@ script: - lunit.sh test_curl.lua after_success: - - coveralls -b .. -r .. + - coveralls -b .. -r .. --dump c.report.json + - luacov-coveralls -j c.report.json notifications: email: diff --git a/test/.luacov b/test/.luacov new file mode 100644 index 0000000..08b5c3b --- /dev/null +++ b/test/.luacov @@ -0,0 +1,38 @@ +return { + configfile = ".luacov", + + -- filename to store stats collected + statsfile = "luacov.stats.out", + + -- filename to store report + reportfile = "luacov.report.json", + + -- Run reporter on completion? (won't work for ticks) + runreport = false, + + -- Delete stats file after reporting? + deletestats = false, + + -- Patterns for files to include when reporting + -- all will be included if nothing is listed + -- (exclude overrules include, do not include + -- the .lua extension) + include = { + "/cURL$", + "/cURL/.+$", + }, + + -- Patterns for files to exclude when reporting + -- all will be included if nothing is listed + -- (exclude overrules include, do not include + -- the .lua extension) + exclude = { + }, + + -- configuration for luacov-coveralls reporter + coveralls = { + pathcorrect = { + {"/usr/local/share/lua/5.[123]", "src/lua"}; + }, + }, +} \ No newline at end of file diff --git a/test/test_curl.lua b/test/test_curl.lua index 2282147..6f05335 100644 --- a/test/test_curl.lua +++ b/test/test_curl.lua @@ -1,3 +1,5 @@ +local _,luacov = pcall(require, "luacov") + local HAS_RUNNER = not not lunit local lunit = require "lunit" local TEST_CASE = assert(lunit.TEST_CASE)