aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorSteve Freegard <steve@stevefreegard.com>2018-03-19 12:11:24 +0000
committerSteve Freegard <steve@stevefreegard.com>2018-03-19 12:11:24 +0000
commitbc7911b668a5e7600788377a2227e191692e92b2 (patch)
tree7e13f56afbba1dacdefea6a14aa5539389bd6d05 /lualib
parent154cca920d07e9e563bc9b515f5c25328cd919d0 (diff)
downloadrspamd-bc7911b668a5e7600788377a2227e191692e92b2.tar.gz
rspamd-bc7911b668a5e7600788377a2227e191692e92b2.zip
Corpus test improvements
Diffstat (limited to 'lualib')
-rw-r--r--lualib/rspamadm/corpus_test.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/lualib/rspamadm/corpus_test.lua b/lualib/rspamadm/corpus_test.lua
index eb93d586c..b71f96e9e 100644
--- a/lualib/rspamadm/corpus_test.lua
+++ b/lualib/rspamadm/corpus_test.lua
@@ -5,10 +5,10 @@ local lua_util = require "lua_util"
local HAM = "HAM"
local SPAM = "SPAM"
-local function scan_email(n_parellel, path, timeout)
+local function scan_email(n_parallel, path, timeout)
local rspamc_command = string.format("rspamc -j --compact -n %s -t %.3f %s",
- n_parellel, timeout, path)
+ n_parallel, timeout, path)
local result = assert(io.popen(rspamc_command))
result = result:read("*all")
return result
@@ -25,6 +25,8 @@ local function write_results(results, file)
log_line = log_line .. " " .. sym
end
+ log_line = log_line .. " " .. result.scan_time .. " " .. file .. ':' .. result.filename
+
log_line = log_line .. "\r\n"
f:write(log_line)
@@ -62,6 +64,9 @@ local function encoded_json_to_log(result)
table.insert(filtered_result.symbols, sym)
end
+ filtered_result.filename = result.filename
+ filtered_result.scan_time = result.scan_time
+
return filtered_result
end
@@ -127,8 +132,10 @@ return function (_, res)
write_results(results, output)
io.write("\nStats: \n")
+ local elapsed_time = os.time() - start_time
+ local total_msgs = no_of_ham + no_of_spam
io.write(string.format("Elapsed time: %ds\n", os.time() - start_time))
io.write(string.format("No of ham: %d\n", no_of_ham))
io.write(string.format("No of spam: %d\n", no_of_spam))
-
+ io.write(string.format("Messages/sec: %-.2f\n", (total_msgs/elapsed_time)))
end