From bc7911b668a5e7600788377a2227e191692e92b2 Mon Sep 17 00:00:00 2001 From: Steve Freegard Date: Mon, 19 Mar 2018 12:11:24 +0000 Subject: [PATCH] Corpus test improvements --- lualib/rspamadm/corpus_test.lua | 13 ++++++++++--- 1 file 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 -- 2.39.5