From c05d4ff4d1c5f5eb61b92fb7fff8f667aa0c9b40 Mon Sep 17 00:00:00 2001 From: onefang Date: Mon, 20 Jul 2020 22:34:32 +1000 Subject: If a thing is untested, mark it as so. --- apt-panopticommon.lua | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'apt-panopticommon.lua') diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index 52159dd..593fa32 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua @@ -435,13 +435,13 @@ local log = function(v, t, s, prot, test, host) t = t .. "(" .. x .. ")" if "" ~= prot then if "" == test then - if nil == APT.results[prot] then APT.results[prot] = {errors = 0; warnings = 0; timeouts = 0} end + if nil == APT.results[prot] then APT.results[prot] = {tested = 0; errors = 0; warnings = 0; timeouts = 0} end if v == 0 then APT.results[prot].errors = APT.results[prot].errors + 1 end if v == 1 then APT.results[prot].warnings = APT.results[prot].warnings + 1 end if v == 2 then APT.results[prot].timeouts = APT.results[prot].timeouts + 1 end else - if nil == APT.results[prot] then APT.results[prot] = {errors = 0; warnings = 0; timeouts = 0} end - if nil == APT.results[prot][test] then APT.results[prot][test] = {errors = 0; warnings = 0; timeouts = 0} end + if nil == APT.results[prot] then APT.results[prot] = {tested = 0; errors = 0; warnings = 0; timeouts = 0} end + if nil == APT.results[prot][test] then APT.results[prot][test] = {tested = 0; errors = 0; warnings = 0; timeouts = 0} end if v == 0 then APT.results[prot][test].errors = APT.results[prot][test].errors + 1 end if v == 1 then APT.results[prot][test].warnings = APT.results[prot][test].warnings + 1 end if v == 2 then APT.results[prot][test].timeouts = APT.results[prot][test].timeouts + 1 end @@ -496,6 +496,17 @@ APT.testing = function(t, host) return false end +APT.tested = function(prot, test, host) + if "" == test then + if nil == APT.results[prot] then APT.results[prot] = {tested = 0; errors = 0; warnings = 0; timeouts = 0} end + APT.results[prot].tested = APT.results[prot].tested + 1; + else + if nil == APT.results[prot] then APT.results[prot] = {tested = 0; errors = 0; warnings = 0; timeouts = 0} end + if nil == APT.results[prot][test] then APT.results[prot][test] = {tested = 0; errors = 0; warnings = 0; timeouts = 0} end + APT.results[prot][test].tested = APT.results[prot][test].tested + 1; + end +end + APT.exe = function(c) local exe = {status = 0, result = '', log = true, cmd = c .. ' '} @@ -607,7 +618,7 @@ APT.plurals = function(e, w, t) return result end -local typs = {'errors', 'warnings', 'timeouts'} +local typs = {'tested', 'errors', 'warnings', 'timeouts'} APT.padResults = function(results) local c = 0 if nil == results then results = {}; c = 999 end -- cgit v1.1